diff --git a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt index 9c071bd..d2ae9d6 100644 --- a/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt +++ b/app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt @@ -38,25 +38,20 @@ class SettingsFragment: PreferenceFragmentCompat() { }.collect() } - findPreference("pref_info_app_version") - ?.apply { - summary = requireContext().selfAppVersion + findPreference("pref_info_app_version")?.apply { + summary = requireContext().selfAppVersion - // Enable developer options when this is clicked for 7 times - setOnPreferenceClickListener(this@SettingsFragment::onAppVersionClicked) - } + // Enable developer options when this is clicked for 7 times + setOnPreferenceClickListener(::onAppVersionClicked) + } - findPreference("pref_info_source_code") - ?.setOnPreferenceClickListener { - startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.summary.toString()))) - true - } + findPreference("pref_info_source_code")?.apply { + intent = Intent(Intent.ACTION_VIEW, Uri.parse(summary.toString())) + } - findPreference("pref_advanced_logs") - ?.setOnPreferenceClickListener { - startActivity(Intent(requireContext(), LogsActivity::class.java)) - true - } + findPreference("pref_advanced_logs")?.apply { + intent = Intent(requireContext(), LogsActivity::class.java) + } findPreference("pref_notifications_download") ?.bindBooleanFlow(preferenceRepository.notificationDownloadFlow, PreferenceKeys.NOTIFICATION_DOWNLOAD)