mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-06-05 21:59:15 +02:00
allow uninstalling apps
This commit is contained in:
@ -8,6 +8,8 @@
|
|||||||
android:name="android.permission.QUERY_ALL_PACKAGES"
|
android:name="android.permission.QUERY_ALL_PACKAGES"
|
||||||
tools:ignore="QueryAllPackagesPermission" />
|
tools:ignore="QueryAllPackagesPermission" />
|
||||||
|
|
||||||
|
<uses-permission android:name="android.permission.REQUEST_DELETE_PACKAGES" />
|
||||||
|
|
||||||
<uses-permission
|
<uses-permission
|
||||||
android:name="android.permission.USE_FINGERPRINT"
|
android:name="android.permission.USE_FINGERPRINT"
|
||||||
tools:node="remove" />
|
tools:node="remove" />
|
||||||
|
@ -28,15 +28,21 @@ fun Activity.launchAppInfo(packageName: String) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Activity.uninstallApp(packageName: String) {
|
||||||
|
Intent(Intent.ACTION_DELETE).apply {
|
||||||
|
data = Uri.fromParts("package", packageName, null)
|
||||||
|
startActivity(this)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun Activity.handleAppIconPopupMenu(anchorView: View, appPackageName: String) {
|
fun Activity.handleAppIconPopupMenu(anchorView: View, appPackageName: String) {
|
||||||
val contextTheme = ContextThemeWrapper(this, getPopupMenuTheme())
|
val contextTheme = ContextThemeWrapper(this, getPopupMenuTheme())
|
||||||
PopupMenu(contextTheme, anchorView, Gravity.TOP or Gravity.END).apply {
|
PopupMenu(contextTheme, anchorView, Gravity.TOP or Gravity.END).apply {
|
||||||
inflate(R.menu.menu_app_icon)
|
inflate(R.menu.menu_app_icon)
|
||||||
setOnMenuItemClickListener { item ->
|
setOnMenuItemClickListener { item ->
|
||||||
when (item.itemId) {
|
when (item.itemId) {
|
||||||
R.id.app_info -> {
|
R.id.app_info -> launchAppInfo(appPackageName)
|
||||||
launchAppInfo(appPackageName)
|
R.id.uninstall -> uninstallApp(appPackageName)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
true
|
true
|
||||||
}
|
}
|
||||||
|
@ -6,4 +6,9 @@
|
|||||||
android:icon="@drawable/ic_info_vector"
|
android:icon="@drawable/ic_info_vector"
|
||||||
android:title="@string/app_info"
|
android:title="@string/app_info"
|
||||||
app:showAsAction="always" />
|
app:showAsAction="always" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/uninstall"
|
||||||
|
android:icon="@drawable/ic_delete_vector"
|
||||||
|
android:title="@string/uninstall"
|
||||||
|
app:showAsAction="always" />
|
||||||
</menu>
|
</menu>
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
<string name="app_launcher_name">Launcher</string>
|
<string name="app_launcher_name">Launcher</string>
|
||||||
<string name="app_info">App info</string>
|
<string name="app_info">App info</string>
|
||||||
<string name="touch_hold_widget">Long press the widget and drag it on your home screen</string>
|
<string name="touch_hold_widget">Long press the widget and drag it on your home screen</string>
|
||||||
|
<string name="uninstall">Uninstall</string>
|
||||||
<!--
|
<!--
|
||||||
Haven't found some strings? There's more at
|
Haven't found some strings? There's more at
|
||||||
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
https://github.com/SimpleMobileTools/Simple-Commons/tree/master/commons/src/main/res
|
||||||
|
Reference in New Issue
Block a user