Skip to content

Commit

Permalink
Add auto screen rotation support.
Browse files Browse the repository at this point in the history
  • Loading branch information
liqichang committed Jun 16, 2019
1 parent 21ef589 commit 2c43589
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 0 deletions.
6 changes: 6 additions & 0 deletions app/src/main/java/com/hippo/ehviewer/ui/GalleryActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -370,6 +370,9 @@ protected void onCreate(@Nullable Bundle savedInstanceState) {
case 2:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
break;
case 3:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
break;
}
setRequestedOrientation(orientation);

Expand Down Expand Up @@ -841,6 +844,9 @@ public void onClick(DialogInterface dialog, int which) {
case 2:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
break;
case 3:
orientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR;
break;
}
setRequestedOrientation(orientation);
mGalleryView.setLayoutMode(layoutMode);
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -465,6 +465,7 @@
<string name="settings_read_screen_rotation_default">系统默认</string>
<string name="settings_read_screen_rotation_portrait">竖屏</string>
<string name="settings_read_screen_rotation_landscape">横屏</string>
<string name="settings_read_screen_rotation_sensor">自动旋转</string>
<string name="settings_read_reading_direction">阅读方向</string>
<string name="settings_read_reading_direction_left_to_right">从左至右</string>
<string name="settings_read_reading_direction_right_to_Left">从右至左</string>
Expand Down
2 changes: 2 additions & 0 deletions app/src/main/res/values/arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -156,12 +156,14 @@
<item>@string/settings_read_screen_rotation_default</item>
<item>@string/settings_read_screen_rotation_portrait</item>
<item>@string/settings_read_screen_rotation_landscape</item>
<item>@string/settings_read_screen_rotation_sensor</item>
</string-array>

<string-array name="screen_rotation_entry_values" translatable="false">
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
</string-array>

<string-array name="reading_direction_entries">
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -510,6 +510,7 @@
<string name="settings_read_screen_rotation_default">Default</string>
<string name="settings_read_screen_rotation_portrait">Portrait</string>
<string name="settings_read_screen_rotation_landscape">Landscape</string>
<string name="settings_read_screen_rotation_sensor">Auto rotate</string>
<string name="settings_read_reading_direction">Reading direction</string>
<string name="settings_read_reading_direction_left_to_right">Left to right</string>
<string name="settings_read_reading_direction_right_to_Left">Right to left</string>
Expand Down

0 comments on commit 2c43589

Please sign in to comment.