mirror of
https://github.com/etesync/android
synced 2024-12-23 15:18:14 +00:00
Fix the setting controlling change notifications.
This commit is contained in:
parent
a91de2c79e
commit
98ca5fa318
@ -369,7 +369,7 @@ class App : Application() {
|
||||
val OVERRIDE_PROXY_HOST = "overrideProxyHost"
|
||||
val OVERRIDE_PROXY_PORT = "overrideProxyPort"
|
||||
val FORCE_LANGUAGE = "forceLanguage"
|
||||
val CHANGE_NOTIFICATION = "changeNotification"
|
||||
val CHANGE_NOTIFICATION = "show_change_notification"
|
||||
|
||||
val OVERRIDE_PROXY_HOST_DEFAULT = "localhost"
|
||||
val OVERRIDE_PROXY_PORT_DEFAULT = 8118
|
||||
|
@ -14,11 +14,6 @@ import android.database.sqlite.SQLiteDatabase;
|
||||
import android.support.annotation.Nullable;
|
||||
|
||||
public class Settings {
|
||||
public enum ChangeNotification {
|
||||
ALL_CHANGES,
|
||||
NONE
|
||||
}
|
||||
|
||||
final SQLiteDatabase db;
|
||||
|
||||
public Settings(SQLiteDatabase db) {
|
||||
@ -82,11 +77,6 @@ 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);
|
||||
|
@ -31,6 +31,7 @@ import com.etesync.syncadapter.ui.ViewCollectionActivity
|
||||
import io.requery.Persistable
|
||||
import io.requery.sql.EntityDataStore
|
||||
import okhttp3.OkHttpClient
|
||||
import org.jetbrains.anko.defaultSharedPreferences
|
||||
import java.io.FileNotFoundException
|
||||
import java.io.IOException
|
||||
import java.util.*
|
||||
@ -227,9 +228,8 @@ constructor(protected val context: Context, protected val account: Account, prot
|
||||
}
|
||||
|
||||
private fun notifyUserOnSync() {
|
||||
val changeNotification = Settings(ServiceDB.OpenHelper(context).readableDatabase)
|
||||
.getChangeNotification(App.CHANGE_NOTIFICATION)
|
||||
if (remoteEntries!!.isEmpty() || changeNotification == Settings.ChangeNotification.NONE) {
|
||||
val changeNotification = context.defaultSharedPreferences.getBoolean(App.CHANGE_NOTIFICATION, true)
|
||||
if (remoteEntries!!.isEmpty() || !changeNotification) {
|
||||
return
|
||||
}
|
||||
val notificationHelper = NotificationHelper(context,
|
||||
|
@ -19,6 +19,7 @@ import com.etesync.syncadapter.model.ServiceDB
|
||||
import com.etesync.syncadapter.model.Settings
|
||||
import com.etesync.syncadapter.utils.HintManager
|
||||
import com.etesync.syncadapter.utils.LanguageUtils
|
||||
import org.jetbrains.anko.defaultSharedPreferences
|
||||
import java.net.URI
|
||||
import java.net.URISyntaxException
|
||||
|
||||
@ -116,6 +117,9 @@ class AppSettingsActivity : BaseActivity() {
|
||||
prefLogToExternalStorage = findPreference("log_to_external_storage") as SwitchPreferenceCompat
|
||||
prefLogToExternalStorage.isChecked = settings.getBoolean(App.LOG_TO_EXTERNAL_STORAGE, false)
|
||||
|
||||
val prefChangeNotification = findPreference("show_change_notification") as SwitchPreferenceCompat
|
||||
prefChangeNotification.isChecked = context!!.defaultSharedPreferences.getBoolean(App.CHANGE_NOTIFICATION, true)
|
||||
|
||||
initSelectLanguageList()
|
||||
}
|
||||
|
||||
|
@ -99,10 +99,6 @@
|
||||
<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,11 +11,8 @@
|
||||
|
||||
<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"
|
||||
<SwitchPreferenceCompat
|
||||
android:key="show_change_notification"
|
||||
android:title="@string/app_settings_change_notification"/>
|
||||
|
||||
<Preference
|
||||
|
Loading…
Reference in New Issue
Block a user