diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 0340489..c66fd61 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -87,7 +87,7 @@ diff --git a/app/src/main/java/io/github/dovecoteescapee/byedpi/fragments/MainSettingsFragment.kt b/app/src/main/java/io/github/dovecoteescapee/byedpi/fragments/MainSettingsFragment.kt index 00df64e..e9b4563 100644 --- a/app/src/main/java/io/github/dovecoteescapee/byedpi/fragments/MainSettingsFragment.kt +++ b/app/src/main/java/io/github/dovecoteescapee/byedpi/fragments/MainSettingsFragment.kt @@ -52,9 +52,9 @@ class MainSettingsFragment : PreferenceFragmentCompat() { true } - val switchCommandLineSettings = findPreferenceNotNull( - "byedpi_enable_cmd_settings" - ) + val accessibilityStatusPref = findPreferenceNotNull("accessibility_service_status") + val switchCommandLineSettings = findPreferenceNotNull("byedpi_enable_cmd_settings") + val uiSettings = findPreferenceNotNull("byedpi_ui_settings") val cmdSettings = findPreferenceNotNull("byedpi_cmd_settings") @@ -70,23 +70,13 @@ class MainSettingsFragment : PreferenceFragmentCompat() { true } - findPreferenceNotNull("version").summary = BuildConfig.VERSION_NAME - - val accessibilityStatusPref = findPreference("accessibility_service_status") - accessibilityStatusPref?.setOnPreferenceClickListener { + accessibilityStatusPref.setOnPreferenceClickListener { val intent = Intent(Settings.ACTION_ACCESSIBILITY_SETTINGS) startActivity(intent) true } - val selectedApps = findPreference("selected_apps") - selectedApps?.setOnPreferenceClickListener { - parentFragmentManager.beginTransaction() - .replace(R.id.settings, AppSelectionFragment()) - .addToBackStack(null) - .commit() - true - } + findPreferenceNotNull("version").summary = BuildConfig.VERSION_NAME updateAccessibilityStatus(accessibilityStatusPref) updatePreferences() @@ -95,9 +85,7 @@ class MainSettingsFragment : PreferenceFragmentCompat() { override fun onResume() { super.onResume() sharedPreferences?.registerOnSharedPreferenceChangeListener(preferenceListener) - - val accessibilityStatusPref = findPreference("accessibility_service_status") - updateAccessibilityStatus(accessibilityStatusPref) + updatePreferences() } override fun onPause() { @@ -113,6 +101,9 @@ class MainSettingsFragment : PreferenceFragmentCompat() { val applist_type = findPreferenceNotNull("applist_type") val selected_apps = findPreferenceNotNull("selected_apps") + val accessibilityStatusPref = findPreferenceNotNull("accessibility_service_status") + + updateAccessibilityStatus(accessibilityStatusPref) when (mode) { Mode.VPN -> {