Browse Source

chore: simplify source code intent (#97)

Co-authored-by: Peter Cai <peter@typeblog.net>
Reviewed-on: https://gitea.angry.im/PeterCxy/OpenEUICC/pulls/97
Co-authored-by: septs <github@septs.pw>
Co-committed-by: septs <github@septs.pw>
septs 1 year ago
parent
commit
dc0489a693

+ 0 - 4
app-common/src/main/java/im/angry/openeuicc/ui/SettingsFragment.kt

@@ -47,10 +47,6 @@ class SettingsFragment: PreferenceFragmentCompat() {
             setOnPreferenceClickListener(::onAppVersionClicked)
         }
 
-        findPreference<Preference>("pref_info_source_code")?.apply {
-            intent = Intent(Intent.ACTION_VIEW, Uri.parse(summary.toString()))
-        }
-
         findPreference<Preference>("pref_language")?.apply {
             if (Build.VERSION.SDK_INT < Build.VERSION_CODES.TIRAMISU) return@apply
             isVisible = true

+ 7 - 2
app-common/src/main/res/xml/pref_settings.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
-<PreferenceScreen xmlns:app="http://schemas.android.com/apk/res-auto">
+<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto">
     <im.angry.openeuicc.ui.preference.LongSummaryPreferenceCategory
         app:title="@string/pref_notifications"
         app:summary="@string/pref_notifications_desc"
@@ -88,6 +89,10 @@
             app:iconSpaceReserved="false"
             app:title="@string/pref_info_source_code"
             app:summary="@string/pref_info_source_code_url"
-            app:key="pref_info_source_code"/>
+            app:key="pref_info_source_code">
+            <intent
+                android:action="android.intent.action.VIEW"
+                android:data="@string/pref_info_source_code_url" />
+        </Preference>
     </PreferenceCategory>
 </PreferenceScreen>