1
- @file:Suppress(" DEPRECATION" , " OVERRIDE_DEPRECATION" )
2
-
3
1
/* *
4
2
* Copyright (C) 2021-2023 Fcitx 5 for Android Contributors
5
3
* SPDX-License-Identifier: LGPL-2.1-or-later
6
4
*/
5
+
6
+ @file:Suppress(" DEPRECATION" , " OVERRIDE_DEPRECATION" )
7
+
7
8
package org.fcitx.fcitx5.android.lib.plugin_base
8
9
9
10
import android.annotation.SuppressLint
@@ -21,21 +22,42 @@ import android.preference.PreferenceA
10000
ctivity
21
22
import android.preference.PreferenceCategory
22
23
import android.preference.PreferenceFragment
23
24
import android.preference.PreferenceScreen
25
+ import android.provider.Settings
26
+ import android.view.Menu
24
27
import android.widget.Toast
25
28
import com.mikepenz.aboutlibraries.Libs
26
29
import com.mikepenz.aboutlibraries.entity.License
27
30
import org.xmlpull.v1.XmlPullParser
28
31
29
- @SuppressLint(" ExportedPreferenceActivity" )
30
32
class AboutActivity : PreferenceActivity () {
31
33
34
+ // disallow loading any external fragment
35
+ override fun isValidFragment (fragmentName : String? ) = false
36
+
32
37
override fun onCreate (savedInstanceState : Bundle ? ) {
33
38
super .onCreate(savedInstanceState)
39
+ actionBar?.setDisplayHomeAsUpEnabled(true )
34
40
fragmentManager.beginTransaction()
35
41
.replace(android.R .id.content, AboutContentFragment ())
36
42
.commit()
37
43
}
38
44
45
+ override fun onCreateOptionsMenu (menu : Menu ): Boolean {
46
+ menu.add(R .string.app_info).setOnMenuItemClickListener {
47
+ startActivity(Intent (Settings .ACTION_APPLICATION_DETAILS_SETTINGS ).apply {
48
+ setData(Uri .fromParts(" package" , packageName, null ))
49
+ })
50
+ true
51
+ }
52
+ menu.add(R .string.uninstall).setOnMenuItemClickListener {
53
+ startActivity(Intent (Intent .ACTION_DELETE ).apply {
54
+ setData(Uri .fromParts(" package" , packageName, null ))
55
+ })
56
+ true
57
+ }
58
+ return super .onCreateOptionsMenu(menu)
59
+ }
60
+
39
61
class AboutContentFragment : PreferenceFragment () {
40
62
41
63
private val copyPreferenceSummaryListener = OnPreferenceClickListener {
0 commit comments