mirror of
https://github.com/etesync/android
synced 2025-01-11 00:01:12 +00:00
Add settings to control the change notifications
This commit is contained in:
parent
d9d4405c75
commit
47b04132a6
@ -93,7 +93,8 @@ public class App extends Application {
|
||||
OVERRIDE_PROXY = "overrideProxy",
|
||||
OVERRIDE_PROXY_HOST = "overrideProxyHost",
|
||||
OVERRIDE_PROXY_PORT = "overrideProxyPort",
|
||||
FORCE_LANGUAGE = "forceLanguage";
|
||||
FORCE_LANGUAGE = "forceLanguage",
|
||||
CHANGE_NOTIFICATION = "changeNotification";
|
||||
|
||||
public static final String OVERRIDE_PROXY_HOST_DEFAULT = "localhost";
|
||||
public static final int OVERRIDE_PROXY_PORT_DEFAULT = 8118;
|
||||
|
@ -14,6 +14,10 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
public class Settings {
|
||||
public enum ChangeNotification {
|
||||
ALL_CHANGES,
|
||||
NONE
|
||||
}
|
||||
|
||||
final SQLiteDatabase db;
|
||||
|
||||
@ -78,6 +82,11 @@ public class Settings {
|
||||
}
|
||||
}
|
||||
|
||||
public ChangeNotification getChangeNotification(String name) {
|
||||
int changeNotificationIndex = getInt(name, 0);
|
||||
return ChangeNotification.values()[changeNotificationIndex];
|
||||
}
|
||||
|
||||
public void putString(String name, @Nullable String value) {
|
||||
ContentValues values = new ContentValues(2);
|
||||
values.put(ServiceDB.Settings.NAME, name);
|
||||
|
@ -28,7 +28,9 @@ import com.etesync.syncadapter.model.CollectionInfo;
|
||||
import com.etesync.syncadapter.model.EntryEntity;
|
||||
import com.etesync.syncadapter.model.JournalEntity;
|
||||
import com.etesync.syncadapter.model.JournalModel;
|
||||
import com.etesync.syncadapter.model.ServiceDB;
|
||||
import com.etesync.syncadapter.model.ServiceEntity;
|
||||
import com.etesync.syncadapter.model.Settings;
|
||||
import com.etesync.syncadapter.model.SyncEntry;
|
||||
import com.etesync.syncadapter.resource.LocalCollection;
|
||||
import com.etesync.syncadapter.resource.LocalResource;
|
||||
@ -241,7 +243,11 @@ abstract public class SyncManager {
|
||||
}
|
||||
|
||||
private void notifyUserOnSync() {
|
||||
if (remoteEntries.isEmpty()) {
|
||||
Settings.ChangeNotification changeNotification =
|
||||
new Settings(new ServiceDB.OpenHelper(context).getReadableDatabase())
|
||||
.getChangeNotification(App.CHANGE_NOTIFICATION);
|
||||
if (remoteEntries.isEmpty() ||
|
||||
changeNotification.equals(Settings.ChangeNotification.NONE)) {
|
||||
return;
|
||||
}
|
||||
NotificationHelper notificationHelper = new NotificationHelper(context,
|
||||
|
@ -98,6 +98,11 @@
|
||||
<string name="app_settings_show_debug_info_details">View/share software and configuration details</string>
|
||||
<string name="app_settings_force_language">Force Language</string>
|
||||
<string name="app_settings_force_language_default">Auto</string>
|
||||
<string name="app_settings_change_notification">Show change notifications</string>
|
||||
<string-array name="app_settings_change_notification_values">
|
||||
<item>For all changes</item>
|
||||
<item>None</item>
|
||||
</string-array>
|
||||
|
||||
<!-- AccountActivity -->
|
||||
<string name="account_synchronize_now">Synchronize now</string>
|
||||
|
@ -11,6 +11,13 @@
|
||||
|
||||
<PreferenceCategory android:title="@string/app_settings_user_interface">
|
||||
|
||||
<ListPreference
|
||||
android:dialogTitle="@string/app_settings_change_notification"
|
||||
android:entryValues="@array/app_settings_change_notification_values"
|
||||
android:entries="@array/app_settings_change_notification_values"
|
||||
android:key="change_notification"
|
||||
android:title="@string/app_settings_change_notification"/>
|
||||
|
||||
<Preference
|
||||
android:key="reset_hints"
|
||||
android:title="@string/app_settings_reset_hints"
|
||||
|
Loading…
Reference in New Issue
Block a user