chore: simplify settings intent #77

Merged
PeterCxy merged 2 commits from septs/OpenEUICC:settings-intent into master 2024-12-01 14:57:39 +01:00

View file

@ -38,25 +38,20 @@ class SettingsFragment: PreferenceFragmentCompat() {
}.collect() }.collect()
} }
findPreference<Preference>("pref_info_app_version") findPreference<Preference>("pref_info_app_version")?.apply {
?.apply { summary = requireContext().selfAppVersion
summary = requireContext().selfAppVersion
// Enable developer options when this is clicked for 7 times // Enable developer options when this is clicked for 7 times
setOnPreferenceClickListener(this@SettingsFragment::onAppVersionClicked) setOnPreferenceClickListener(::onAppVersionClicked)
} }
findPreference<Preference>("pref_info_source_code") findPreference<Preference>("pref_info_source_code")?.apply {
?.setOnPreferenceClickListener { intent = Intent(Intent.ACTION_VIEW, Uri.parse(summary.toString()))
startActivity(Intent(Intent.ACTION_VIEW, Uri.parse(it.summary.toString()))) }
true
}
findPreference<Preference>("pref_advanced_logs") findPreference<Preference>("pref_advanced_logs")?.apply {
?.setOnPreferenceClickListener { intent = Intent(requireContext(), LogsActivity::class.java)
startActivity(Intent(requireContext(), LogsActivity::class.java)) }
true
}
findPreference<CheckBoxPreference>("pref_notifications_download") findPreference<CheckBoxPreference>("pref_notifications_download")
?.bindBooleanFlow(preferenceRepository.notificationDownloadFlow, PreferenceKeys.NOTIFICATION_DOWNLOAD) ?.bindBooleanFlow(preferenceRepository.notificationDownloadFlow, PreferenceKeys.NOTIFICATION_DOWNLOAD)