Drop quick exit feature
Broken now due to multiple navigation destinations unlike before when there were only 3 fragments were the only choices. Quick exit is supposed to be now the default behaviour in the coming commits Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -32,8 +32,6 @@ import android.view.MenuItem
|
||||
import android.view.View
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import android.widget.Toast
|
||||
import androidx.activity.addCallback
|
||||
import androidx.activity.result.contract.ActivityResultContracts
|
||||
import androidx.annotation.IdRes
|
||||
import androidx.core.content.ContextCompat
|
||||
@@ -136,27 +134,6 @@ class MainActivity : BaseActivity() {
|
||||
/* Check self update only for stable release, skip debug & nightlies*/
|
||||
if (BuildConfig.APPLICATION_ID == Constants.APP_ID) checkSelfUpdate()
|
||||
|
||||
onBackPressedDispatcher.addCallback(this) {
|
||||
if (!B.drawerLayout.isDrawerOpen(GravityCompat.START)) {
|
||||
if (Preferences.getBoolean(this@MainActivity, Preferences.PREFERENCE_QUICK_EXIT)) {
|
||||
finish()
|
||||
} else {
|
||||
if (lastBackPressed + 1000 > System.currentTimeMillis()) {
|
||||
finish()
|
||||
} else {
|
||||
lastBackPressed = System.currentTimeMillis()
|
||||
Toast.makeText(
|
||||
this@MainActivity,
|
||||
getString(R.string.toast_double_press_to_exit),
|
||||
Toast.LENGTH_SHORT
|
||||
).show()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
B.drawerLayout.close()
|
||||
}
|
||||
}
|
||||
|
||||
// Handle intents
|
||||
when (intent?.action) {
|
||||
Constants.NAVIGATION_UPDATES -> B.navView.selectedItemId = R.id.navigation_updates
|
||||
|
||||
@@ -35,7 +35,6 @@ object Preferences {
|
||||
const val PREFERENCE_THEME_TYPE = "PREFERENCE_THEME_TYPE"
|
||||
const val PREFERENCE_THEME_ACCENT = "PREFERENCE_THEME_ACCENT"
|
||||
const val PREFERENCE_DEFAULT_SELECTED_TAB = "PREFERENCE_DEFAULT_SELECTED_TAB"
|
||||
const val PREFERENCE_QUICK_EXIT = "PREFERENCE_QUICK_EXIT"
|
||||
const val PREFERENCE_FOR_YOU = "PREFERENCE_FOR_YOU"
|
||||
const val PREFERENCE_SIMILAR = "PREFERENCE_SIMILAR"
|
||||
const val PREFERENCE_INTRO = "PREFERENCE_INTRO"
|
||||
|
||||
@@ -45,7 +45,6 @@ import com.aurora.store.util.Preferences.PREFERENCE_FOR_YOU
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSECURE_ANONYMOUS
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INSTALLER_ID
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_INTRO
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_QUICK_EXIT
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_SIMILAR
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_ACCENT
|
||||
import com.aurora.store.util.Preferences.PREFERENCE_THEME_TYPE
|
||||
@@ -184,7 +183,6 @@ class OnboardingActivity : BaseActivity() {
|
||||
save(PREFERENCE_THEME_TYPE, 0)
|
||||
save(PREFERENCE_THEME_ACCENT, if (isSAndAbove()) 0 else 1)
|
||||
save(PREFERENCE_DEFAULT_SELECTED_TAB, 0)
|
||||
save(PREFERENCE_QUICK_EXIT, false)
|
||||
save(PREFERENCE_FOR_YOU, true)
|
||||
save(PREFERENCE_SIMILAR, true)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user