Remove "useVolumeKeysFor*Navigation" methods from 'K9'
This commit is contained in:
parent
2eec933d3d
commit
7da8f13f92
4 changed files with 22 additions and 37 deletions
|
@ -216,8 +216,13 @@ object K9 : KoinComponent {
|
|||
private var messageViewReturnToList = false
|
||||
private var messageViewShowNext = false
|
||||
var isGesturesEnabled = true
|
||||
private var useVolumeKeysForNavigation = false
|
||||
private var useVolumeKeysForListNavigation = false
|
||||
|
||||
@JvmStatic
|
||||
var isUseVolumeKeysForNavigation = false
|
||||
|
||||
@JvmStatic
|
||||
var isUseVolumeKeysForListNavigation = false
|
||||
|
||||
private var startIntegratedInbox = false
|
||||
private var measureAccounts = true
|
||||
private var countSearchMessages = true
|
||||
|
@ -301,24 +306,6 @@ object K9 : KoinComponent {
|
|||
updateLoggingStatus()
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun useVolumeKeysForNavigationEnabled(): Boolean {
|
||||
return useVolumeKeysForNavigation
|
||||
}
|
||||
|
||||
fun setUseVolumeKeysForNavigation(volume: Boolean) {
|
||||
useVolumeKeysForNavigation = volume
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun useVolumeKeysForListNavigationEnabled(): Boolean {
|
||||
return useVolumeKeysForListNavigation
|
||||
}
|
||||
|
||||
fun setUseVolumeKeysForListNavigation(enabled: Boolean) {
|
||||
useVolumeKeysForListNavigation = enabled
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun autofitWidth(): Boolean {
|
||||
return autofitWidth
|
||||
|
@ -599,8 +586,8 @@ object K9 : KoinComponent {
|
|||
DEBUG_SENSITIVE = storage.getBoolean("enableSensitiveLogging", false)
|
||||
animations = storage.getBoolean("animations", true)
|
||||
isGesturesEnabled = storage.getBoolean("gesturesEnabled", false)
|
||||
useVolumeKeysForNavigation = storage.getBoolean("useVolumeKeysForNavigation", false)
|
||||
useVolumeKeysForListNavigation = storage.getBoolean("useVolumeKeysForListNavigation", false)
|
||||
isUseVolumeKeysForNavigation = storage.getBoolean("useVolumeKeysForNavigation", false)
|
||||
isUseVolumeKeysForListNavigation = storage.getBoolean("useVolumeKeysForListNavigation", false)
|
||||
startIntegratedInbox = storage.getBoolean("startIntegratedInbox", false)
|
||||
measureAccounts = storage.getBoolean("measureAccounts", true)
|
||||
countSearchMessages = storage.getBoolean("countSearchMessages", true)
|
||||
|
@ -721,8 +708,8 @@ object K9 : KoinComponent {
|
|||
editor.putString("backgroundOperations", K9.backgroundOps.name)
|
||||
editor.putBoolean("animations", animations)
|
||||
editor.putBoolean("gesturesEnabled", isGesturesEnabled)
|
||||
editor.putBoolean("useVolumeKeysForNavigation", useVolumeKeysForNavigation)
|
||||
editor.putBoolean("useVolumeKeysForListNavigation", useVolumeKeysForListNavigation)
|
||||
editor.putBoolean("useVolumeKeysForNavigation", isUseVolumeKeysForNavigation)
|
||||
editor.putBoolean("useVolumeKeysForListNavigation", isUseVolumeKeysForListNavigation)
|
||||
editor.putBoolean("autofitWidth", autofitWidth)
|
||||
editor.putBoolean("quietTimeEnabled", quietTimeEnabled)
|
||||
editor.putBoolean("notificationDuringQuietTimeEnabled", isNotificationDuringQuietTimeEnabled)
|
||||
|
|
|
@ -44,7 +44,7 @@ public abstract class K9ListActivity extends K9Activity implements K9ActivityMag
|
|||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
// Shortcuts that work no matter what is selected
|
||||
if (K9.useVolumeKeysForListNavigationEnabled() &&
|
||||
if (K9.isUseVolumeKeysForListNavigation() &&
|
||||
(keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
|
||||
|
||||
|
@ -71,7 +71,7 @@ public abstract class K9ListActivity extends K9Activity implements K9ActivityMag
|
|||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
// Swallow these events too to avoid the audible notification of a volume change
|
||||
if (K9.useVolumeKeysForListNavigationEnabled() &&
|
||||
if (K9.isUseVolumeKeysForListNavigation() &&
|
||||
(keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
|
||||
keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
|
||||
return true;
|
||||
|
|
|
@ -679,11 +679,10 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
switch (keyCode) {
|
||||
case KeyEvent.KEYCODE_VOLUME_UP: {
|
||||
if (messageViewFragment != null && displayMode != DisplayMode.MESSAGE_LIST &&
|
||||
K9.useVolumeKeysForNavigationEnabled()) {
|
||||
K9.isUseVolumeKeysForNavigation()) {
|
||||
showPreviousMessage();
|
||||
return true;
|
||||
} else if (displayMode != DisplayMode.MESSAGE_VIEW &&
|
||||
K9.useVolumeKeysForListNavigationEnabled()) {
|
||||
} else if (displayMode != DisplayMode.MESSAGE_VIEW && K9.isUseVolumeKeysForListNavigation()) {
|
||||
messageListFragment.onMoveUp();
|
||||
return true;
|
||||
}
|
||||
|
@ -692,11 +691,10 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
}
|
||||
case KeyEvent.KEYCODE_VOLUME_DOWN: {
|
||||
if (messageViewFragment != null && displayMode != DisplayMode.MESSAGE_LIST &&
|
||||
K9.useVolumeKeysForNavigationEnabled()) {
|
||||
K9.isUseVolumeKeysForNavigation()) {
|
||||
showNextMessage();
|
||||
return true;
|
||||
} else if (displayMode != DisplayMode.MESSAGE_VIEW &&
|
||||
K9.useVolumeKeysForListNavigationEnabled()) {
|
||||
} else if (displayMode != DisplayMode.MESSAGE_VIEW && K9.isUseVolumeKeysForListNavigation()) {
|
||||
messageListFragment.onMoveDown();
|
||||
return true;
|
||||
}
|
||||
|
@ -842,7 +840,7 @@ public class MessageList extends K9Activity implements MessageListFragmentListen
|
|||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
// Swallow these events too to avoid the audible notification of a volume change
|
||||
if (K9.useVolumeKeysForListNavigationEnabled()) {
|
||||
if (K9.isUseVolumeKeysForListNavigation()) {
|
||||
if ((keyCode == KeyEvent.KEYCODE_VOLUME_UP) || (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
|
||||
Timber.v("Swallowed key up.");
|
||||
return true;
|
||||
|
|
|
@ -170,8 +170,8 @@ class GeneralSettingsDataStore(
|
|||
}
|
||||
"volume_navigation" -> {
|
||||
mutableSetOf<String>().apply {
|
||||
if (K9.useVolumeKeysForNavigationEnabled()) add("message")
|
||||
if (K9.useVolumeKeysForListNavigationEnabled()) add("list")
|
||||
if (K9.isUseVolumeKeysForNavigation) add("message")
|
||||
if (K9.isUseVolumeKeysForListNavigation) add("list")
|
||||
}
|
||||
}
|
||||
else -> defValues
|
||||
|
@ -197,8 +197,8 @@ class GeneralSettingsDataStore(
|
|||
K9.isMessageViewSpamActionVisible = "spam" in checkedValues
|
||||
}
|
||||
"volume_navigation" -> {
|
||||
K9.setUseVolumeKeysForNavigation("message" in checkedValues)
|
||||
K9.setUseVolumeKeysForListNavigation("list" in checkedValues)
|
||||
K9.isUseVolumeKeysForNavigation = "message" in checkedValues
|
||||
K9.isUseVolumeKeysForListNavigation = "list" in checkedValues
|
||||
}
|
||||
else -> return
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue