[skip ci] feat: theme crash fix
This commit is contained in:
parent
cd3bb20afd
commit
3d1040b280
15 changed files with 121 additions and 73 deletions
|
@ -306,23 +306,18 @@ fun Activity.reloadActivity() {
|
|||
initActivity(this)
|
||||
}
|
||||
|
||||
fun Context.restartApp(view: View) {
|
||||
fun Activity.restartApp() {
|
||||
val mainIntent = Intent.makeRestartActivityTask(
|
||||
packageManager.getLaunchIntentForPackage(this.packageName)!!.component
|
||||
)
|
||||
val component = ComponentName(this@restartApp.packageName, this@restartApp::class.qualifiedName!!)
|
||||
Snackbar.make(view, R.string.restart_app, Snackbar.LENGTH_INDEFINITE).apply {
|
||||
setAction(R.string.do_it) {
|
||||
this.dismiss()
|
||||
try {
|
||||
startActivity(Intent().setComponent(component))
|
||||
} catch (anything: Exception) {
|
||||
startActivity(mainIntent)
|
||||
}
|
||||
Runtime.getRuntime().exit(0)
|
||||
}
|
||||
show()
|
||||
try {
|
||||
startActivity(Intent().setComponent(component))
|
||||
} catch (e: Exception) {
|
||||
startActivity(mainIntent)
|
||||
}
|
||||
finishAndRemoveTask()
|
||||
PrefManager.setCustomVal("reload", true)
|
||||
}
|
||||
|
||||
open class BottomSheetDialogFragment : BottomSheetDialogFragment() {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue