Fixed uninstall popup causing a return to home

This commit is contained in:
ottoptj 2024-08-31 00:40:13 +03:00
commit 478524c49d
2 changed files with 7 additions and 2 deletions

View file

@ -105,6 +105,7 @@ class AppActionMenu(private val activity: MainActivity, private val binding: Act
intent.data = Uri.parse("package:${appInfo.packageName}") intent.data = Uri.parse("package:${appInfo.packageName}")
intent.putExtra(Intent.EXTRA_USER, userHandle) intent.putExtra(Intent.EXTRA_USER, userHandle)
activity.startActivity(intent) activity.startActivity(intent)
activity.returnAllowed = false
} }
private fun renameApp(textView: TextView, editLayout: LinearLayout, actionMenu: View, appActivity: LauncherActivityInfo?, appInfo: ApplicationInfo, userHandle: UserHandle, workProfile: Int) { private fun renameApp(textView: TextView, editLayout: LinearLayout, actionMenu: View, appActivity: LauncherActivityInfo?, appInfo: ApplicationInfo, userHandle: UserHandle, workProfile: Int) {

View file

@ -100,6 +100,8 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
private lateinit var gestureDetector: GestureDetector private lateinit var gestureDetector: GestureDetector
private lateinit var shortcutGestureDetector: GestureDetector private lateinit var shortcutGestureDetector: GestureDetector
var returnAllowed = true
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState) super.onCreate(savedInstanceState)
binding = ActivityMainBinding.inflate(layoutInflater) binding = ActivityMainBinding.inflate(layoutInflater)
@ -721,13 +723,15 @@ class MainActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferenceCh
super.onStart() super.onStart()
// Keyboard is sometimes open when going back to the app, so close it. // Keyboard is sometimes open when going back to the app, so close it.
closeKeyboard() closeKeyboard()
} }
@SuppressLint("NotifyDataSetChanged") @SuppressLint("NotifyDataSetChanged")
override fun onResume() { override fun onResume() {
super.onResume() super.onResume()
backToHome(0) if (returnAllowed) {
backToHome(0)
}
returnAllowed = true
adapter?.notifyDataSetChanged() adapter?.notifyDataSetChanged()
} }