mirror of
https://github.com/nerzhul/ownCloud-SMS-App.git
synced 2025-06-22 15:26:24 +00:00
Use nrz-androidlib for common code.
Use NrzSettingsActivity from nrz-androidlib as a parent of SettingsActivity Remove OcSMSNotification and use NrzNotification instead
This commit is contained in:
parent
ed4941f9e3
commit
b7e9f63e10
@ -1,8 +1,8 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
package="fr.unix_experience.owncloud_sms"
|
package="fr.unix_experience.owncloud_sms"
|
||||||
android:versionCode="24"
|
android:versionCode="26"
|
||||||
android:versionName="0.18.1">
|
android:versionName="0.18.2">
|
||||||
|
|
||||||
<!-- From Android 4.0 to 5.1 -->
|
<!-- From Android 4.0 to 5.1 -->
|
||||||
<uses-sdk
|
<uses-sdk
|
||||||
|
@ -11,5 +11,5 @@
|
|||||||
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
#proguard.config=${sdk.dir}/tools/proguard/proguard-android.txt:proguard-project.txt
|
||||||
|
|
||||||
# Project target.
|
# Project target.
|
||||||
target=android-21
|
target=android-22
|
||||||
android.library.reference.1=../Owncloud-Android-Library
|
android.library.reference.1=../Owncloud-Android-Library
|
||||||
|
@ -23,84 +23,31 @@ import android.accounts.Account;
|
|||||||
import android.accounts.AccountManager;
|
import android.accounts.AccountManager;
|
||||||
import android.annotation.TargetApi;
|
import android.annotation.TargetApi;
|
||||||
import android.content.ContentResolver;
|
import android.content.ContentResolver;
|
||||||
import android.content.Context;
|
|
||||||
import android.content.PeriodicSync;
|
import android.content.PeriodicSync;
|
||||||
import android.content.res.Configuration;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.CheckBoxPreference;
|
import android.preference.CheckBoxPreference;
|
||||||
import android.preference.ListPreference;
|
import android.preference.ListPreference;
|
||||||
import android.preference.Preference;
|
import android.preference.Preference;
|
||||||
import android.preference.PreferenceActivity;
|
|
||||||
import android.preference.PreferenceFragment;
|
import android.preference.PreferenceFragment;
|
||||||
import android.preference.PreferenceManager;
|
import fr.nrz.androidlib.activities.NrzSettingsActivity;
|
||||||
import fr.unix_experience.owncloud_sms.R;
|
import fr.unix_experience.owncloud_sms.R;
|
||||||
import fr.unix_experience.owncloud_sms.defines.DefaultPrefs;
|
import fr.unix_experience.owncloud_sms.defines.DefaultPrefs;
|
||||||
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
import fr.unix_experience.owncloud_sms.prefs.OCSMSSharedPrefs;
|
||||||
|
|
||||||
public class GeneralSettingsActivity extends PreferenceActivity {
|
public class GeneralSettingsActivity extends NrzSettingsActivity {
|
||||||
private static final boolean ALWAYS_SIMPLE_PREFS = false;
|
private static AccountManager _accountMgr;
|
||||||
private static Context mContext;
|
private static String _accountAuthority;
|
||||||
static AccountManager mAccountMgr;
|
private static String _accountType;
|
||||||
static String mAccountAuthority;
|
|
||||||
static String mSlowSyncAccountAuthority;
|
|
||||||
static String mAccountType;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onPostCreate(final Bundle savedInstanceState) {
|
protected void onPostCreate(final Bundle savedInstanceState) {
|
||||||
|
_accountMgr = AccountManager.get(getBaseContext());
|
||||||
|
_accountAuthority = getString(R.string.account_authority);
|
||||||
|
_accountType = getString(R.string.account_type);
|
||||||
|
_prefsRessourceFile = R.xml.pref_data_sync;
|
||||||
|
sBindPreferenceListener = sBindPreferenceSummaryToValueListener;
|
||||||
super.onPostCreate(savedInstanceState);
|
super.onPostCreate(savedInstanceState);
|
||||||
|
|
||||||
mAccountMgr = AccountManager.get(getBaseContext());
|
|
||||||
mAccountAuthority = getString(R.string.account_authority);
|
|
||||||
mSlowSyncAccountAuthority = getString(R.string.slowsync_account_authority);
|
|
||||||
mAccountType = getString(R.string.account_type);
|
|
||||||
setupSimplePreferencesScreen();
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Shows the simplified settings UI if the device configuration if the
|
|
||||||
* device configuration dictates that a simplified, single-pane UI should be
|
|
||||||
* shown.
|
|
||||||
*/
|
|
||||||
private void setupSimplePreferencesScreen() {
|
|
||||||
if (!isSimplePreferences(this)) {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
// In the simplified UI, fragments are not used at all and we instead
|
|
||||||
// use the older PreferenceActivity APIs.
|
|
||||||
addPreferencesFromResource(R.xml.pref_data_sync);
|
|
||||||
|
|
||||||
mContext = getBaseContext();
|
|
||||||
|
|
||||||
bindPreferences();
|
|
||||||
}
|
|
||||||
|
|
||||||
/** {@inheritDoc} */
|
|
||||||
@Override
|
|
||||||
public boolean onIsMultiPane() {
|
|
||||||
return isXLargeTablet(this) && !isSimplePreferences(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Helper method to determine if the device has an extra-large screen. For
|
|
||||||
* example, 10" tablets are extra-large.
|
|
||||||
*/
|
|
||||||
private static boolean isXLargeTablet(final Context context) {
|
|
||||||
return (context.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Determines whether the simplified settings UI should be shown. This is
|
|
||||||
* true if this is forced via {@link #ALWAYS_SIMPLE_PREFS}, or the device
|
|
||||||
* doesn't have newer APIs like {@link PreferenceFragment}, or the device
|
|
||||||
* doesn't have an extra-large screen. In these cases, a single-pane
|
|
||||||
* "simplified" settings UI should be shown.
|
|
||||||
*/
|
|
||||||
private static boolean isSimplePreferences(final Context context) {
|
|
||||||
return ALWAYS_SIMPLE_PREFS
|
|
||||||
|| Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
|
|
||||||
|| !isXLargeTablet(context);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +70,7 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
.setSummary(index >= 0 ? listPreference.getEntries()[index]
|
.setSummary(index >= 0 ? listPreference.getEntries()[index]
|
||||||
: null);
|
: null);
|
||||||
|
|
||||||
final Account[] myAccountList = mAccountMgr.getAccountsByType(mAccountType);
|
final Account[] myAccountList = _accountMgr.getAccountsByType(_accountType);
|
||||||
|
|
||||||
// Handle sync frequency change
|
// Handle sync frequency change
|
||||||
if (prefKey.equals("sync_frequency")) {
|
if (prefKey.equals("sync_frequency")) {
|
||||||
@ -132,7 +79,7 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
// Get ownCloud SMS account list
|
// Get ownCloud SMS account list
|
||||||
for (int i = 0; i < myAccountList.length; i++) {
|
for (int i = 0; i < myAccountList.length; i++) {
|
||||||
// And get all authorities for this account
|
// And get all authorities for this account
|
||||||
final List<PeriodicSync> syncList = ContentResolver.getPeriodicSyncs(myAccountList[i], mAccountAuthority);
|
final List<PeriodicSync> syncList = ContentResolver.getPeriodicSyncs(myAccountList[i], _accountAuthority);
|
||||||
|
|
||||||
boolean foundSameSyncCycle = false;
|
boolean foundSameSyncCycle = false;
|
||||||
for (int j = 0; j < syncList.size(); j++) {
|
for (int j = 0; j < syncList.size(); j++) {
|
||||||
@ -148,42 +95,12 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
b.putInt("synctype", 1);
|
b.putInt("synctype", 1);
|
||||||
|
|
||||||
ContentResolver.removePeriodicSync(myAccountList[i],
|
ContentResolver.removePeriodicSync(myAccountList[i],
|
||||||
mAccountAuthority, b);
|
_accountAuthority, b);
|
||||||
ContentResolver.addPeriodicSync(myAccountList[i],
|
ContentResolver.addPeriodicSync(myAccountList[i],
|
||||||
mAccountAuthority, b, syncFreq * 60);
|
_accountAuthority, b, syncFreq * 60);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// Slow Sync frequency
|
|
||||||
/*else if (prefKey.equals(new String("slow_sync_frequency"))) {
|
|
||||||
long syncFreq = Long.parseLong((String)value);
|
|
||||||
|
|
||||||
// Get ownCloud SMS account list
|
|
||||||
Account[] myAccountList = mAccountMgr.getAccountsByType(mAccountType);
|
|
||||||
for (int i = 0; i < myAccountList.length; i++) {
|
|
||||||
// And get all authorities for this account
|
|
||||||
List<PeriodicSync> syncList = ContentResolver.getPeriodicSyncs(myAccountList[i], mSlowSyncAccountAuthority);
|
|
||||||
|
|
||||||
boolean foundSameSyncCycle = false;
|
|
||||||
for (int j = 0; j < syncList.size(); j++) {
|
|
||||||
PeriodicSync ps = syncList.get(i);
|
|
||||||
|
|
||||||
if (ps.period == syncFreq && ps.extras.getInt("synctype") == 2) {
|
|
||||||
foundSameSyncCycle = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (foundSameSyncCycle == false) {
|
|
||||||
Bundle b = new Bundle();
|
|
||||||
b.putInt("synctype", 2);
|
|
||||||
|
|
||||||
ContentResolver.removePeriodicSync(myAccountList[i],
|
|
||||||
mSlowSyncAccountAuthority, b);
|
|
||||||
ContentResolver.addPeriodicSync(myAccountList[i],
|
|
||||||
mSlowSyncAccountAuthority, b, syncFreq * 60);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}*/
|
|
||||||
} else if (preference instanceof CheckBoxPreference) {
|
} else if (preference instanceof CheckBoxPreference) {
|
||||||
final String prefKey = preference.getKey();
|
final String prefKey = preference.getKey();
|
||||||
final Boolean boolValue = (Boolean)value;
|
final Boolean boolValue = (Boolean)value;
|
||||||
@ -192,7 +109,7 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
prefKey.equals(new String("sync_3g")) || prefKey.equals("sync_gprs") ||
|
prefKey.equals(new String("sync_3g")) || prefKey.equals("sync_gprs") ||
|
||||||
prefKey.equals("sync_4g") || prefKey.equals("sync_others")) {
|
prefKey.equals("sync_4g") || prefKey.equals("sync_others")) {
|
||||||
|
|
||||||
final OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(mContext);
|
final OCSMSSharedPrefs prefs = new OCSMSSharedPrefs(_context);
|
||||||
prefs.putBoolean(prefKey, boolValue);
|
prefs.putBoolean(prefKey, boolValue);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
@ -204,49 +121,6 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
|
||||||
* Binds a preference's summary to its value. More specifically, when the
|
|
||||||
* preference's value is changed, its summary (line of text below the
|
|
||||||
* preference title) is updated to reflect the value. The summary is also
|
|
||||||
* immediately updated upon calling this method. The exact display format is
|
|
||||||
* dependent on the type of preference.
|
|
||||||
*
|
|
||||||
* @see #sBindPreferenceSummaryToValueListener
|
|
||||||
*/
|
|
||||||
private static void bindPreferenceBooleanToValue(final Preference preference, final Boolean defValue) {
|
|
||||||
// Set the listener to watch for value changes.
|
|
||||||
preference
|
|
||||||
.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
|
||||||
|
|
||||||
// Trigger the listener immediately with the preference's
|
|
||||||
// current value.
|
|
||||||
sBindPreferenceSummaryToValueListener.onPreferenceChange(
|
|
||||||
preference,
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(
|
|
||||||
preference.getContext()).getBoolean(
|
|
||||||
preference.getKey(),
|
|
||||||
defValue
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
private static void bindPreferenceStringToValue(final Preference preference) {
|
|
||||||
// Set the listener to watch for value changes.
|
|
||||||
preference
|
|
||||||
.setOnPreferenceChangeListener(sBindPreferenceSummaryToValueListener);
|
|
||||||
|
|
||||||
// Trigger the listener immediately with the preference's
|
|
||||||
// current value.
|
|
||||||
sBindPreferenceSummaryToValueListener.onPreferenceChange(
|
|
||||||
preference,
|
|
||||||
PreferenceManager.getDefaultSharedPreferences(
|
|
||||||
preference.getContext()).getString(
|
|
||||||
preference.getKey(),
|
|
||||||
""
|
|
||||||
)
|
|
||||||
);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This fragment shows data and sync preferences only. It is used when the
|
* This fragment shows data and sync preferences only. It is used when the
|
||||||
* activity is showing a two-pane settings UI.
|
* activity is showing a two-pane settings UI.
|
||||||
@ -256,7 +130,7 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onCreate(final Bundle savedInstanceState) {
|
public void onCreate(final Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
addPreferencesFromResource(R.xml.pref_data_sync);
|
addPreferencesFromResource(_prefsRessourceFile);
|
||||||
|
|
||||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
|
||||||
// to their values. When their values change, their summaries are
|
// to their values. When their values change, their summaries are
|
||||||
@ -269,13 +143,11 @@ public class GeneralSettingsActivity extends PreferenceActivity {
|
|||||||
bindPreferenceBooleanToValue(findPreference("sync_gprs"), DefaultPrefs.syncGPRS);
|
bindPreferenceBooleanToValue(findPreference("sync_gprs"), DefaultPrefs.syncGPRS);
|
||||||
bindPreferenceBooleanToValue(findPreference("sync_2g"), DefaultPrefs.sync2G);
|
bindPreferenceBooleanToValue(findPreference("sync_2g"), DefaultPrefs.sync2G);
|
||||||
bindPreferenceBooleanToValue(findPreference("sync_others"), DefaultPrefs.syncOthers);
|
bindPreferenceBooleanToValue(findPreference("sync_others"), DefaultPrefs.syncOthers);
|
||||||
//bindPreferenceSummaryToValue(findPreference("slow_sync_frequency"));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void bindPreferences() {
|
@Override
|
||||||
mContext = getBaseContext();
|
protected void bindPreferences() {
|
||||||
|
|
||||||
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
|
// Bind the summaries of EditText/List/Dialog/Ringtone preferences to
|
||||||
// their values. When their values change, their summaries are updated
|
// their values. When their values change, their summaries are updated
|
||||||
// to reflect the new value, per the Android Design guidelines.
|
// to reflect the new value, per the Android Design guidelines.
|
||||||
|
@ -12,7 +12,7 @@ package fr.unix_experience.owncloud_sms.enums;
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
@ -1,57 +0,0 @@
|
|||||||
package fr.unix_experience.owncloud_sms.notifications;
|
|
||||||
|
|
||||||
/*
|
|
||||||
* Copyright (c) 2014-2015, Loic Blot <loic.blot@unix-experience.fr>
|
|
||||||
*
|
|
||||||
* This program is free software: you can redistribute it and/or modify
|
|
||||||
* it under the terms of the GNU Affero General Public License as
|
|
||||||
* published by the Free Software Foundation, either version 3 of the
|
|
||||||
* License, or (at your option) any later version.
|
|
||||||
*
|
|
||||||
* This program is distributed in the hope that it will be useful,
|
|
||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
||||||
* GNU Affero General Public License for more details.
|
|
||||||
*
|
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
||||||
*/
|
|
||||||
|
|
||||||
import fr.unix_experience.owncloud_sms.R;
|
|
||||||
import fr.unix_experience.owncloud_sms.enums.OCSMSNotificationType;
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Notification;
|
|
||||||
import android.app.Notification.Builder;
|
|
||||||
import android.app.NotificationManager;
|
|
||||||
import android.content.Context;
|
|
||||||
import android.os.Build;
|
|
||||||
|
|
||||||
public class OCSMSNotification {
|
|
||||||
public OCSMSNotification(Context ct) {
|
|
||||||
_ct = ct;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
public boolean createNotify(OCSMSNotificationType nType, String nTitle, String nText) {
|
|
||||||
if (_ct == null) {
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
NotificationManager notificationManager = (NotificationManager)_ct.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
|
|
||||||
Builder mBuilder = new Notification.Builder(_ct)
|
|
||||||
.setContentText(nText)
|
|
||||||
.setContentTitle(nTitle)
|
|
||||||
.setSmallIcon(R.drawable.ic_launcher);
|
|
||||||
|
|
||||||
notificationManager.notify(nType.ordinal(), mBuilder.build());
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
public void cancelNotify(OCSMSNotificationType nType) {
|
|
||||||
NotificationManager notificationManager = (NotificationManager)_ct.getSystemService(Context.NOTIFICATION_SERVICE);
|
|
||||||
notificationManager.cancel(nType.ordinal());
|
|
||||||
}
|
|
||||||
|
|
||||||
private Context _ct;
|
|
||||||
}
|
|
@ -12,55 +12,56 @@ package fr.unix_experience.owncloud_sms.notifications;
|
|||||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
* GNU Affero General Public License for more details.
|
* GNU Affero General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Affero General Public License
|
* You should have received a copy of the GNU Affero General Public License
|
||||||
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
* along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
import android.content.Context;
|
||||||
|
import fr.nrz.androidlib.notifications.NrzNotification;
|
||||||
import fr.unix_experience.owncloud_sms.R;
|
import fr.unix_experience.owncloud_sms.R;
|
||||||
import fr.unix_experience.owncloud_sms.enums.OCSMSNotificationType;
|
import fr.unix_experience.owncloud_sms.enums.OCSMSNotificationType;
|
||||||
import android.content.Context;
|
|
||||||
|
|
||||||
public class OCSMSNotificationManager {
|
public class OCSMSNotificationManager {
|
||||||
|
|
||||||
public OCSMSNotificationManager(Context context) {
|
public OCSMSNotificationManager(final Context context) {
|
||||||
_context = context;
|
_context = context;
|
||||||
_notification = new OCSMSNotification(_context);
|
_notification = new NrzNotification(_context, R.drawable.ic_launcher);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSyncProcessMsg() {
|
public void setSyncProcessMsg() {
|
||||||
createNotificationIfPossible(OCSMSNotificationType.SYNC,
|
createNotificationIfPossible(OCSMSNotificationType.SYNC,
|
||||||
_context.getString(R.string.sync_title),
|
_context.getString(R.string.sync_title),
|
||||||
_context.getString(R.string.sync_inprogress)
|
_context.getString(R.string.sync_inprogress)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropSyncProcessMsg() {
|
public void dropSyncProcessMsg() {
|
||||||
_notification.cancelNotify(OCSMSNotificationType.SYNC);
|
_notification.cancelNotify(OCSMSNotificationType.SYNC.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setSyncErrorMsg(String errMsg) {
|
public void setSyncErrorMsg(final String errMsg) {
|
||||||
createNotificationIfPossible(OCSMSNotificationType.SYNC_FAILED,
|
createNotificationIfPossible(OCSMSNotificationType.SYNC_FAILED,
|
||||||
_context.getString(R.string.sync_title),
|
_context.getString(R.string.sync_title),
|
||||||
_context.getString(R.string.fatal_error) + "\n" + errMsg
|
_context.getString(R.string.fatal_error) + "\n" + errMsg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void dropSyncErrorMsg() {
|
public void dropSyncErrorMsg() {
|
||||||
_notification.cancelNotify(OCSMSNotificationType.SYNC_FAILED);
|
_notification.cancelNotify(OCSMSNotificationType.SYNC_FAILED.ordinal());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDebugMsg(String errMsg) {
|
public void setDebugMsg(final String errMsg) {
|
||||||
createNotificationIfPossible(OCSMSNotificationType.DEBUG,
|
createNotificationIfPossible(OCSMSNotificationType.DEBUG,
|
||||||
"DEBUG", errMsg
|
"DEBUG", errMsg
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createNotificationIfPossible(OCSMSNotificationType nType, String nTitle, String nMsg) {
|
private void createNotificationIfPossible(final OCSMSNotificationType nType, final String nTitle, final String nMsg) {
|
||||||
_notification.createNotify(nType, nTitle, nMsg);
|
_notification.createNotify(nType.ordinal(), nTitle, nMsg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Context _context;
|
private final Context _context;
|
||||||
private OCSMSNotification _notification;
|
private final NrzNotification _notification;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user