mirror of
https://github.com/SimpleMobileTools/Simple-Launcher.git
synced 2025-06-05 21:59:15 +02:00
hide the menu at long pressing an item and moving gesture
This commit is contained in:
@ -4,13 +4,7 @@ import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
import android.view.ContextThemeWrapper
|
||||
import android.view.Gravity
|
||||
import android.view.View
|
||||
import android.widget.PopupMenu
|
||||
import com.simplemobiletools.commons.extensions.getPopupMenuTheme
|
||||
import com.simplemobiletools.commons.extensions.showErrorToast
|
||||
import com.simplemobiletools.launcher.R
|
||||
import com.simplemobiletools.launcher.helpers.UNINSTALL_APP_REQUEST_CODE
|
||||
|
||||
fun Activity.launchApp(packageName: String) {
|
||||
@ -35,18 +29,3 @@ fun Activity.uninstallApp(packageName: String) {
|
||||
startActivityForResult(this, UNINSTALL_APP_REQUEST_CODE)
|
||||
}
|
||||
}
|
||||
|
||||
fun Activity.handleGridItemPopupMenu(anchorView: View, appPackageName: String): PopupMenu {
|
||||
val contextTheme = ContextThemeWrapper(this, getPopupMenuTheme())
|
||||
return PopupMenu(contextTheme, anchorView, Gravity.TOP or Gravity.END).apply {
|
||||
inflate(R.menu.menu_app_icon)
|
||||
setOnMenuItemClickListener { item ->
|
||||
when (item.itemId) {
|
||||
R.id.app_info -> launchAppInfo(appPackageName)
|
||||
R.id.uninstall -> uninstallApp(appPackageName)
|
||||
}
|
||||
true
|
||||
}
|
||||
show()
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user