Skip to content

Commit

Permalink
add volume key to control page turning switch
Browse files Browse the repository at this point in the history
音量键控制翻页默认关闭
  • Loading branch information
Haleydu committed Aug 3, 2020
1 parent be2d965 commit cfc90be
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 0 deletions.
14 changes: 14 additions & 0 deletions app/src/main/java/com/hiroshi/cimoc/global/ClickEvents.java
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions app/src/main/res/layout/activity_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,13 @@
app:summary="@string/settings_reader_white_background_summary"
app:title="@string/settings_reader_white_background" />

<com.hiroshi.cimoc.ui.widget.preference.CheckBoxPreference
android:id="@+id/settings_reader_volume_key"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:summary="@string/settings_reader_volume_key_controls_summary"
app:title="@string/settings_reader_volume_key_controls" />

<com.hiroshi.cimoc.ui.widget.preference.SliderPreference
android:id="@+id/settings_reader_scale_factor"
android:layout_width="match_parent"
Expand Down
14 changes: 14 additions & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,12 @@
<string name="settings_reader_mode">預設閱讀模式</string>
<string name="settings_reader_config">閱讀配置</string>
<string name="settings_reader_config_summary">自訂閱讀模式下各項功能</string>
<string name="settings_reader_controller_trig_threshold">控制器触发阈值</string>
<string name="settings_reader_controller_trig_threshold_summary">设置摇杆及扳机键触发阈值</string>
<string name="settings_reader_white_background">使用白色背景</string>
<string name="settings_reader_white_background_summary">推荐E-ink设备使用,OLED设备不推荐。</string>
<string name="settings_reader_volume_key_controls">音量鍵控制翻頁</string>
<string name="settings_reader_volume_key_controls_summary">音量鍵控制翻頁</string>
<string name="settings_reader_turn">閱讀方向</string>
<string name="settings_reader_orientation">螢幕方向</string>
<string name="settings_reader_click_event">自訂點擊事件</string>
Expand Down Expand Up @@ -161,6 +167,12 @@
<string name="settings_search_auto_complete">開啟搜尋提示</string>
<string name="settings_search_auto_complete_summary">根據輸入的關鍵字彈出提示</string>
<string name="settings_other">App 設定</string>
<string name="settings_reader_show_topbar">显示通知栏</string>
<string name="settings_reader_show_topbar_summary">阅读界面显示通知栏</string>
<string name="settings_other_connect_only_wifi">仅WiFi联网</string>
<string name="settings_other_connect_only_wifi_summary">非 WIFI 环境下禁止联网</string>
<string name="settings_other_loadcover_only_wifi">禁止流量加载封面</string>
<string name="settings_other_loadcover_only_wifi_summary">非 WIFI 环境下使用缓存加载封面</string>
<string name="settings_other_check_update">自動檢查漫畫更新</string>
<string name="settings_other_check_update_summary">WIFI 下自動檢查漫畫更新</string>
<string name="settings_other_launch">預設啟動頁</string>
Expand All @@ -180,6 +192,8 @@
<string name="backup_save_comic_summary">備份收藏和歷史漫畫</string>
<string name="backup_save_tag">備份標籤</string>
<string name="backup_save_tag_summary">備份標籤及相應漫畫</string>
<string name="backup_save_settings">备份设置</string>
<string name="backup_save_settings_summary">备份所有个人配置</string>
<string name="backup_save_success">備份成功 共 %d 條記錄</string>
<string name="backup_restore">恢復</string>
<string name="backup_restore_not_found">沒有找到備份檔案</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@
<string name="settings_reader_controller_trig_threshold_summary">设置摇杆及扳机键触发阈值</string>
<string name="settings_reader_white_background">使用白色背景</string>
<string name="settings_reader_white_background_summary">推荐E-ink设备使用,OLED设备不推荐。</string>
<string name="settings_reader_volume_key_controls">音量键控制翻页</string>
<string name="settings_reader_volume_key_controls_summary">音量键控制翻页</string>
<string name="settings_reader_turn">阅读方向</string>
<string name="settings_reader_orientation">屏幕方向</string>
<string name="settings_reader_click_event">自定义点击事件</string>
Expand Down

0 comments on commit cfc90be

Please sign in to comment.