aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Ning <chineseperson5@gmail.com>2021-10-10 12:36:25 +0000
committerAlex Ning <chineseperson5@gmail.com>2021-10-10 12:36:25 +0000
commitd40b81d7993b189142eadd79ab6b1daabba248d0 (patch)
treec66d74ec3179cf5e464746fc0a31bfdda22c297c
parenta30421e73b645bdbab97735875c26a77f27c0bac (diff)
downloadinfinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.tar
infinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.tar.gz
infinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.tar.bz2
infinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.tar.lz
infinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.tar.xz
infinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.tar.zst
infinity-for-reddit-d40b81d7993b189142eadd79ab6b1daabba248d0.zip
New option: Default Playback Speed.
Diffstat (limited to '')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java1
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java3
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java2
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java1
-rw-r--r--app/src/main/res/values/arrays.xml22
-rw-r--r--app/src/main/res/values/strings.xml1
-rw-r--r--app/src/main/res/xml/video_preferences.xml8
8 files changed, 37 insertions, 3 deletions
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
index 984dd133..d07e8c69 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewImageOrGifActivity.java
@@ -470,6 +470,7 @@ public class ViewImageOrGifActivity extends AppCompatActivity implements SetAsWa
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
index 3f61ed7a..0942dbef 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -361,7 +361,7 @@ public class ViewVideoActivity extends AppCompatActivity {
id = savedInstanceState.getString(ID_STATE);
playbackSpeed = savedInstanceState.getInt(PLAYBACK_SPEED_STATE);
}
- setPlaybackSpeed(playbackSpeed);
+ setPlaybackSpeed(Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_PLAYBACK_SPEED, "100")));
if (videoType == VIDEO_TYPE_V_REDD_IT) {
loadVReddItVideo(savedInstanceState);
@@ -701,6 +701,7 @@ public class ViewVideoActivity extends AppCompatActivity {
@Override
public void onRequestPermissionsResult(int requestCode, @NonNull String[] permissions, @NonNull int[] grantResults) {
+ super.onRequestPermissionsResult(requestCode, permissions, grantResults);
if (requestCode == PERMISSION_REQUEST_WRITE_EXTERNAL_STORAGE && grantResults.length > 0) {
if (grantResults[0] == PackageManager.PERMISSION_DENIED) {
Toast.makeText(this, R.string.no_storage_permission, Toast.LENGTH_SHORT).show();
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
index fcce3d4d..f67e18c8 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
@@ -153,7 +153,7 @@ public class ViewImgurVideoFragment extends Fragment {
if (savedInstanceState != null) {
playbackSpeed = savedInstanceState.getInt(PLAYBACK_SPEED_STATE);
}
- setPlaybackSpeed(playbackSpeed);
+ setPlaybackSpeed(Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_PLAYBACK_SPEED, "100")));
preparePlayer(savedInstanceState);
if (activity.isUseBottomAppBar()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
index ff17bd82..2946d193 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
@@ -156,7 +156,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
if (savedInstanceState != null) {
playbackSpeed = savedInstanceState.getInt(PLAYBACK_SPEED_STATE);
}
- setPlaybackSpeed(playbackSpeed);
+ Integer.parseInt(mSharedPreferences.getString(SharedPreferencesUtils.DEFAULT_PLAYBACK_SPEED, "100"));
preparePlayer(savedInstanceState);
if (activity.isUseBottomAppBar()) {
diff --git a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
index 361c59f4..9e3f8c69 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/utils/SharedPreferencesUtils.java
@@ -192,6 +192,7 @@ public class SharedPreferencesUtils {
public static final String LOCK_SCREEN_ANIMATION = "lock_screen_animation";
public static final String ENABLE_FOLD_SUPPORT = "enable_fold_support";
public static final String LOOP_VIDEO = "loop_video";
+ public static final String DEFAULT_PLAYBACK_SPEED = "default_playback_speed";
public static final String DEFAULT_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit_preferences";
public static final String MAIN_PAGE_TABS_SHARED_PREFERENCES_FILE = "ml.docilealligator.infinityforreddit.main_page_tabs";
diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml
index e59c5abd..ffe31f93 100644
--- a/app/src/main/res/values/arrays.xml
+++ b/app/src/main/res/values/arrays.xml
@@ -520,4 +520,26 @@
<item>2</item>
</string-array>
+ <string-array name="default_playback_speed">
+ <item>0.25x</item>
+ <item>0.5x</item>
+ <item>0.75x</item>
+ <item>@string/normal</item>
+ <item>1.25x</item>
+ <item>1.5x</item>
+ <item>1.75x</item>
+ <item>2x</item>
+ </string-array>
+
+ <string-array name="default_playback_speed_values">
+ <item>25</item>
+ <item>50</item>
+ <item>75</item>
+ <item>100</item>
+ <item>125</item>
+ <item>150</item>
+ <item>175</item>
+ <item>200</item>
+ </string-array>
+
</resources>
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index fd09419b..f791a313 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -609,6 +609,7 @@
<string name="settings_app_lock_summary">Require authentication before using the app</string>
<string name="settings_app_lock_timeout_title">App Lock Timeout</string>
<string name="settings_enable_fold_support_title">Enable folding phone support</string>
+ <string name="settings_default_playback_speed_title">Default Playback Speed</string>
<string name="no_link_available">Cannot get the link</string>
diff --git a/app/src/main/res/xml/video_preferences.xml b/app/src/main/res/xml/video_preferences.xml
index ef8d944e..d3653e3c 100644
--- a/app/src/main/res/xml/video_preferences.xml
+++ b/app/src/main/res/xml/video_preferences.xml
@@ -36,6 +36,14 @@
app:title="@string/settings_loop_video_title"
app:summary="@string/settings_loop_video_summary" />
+ <ListPreference
+ app:defaultValue="100"
+ android:entries="@array/default_playback_speed"
+ app:entryValues="@array/default_playback_speed_values"
+ app:key="default_playback_speed"
+ app:title="@string/settings_default_playback_speed_title"
+ app:useSimpleSummaryProvider="true" />
+
<PreferenceCategory
app:title="@string/settings_video_autoplay_title" />