Skip to content

Commit

Permalink
added settings option for auto fullscreen
Browse files Browse the repository at this point in the history
  • Loading branch information
[email protected] committed Sep 30, 2018
1 parent 767a183 commit 95d7542
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/fr/gaulupeau/apps/Poche/data/Settings.java
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,10 @@ public boolean isFullscreenArticleView() {
return getBoolean(R.string.pref_key_ui_article_fullscreen, false);
}

public boolean isAutoFullscreenArticleView() {
return getBoolean(R.string.pref_key_ui_article_fullscreen_auto, true);
}

public void setFullScreenArticleView(boolean value) {
setBoolean(R.string.pref_key_ui_article_fullscreen, value);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -220,8 +220,7 @@ public void onCreate(Bundle savedInstanceState) {

// Hide status and action bar when scrolling down, show when scrolling up
// TODO: change to a method compatible with API 14.
// TODO: Maybe implement an option in the settings menu to enable this?
if (Build.VERSION.SDK_INT >= 23) {
if (Build.VERSION.SDK_INT >= 23 && settings.isAutoFullscreenArticleView()) {
scrollView.setOnScrollChangeListener(new View.OnScrollChangeListener(){
@Override
public void onScrollChange(View v, int scrollX, int scrollY, int oldScrollX, int oldScrollY) {
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values/strings-preference-keys.xml
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
<string name="pref_key_ui_screenScrolling_smooth" translatable="false">ui.screenScrolling.smooth</string>
<string name="pref_key_ui_misc_category" translatable="false">ui.misc.category</string>
<string name="pref_key_ui_article_fullscreen" translatable="false">ui.article.fullscreen</string>
<string name="pref_key_ui_article_fullscreen_auto" translatable="false">ui.article.fullscreen_auto</string>
<string name="pref_key_ui_disableTouch_enabled" translatable="false">ui.disableTouch.enabled</string>
<string name="pref_key_ui_disableTouch_lastState" translatable="false">ui.disableTouch.lastState</string>
<string name="pref_key_ui_disableTouch_keyCode" translatable="false">ui.disableTouch.keyCode</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 @@ -198,6 +198,8 @@
<string name="pref_desc_ui_article_textAlignment_justify">Stretches lines to equal width (like in newspapers)</string>
<string name="pref_name_ui_article_fullscreen">Fullscreen Article View</string>
<string name="pref_desc_ui_article_fullscreen">Hides system and app bars when reading articles</string>
<string name="pref_name_ui_article_fullscreen_auto">Fullscreen Article View on Scroll</string>
<string name="pref_desc_ui_article_fullscreen_auto">Hides/Shows system and app bars automatically scroll. Only works on Android 6.0 and above.</string>
<string name="pref_name_ui_readingSpeed">Reading speed</string>
<string name="pref_desc_ui_readingSpeed">Your reading speed (measured in words per minute). Used to calculate estimated reading time.</string>
<string name="pref_name_ui_keepScreenOn">Keep screen on while reading</string>
Expand Down
5 changes: 5 additions & 0 deletions app/src/main/res/xml/preferences.xml
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,11 @@
android:title="@string/pref_name_ui_article_fullscreen"
android:summary="@string/pref_desc_ui_article_fullscreen"
android:defaultValue="false"/>
<CheckBoxPreference
android:key="@string/pref_key_ui_article_fullscreen_auto"
android:title="@string/pref_name_ui_article_fullscreen_auto"
android:summary="@string/pref_desc_ui_article_fullscreen_auto"
android:defaultValue="true"/>
<CheckBoxPreference
android:key="@string/pref_key_ui_disableTouch_enabled"
android:title="@string/pref_name_ui_disableTouch_enabled"
Expand Down

0 comments on commit 95d7542

Please sign in to comment.