Convert newpipe/ExitActivity to kotlin
This commit is contained in:
parent
48467669b6
commit
6cf932b2a7
2 changed files with 38 additions and 50 deletions
38
app/src/main/java/org/schabi/newpipe/ExitActivity.kt
Normal file
38
app/src/main/java/org/schabi/newpipe/ExitActivity.kt
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2016-2026 NewPipe contributors <https://newpipe.net>
|
||||
* SPDX-License-Identifier: GPL-3.0-or-later
|
||||
*/
|
||||
|
||||
package org.schabi.newpipe
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.app.Activity
|
||||
import android.content.Intent
|
||||
import android.os.Bundle
|
||||
import org.schabi.newpipe.util.NavigationHelper
|
||||
class ExitActivity : Activity() {
|
||||
@SuppressLint("NewApi")
|
||||
override fun onCreate(savedInstanceState: Bundle?) {
|
||||
super.onCreate(savedInstanceState)
|
||||
|
||||
finishAndRemoveTask()
|
||||
|
||||
NavigationHelper.restartApp(this)
|
||||
}
|
||||
|
||||
companion object {
|
||||
@JvmStatic
|
||||
fun exitAndRemoveFromRecentApps(activity: Activity) {
|
||||
val intent = Intent(activity, ExitActivity::class.java)
|
||||
|
||||
intent.addFlags(
|
||||
Intent.FLAG_ACTIVITY_NEW_TASK
|
||||
or Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
|
||||
or Intent.FLAG_ACTIVITY_CLEAR_TASK
|
||||
or Intent.FLAG_ACTIVITY_NO_ANIMATION
|
||||
)
|
||||
|
||||
activity.startActivity(intent)
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue