From 93d571641428a986309fac47ea487d7d1851734e Mon Sep 17 00:00:00 2001 From: Fox2Code Date: Sun, 7 Jun 2020 09:43:49 +0200 Subject: [PATCH] Disable Volumes keys on flash - Thank Diareuse for helping me --- .../java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt | 5 +++++ .../java/com/topjohnwu/magisk/ui/base/BaseUIFragment.kt | 5 +++++ .../java/com/topjohnwu/magisk/ui/flash/FlashFragment.kt | 9 +++++++++ 3 files changed, 19 insertions(+) diff --git a/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt index 43ec39d27..ae357e48c 100644 --- a/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt +++ b/app/src/main/java/com/topjohnwu/magisk/ui/base/BaseUIActivity.kt @@ -2,6 +2,7 @@ package com.topjohnwu.magisk.ui.base import android.content.Intent import android.os.Bundle +import android.view.KeyEvent import android.view.View import android.view.ViewGroup import androidx.appcompat.app.AppCompatDelegate @@ -96,6 +97,10 @@ abstract class BaseUIActivity() super.onDestroyView() } + override fun onKeyEvent(event: KeyEvent): Boolean { + return when(event.keyCode) { + KeyEvent.KEYCODE_VOLUME_UP, + KeyEvent.KEYCODE_VOLUME_DOWN -> true + else -> false + } + } + override fun onBackPressed(): Boolean { if (viewModel.loading) return true return super.onBackPressed()