From cfc90be8cc9c6f8c297fbc610876f955d9adb0bd Mon Sep 17 00:00:00 2001 From: Haleydu <44172947+Haleydu@users.noreply.github.com> Date: Mon, 3 Aug 2020 21:22:50 +0800 Subject: [PATCH] add volume key to control page turning switch MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 音量键控制翻页默认关闭 --- .../java/com/hiroshi/cimoc/global/ClickEvents.java | 14 ++++++++++++++ .../hiroshi/cimoc/manager/PreferenceManager.java | 1 + .../cimoc/ui/activity/SettingsActivity.java | 5 +++++ app/src/main/res/layout/activity_settings.xml | 7 +++++++ app/src/main/res/values-zh-rTW/strings.xml | 14 ++++++++++++++ app/src/main/res/values/strings.xml | 2 ++ 6 files changed, 43 insertions(+) diff --git a/app/src/main/java/com/hiroshi/cimoc/global/ClickEvents.java b/app/src/main/java/com/hiroshi/cimoc/global/ClickEvents.java index 519ac54f..2863b0cc 100644 --- a/app/src/main/java/com/hiroshi/cimoc/global/ClickEvents.java +++ b/app/src/main/java/com/hiroshi/cimoc/global/ClickEvents.java @@ -63,6 +63,13 @@ public static String[] getPageLongClickEvents() { } public static int[] getPageClickEventChoice(PreferenceManager manager) { + if (!manager.getBoolean(PreferenceManager.PREF_READER_VOLUME_KEY_CONTROLS_PAGE_TURNING, false)) { + manager.putInt(PreferenceManager.PREF_READER_PAGE_CLICK_UP, EVENT_NULL); + manager.putInt(PreferenceManager.PREF_READER_PAGE_CLICK_DOWN, EVENT_NULL); + } else { + manager.putInt(PreferenceManager.PREF_READER_PAGE_CLICK_UP, EVENT_PREV_PAGE); + manager.putInt(PreferenceManager.PREF_READER_PAGE_CLICK_DOWN, EVENT_NEXT_PAGE); + } final int[] array = { //screen manager.getInt(PreferenceManager.PREF_READER_PAGE_CLICK_LEFT, EVENT_PREV_PAGE), @@ -130,6 +137,13 @@ public static String[] getStreamLongClickEvents() { } public static int[] getStreamClickEventChoice(PreferenceManager manager) { + if (!manager.getBoolean(PreferenceManager.PREF_READER_VOLUME_KEY_CONTROLS_PAGE_TURNING, false)) { + manager.putInt(PreferenceManager.PREF_READER_STREAM_CLICK_UP, EVENT_NULL); + manager.putInt(PreferenceManager.PREF_READER_STREAM_CLICK_DOWN, EVENT_NULL); + }else { + manager.putInt(PreferenceManager.PREF_READER_STREAM_CLICK_UP, EVENT_PREV_PAGE); + manager.putInt(PreferenceManager.PREF_READER_STREAM_CLICK_DOWN, EVENT_NEXT_PAGE); + } final int[] array = { //screen manager.getInt(PreferenceManager.PREF_READER_STREAM_CLICK_LEFT, EVENT_NULL),//0 diff --git a/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java b/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java index 493b5a28..ce6e0c65 100644 --- a/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java +++ b/app/src/main/java/com/hiroshi/cimoc/manager/PreferenceManager.java @@ -44,6 +44,7 @@ public class PreferenceManager { public static final String PREF_READER_WHITE_BACKGROUND = "pref_reader_white_background"; public static final String PREF_READER_SCALE_FACTOR = "pref_reader_scale_factor"; public static final String PREF_READER_CONTROLLER_TRIG_THRESHOLD = "pref_reader_controller_trig_threshold"; + public static final String PREF_READER_VOLUME_KEY_CONTROLS_PAGE_TURNING = "pref_reader_volume_key_controls_page_turning"; public static final String PREF_READER_PAGE_TURN = "pref_reader_page_turn"; public static final String PREF_READER_PAGE_ORIENTATION = "pref_reader_page_orientation"; diff --git a/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java b/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java index ad2145cd..c7850416 100644 --- a/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java +++ b/app/src/main/java/com/hiroshi/cimoc/ui/activity/SettingsActivity.java @@ -74,6 +74,8 @@ public class SettingsActivity extends BackActivity implements SettingsView { CheckBoxPreference mReaderWhiteEdge; @BindView(R.id.settings_reader_white_background) CheckBoxPreference mReaderWhiteBackground; + @BindView(R.id.settings_reader_volume_key) + CheckBoxPreference mReaderVolumeKeyControls; @BindView(R.id.settings_search_auto_complete) CheckBoxPreference mSearchAutoComplete; @BindView(R.id.settings_other_check_update) @@ -127,6 +129,7 @@ protected void initView() { mReaderPagingReverse.bindPreference(PreferenceManager.PREF_READER_PAGING_REVERSE, false); mReaderWhiteEdge.bindPreference(PreferenceManager.PREF_READER_WHITE_EDGE, false); mReaderWhiteBackground.bindPreference(PreferenceManager.PREF_READER_WHITE_BACKGROUND, false); + mReaderVolumeKeyControls.bindPreference(PreferenceManager.PREF_READER_VOLUME_KEY_CONTROLS_PAGE_TURNING, false); mSearchAutoComplete.bindPreference(PreferenceManager.PREF_SEARCH_AUTO_COMPLETE, false); mCheckUpdate.bindPreference(PreferenceManager.PREF_OTHER_CHECK_UPDATE, false); mConnectOnlyWifi.bindPreference(PreferenceManager.PREF_OTHER_CONNECT_ONLY_WIFI, false); @@ -259,6 +262,8 @@ private void changeTheme(int primary, int accent) { mConnectOnlyWifi.setColorStateList(stateList); mLoadCoverOnlyWifi.setColorStateList(stateList); mOtherShowTopbar.setColorStateList(stateList); + mReaderCloseAutoResizeImage.setColorStateList(stateList); + mReaderVolumeKeyControls.setColorStateList(stateList); } @OnClick(R.id.settings_other_storage) diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index ef7c2564..d55373a6 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -117,6 +117,13 @@ app:summary="@string/settings_reader_white_background_summary" app:title="@string/settings_reader_white_background" /> + + 預設閱讀模式 閱讀配置 自訂閱讀模式下各項功能 + 控制器触发阈值 + 设置摇杆及扳机键触发阈值 + 使用白色背景 + 推荐E-ink设备使用,OLED设备不推荐。 + 音量鍵控制翻頁 + 音量鍵控制翻頁 閱讀方向 螢幕方向 自訂點擊事件 @@ -161,6 +167,12 @@ 開啟搜尋提示 根據輸入的關鍵字彈出提示 App 設定 + 显示通知栏 + 阅读界面显示通知栏 + 仅WiFi联网 + 非 WIFI 环境下禁止联网 + 禁止流量加载封面 + 非 WIFI 环境下使用缓存加载封面 自動檢查漫畫更新 WIFI 下自動檢查漫畫更新 預設啟動頁 @@ -180,6 +192,8 @@ 備份收藏和歷史漫畫 備份標籤 備份標籤及相應漫畫 + 备份设置 + 备份所有个人配置 備份成功 共 %d 條記錄 恢復 沒有找到備份檔案 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 0346f45b..5dc4c276 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -124,6 +124,8 @@ 设置摇杆及扳机键触发阈值 使用白色背景 推荐E-ink设备使用,OLED设备不推荐。 + 音量键控制翻页 + 音量键控制翻页 阅读方向 屏幕方向 自定义点击事件