1
0
mirror of https://github.com/etesync/android synced 2024-12-22 22:58:29 +00:00

Add a setting to choose if we prefer Tasks.org or OpenTasks.

This commit is contained in:
Tom Hacohen 2020-08-06 15:37:57 +03:00
parent e01f54c687
commit 5fca068845
4 changed files with 26 additions and 0 deletions

View File

@ -277,6 +277,7 @@ class App : Application() {
val OVERRIDE_PROXY = "overrideProxy"
val OVERRIDE_PROXY_HOST = "overrideProxyHost"
val OVERRIDE_PROXY_PORT = "overrideProxyPort"
val PREFER_TASKSORG = "preferTasksOrg"
val FORCE_LANGUAGE = "forceLanguage"
val CHANGE_NOTIFICATION = "show_change_notification"

View File

@ -43,6 +43,8 @@ class AppSettingsActivity : BaseActivity() {
internal lateinit var dbHelper: ServiceDB.OpenHelper
internal lateinit var settings: Settings
internal lateinit var prefPreferTasksOrg: SwitchPreferenceCompat
internal lateinit var prefResetHints: Preference
internal lateinit var prefOverrideProxy: SwitchPreferenceCompat
internal lateinit var prefDistrustSystemCerts: SwitchPreferenceCompat
@ -86,6 +88,14 @@ class AppSettingsActivity : BaseActivity() {
true
}
prefPreferTasksOrg = findPreference("prefer_tasksorg") as SwitchPreferenceCompat
prefPreferTasksOrg.isChecked = context!!.defaultSharedPreferences.getBoolean(App.PREFER_TASKSORG, false)
prefPreferTasksOrg.onPreferenceChangeListener = Preference.OnPreferenceChangeListener { _, newValue ->
context!!.defaultSharedPreferences.edit().putBoolean(App.PREFER_TASKSORG, newValue as Boolean).apply()
Snackbar.make(view!!, getString(R.string.app_settings_prefer_tasksorg_snack), Snackbar.LENGTH_LONG).show()
true
}
prefProxyHost = findPreference("proxy_host") as EditTextPreference
val proxyHost = settings.getString(App.OVERRIDE_PROXY_HOST, App.OVERRIDE_PROXY_HOST_DEFAULT)
prefProxyHost.text = proxyHost

View File

@ -93,6 +93,11 @@
<string name="app_settings_reset_hints">Reset hints</string>
<string name="app_settings_reset_hints_summary">Re-enables hints which have been dismissed previously</string>
<string name="app_settings_reset_hints_success">All hints will be shown again</string>
<string name="app_settings_sync">Sync</string>
<string name="app_settings_prefer_tasksorg">Prefer Tasks.org tasks provider</string>
<string name="app_settings_prefer_tasksorg_on">Will sync tasks with Tasks.org if available</string>
<string name="app_settings_prefer_tasksorg_off">Will sync tasks with OpenTasks if available</string>
<string name="app_settings_prefer_tasksorg_snack">You may need to remove and re-add your account for these changes to take effect.</string>
<string name="app_settings_connection">Connection</string>
<string name="app_settings_override_proxy">Override proxy settings</string>
<string name="app_settings_override_proxy_on">Use custom proxy settings</string>

View File

@ -26,6 +26,16 @@
</PreferenceCategory>
<PreferenceCategory android:title="@string/app_settings_sync">
<SwitchPreferenceCompat
android:key="prefer_tasksorg"
android:title="@string/app_settings_prefer_tasksorg"
android:summaryOn="@string/app_settings_prefer_tasksorg_on"
android:summaryOff="@string/app_settings_prefer_tasksorg_off"/>
</PreferenceCategory>
<PreferenceCategory android:title="@string/app_settings_connection">
<SwitchPreferenceCompat