Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit c30ba40d authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #6309 from thundernest/remove_message_list_volume_key_navigation

Remove volume key navigation for list views
parents 09a1bed2 b3c8e859
Loading
Loading
Loading
Loading
+0 −5
Original line number Diff line number Diff line
@@ -188,9 +188,6 @@ object K9 : EarlyInit {
    @JvmStatic
    var isUseVolumeKeysForNavigation = false

    @JvmStatic
    var isUseVolumeKeysForListNavigation = false

    @JvmStatic
    var isShowUnifiedInbox = true

@@ -298,7 +295,6 @@ object K9 : EarlyInit {
        isSensitiveDebugLoggingEnabled = storage.getBoolean("enableSensitiveLogging", false)
        isShowAnimations = storage.getBoolean("animations", true)
        isUseVolumeKeysForNavigation = storage.getBoolean("useVolumeKeysForNavigation", false)
        isUseVolumeKeysForListNavigation = storage.getBoolean("useVolumeKeysForListNavigation", false)
        isShowUnifiedInbox = storage.getBoolean("showUnifiedInbox", true)
        isShowStarredCount = storage.getBoolean("showStarredCount", false)
        isMessageListSenderAboveSubject = storage.getBoolean("messageListSenderAboveSubject", false)
@@ -370,7 +366,6 @@ object K9 : EarlyInit {
        editor.putEnum("backgroundOperations", backgroundOps)
        editor.putBoolean("animations", isShowAnimations)
        editor.putBoolean("useVolumeKeysForNavigation", isUseVolumeKeysForNavigation)
        editor.putBoolean("useVolumeKeysForListNavigation", isUseVolumeKeysForListNavigation)
        editor.putBoolean("autofitWidth", isAutoFitWidth)
        editor.putBoolean("quietTimeEnabled", isQuietTimeEnabled)
        editor.putBoolean("notificationDuringQuietTimeEnabled", isNotificationDuringQuietTimeEnabled)
+0 −3
Original line number Diff line number Diff line
@@ -184,9 +184,6 @@ public class GeneralSettingsDescriptions {
                new V(16, new LegacyThemeSetting(AppTheme.LIGHT)),
                new V(24, new SubThemeSetting(SubTheme.USE_GLOBAL))
        ));
        s.put("useVolumeKeysForListNavigation", Settings.versions(
                new V(1, new BooleanSetting(false))
        ));
        s.put("useVolumeKeysForNavigation", Settings.versions(
                new V(1, new BooleanSetting(false))
        ));
+1 −1
Original line number Diff line number Diff line
@@ -36,7 +36,7 @@ public class Settings {
     *
     * @see SettingsExporter
     */
    public static final int VERSION = 81;
    public static final int VERSION = 82;

    static Map<String, Object> validate(int version, Map<String, TreeMap<Integer, SettingsDescription>> settings,
            Map<String, String> importedSettings, boolean useDefaultValues) {
+0 −5
Original line number Diff line number Diff line
@@ -210,9 +210,4 @@
        <item>spam</item>
    </string-array>

    <string-array name="volume_navigation_values" translatable="false">
        <item>message</item>
        <item>list</item>
    </string-array>

</resources>
+0 −42
Original line number Diff line number Diff line
package com.fsck.k9.activity;


import android.view.KeyEvent;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListAdapter;
import android.widget.ListView;

import com.fsck.k9.K9;
import com.fsck.k9.ui.base.K9Activity;


@@ -15,45 +12,6 @@ public abstract class K9ListActivity extends K9Activity {
    protected ListAdapter adapter;
    protected ListView list;

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // Shortcuts that work no matter what is selected
        if (K9.isUseVolumeKeysForListNavigation() &&
                (keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
                        keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {

            final ListView listView = getListView();

            int currentPosition = listView.getSelectedItemPosition();
            if (currentPosition == AdapterView.INVALID_POSITION || listView.isInTouchMode()) {
                currentPosition = listView.getFirstVisiblePosition();
            }

            if (keyCode == KeyEvent.KEYCODE_VOLUME_UP && currentPosition > 0) {
                listView.setSelection(currentPosition - 1);
            } else if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN &&
                    currentPosition < listView.getCount()) {
                listView.setSelection(currentPosition + 1);
            }

            return true;
        }

        return super.onKeyDown(keyCode, event);
    }

    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        // Swallow these events too to avoid the audible notification of a volume change
        if (K9.isUseVolumeKeysForListNavigation() &&
                (keyCode == KeyEvent.KEYCODE_VOLUME_UP ||
                keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)) {
            return true;
        }

        return super.onKeyUp(keyCode, event);
    }

    protected ListView getListView() {
        if (list == null) {
            list = findViewById(android.R.id.list);
Loading