aboutsummaryrefslogtreecommitdiff
path: root/app/src/main/java
diff options
context:
space:
mode:
authorDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-10-01 15:05:29 +0000
committerDocile-Alligator <25734209+Docile-Alligator@users.noreply.github.com>2023-10-01 15:05:29 +0000
commitfcd3fbb661960614b3a52a9329ef8b68fefc554a (patch)
tree12104eb6b1ee01006d662a0bed6d3a440c6ec882 /app/src/main/java
parent658efd644d8834c801c9d321bb256492afe918a4 (diff)
downloadinfinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.tar
infinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.tar.gz
infinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.tar.bz2
infinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.tar.lz
infinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.tar.xz
infinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.tar.zst
infinity-for-reddit-fcd3fbb661960614b3a52a9329ef8b68fefc554a.zip
Fix changing playback speed not working in ViewImgurVideoFragment and ViewRedditGalleryVideoFragment when using bottom app bar.
Diffstat (limited to 'app/src/main/java')
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java24
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java20
-rw-r--r--app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java19
3 files changed, 41 insertions, 22 deletions
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 224e8211..2b047074 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/activities/ViewVideoActivity.java
@@ -171,7 +171,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
@BindView(R.id.download_image_view_exo_playback_control_view)
MaterialButton downloadButton;
@BindView(R.id.playback_speed_image_view_exo_playback_control_view)
- MaterialButton playbackSpeedImageView;
+ MaterialButton playbackSpeedButton;
@BindView(R.id.lockable_nested_scroll_view_view_video_activity)
LockableNestedScrollView nestedScrollView;
@@ -335,12 +335,8 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
requestPermissionAndDownload();
});
- playbackSpeedImageView.setOnClickListener(view -> {
- PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
- Bundle bundle = new Bundle();
- bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
- playbackSpeedBottomSheetFragment.setArguments(bundle);
- playbackSpeedBottomSheetFragment.show(getSupportFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+ playbackSpeedButton.setOnClickListener(view -> {
+ changePlaybackSpeed();
});
} else {
ActionBar actionBar = getSupportActionBar();
@@ -699,6 +695,14 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
});
}
+ private void changePlaybackSpeed() {
+ PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
+ playbackSpeedBottomSheetFragment.setArguments(bundle);
+ playbackSpeedBottomSheetFragment.show(getSupportFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+ }
+
private int inferPrimaryTrackType(Format format) {
int trackType = MimeTypes.getTrackType(format.sampleMimeType);
if (trackType != C.TRACK_TYPE_UNKNOWN) {
@@ -936,11 +940,7 @@ public class ViewVideoActivity extends AppCompatActivity implements CustomFontRe
requestPermissionAndDownload();
return true;
} else if (itemId == R.id.action_playback_speed_view_video_activity) {
- PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
- Bundle bundle = new Bundle();
- bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
- playbackSpeedBottomSheetFragment.setArguments(bundle);
- playbackSpeedBottomSheetFragment.show(getSupportFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+ changePlaybackSpeed();
return true;
}
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 06eb7673..0652515d 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewImgurVideoFragment.java
@@ -76,6 +76,8 @@ public class ViewImgurVideoFragment extends Fragment {
MaterialButton backButton;
@BindView(R.id.download_image_view_exo_playback_control_view)
MaterialButton downloadButton;
+ @BindView(R.id.playback_speed_image_view_exo_playback_control_view)
+ MaterialButton playbackSpeedButton;
private ViewImgurMediaActivity activity;
private ImgurMedia imgurMedia;
private ExoPlayer player;
@@ -180,11 +182,23 @@ public class ViewImgurVideoFragment extends Fragment {
isDownloading = true;
requestPermissionAndDownload();
});
+
+ playbackSpeedButton.setOnClickListener(view -> {
+ changePlaybackSpeed();
+ });
}
return rootView;
}
+ private void changePlaybackSpeed() {
+ PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
+ playbackSpeedBottomSheetFragment.setArguments(bundle);
+ playbackSpeedBottomSheetFragment.show(getChildFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+ }
+
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
inflater.inflate(R.menu.view_imgur_video_fragment, menu);
@@ -202,11 +216,7 @@ public class ViewImgurVideoFragment extends Fragment {
requestPermissionAndDownload();
return true;
} else if (item.getItemId() == R.id.action_playback_speed_view_imgur_video_fragment) {
- PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
- Bundle bundle = new Bundle();
- bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
- playbackSpeedBottomSheetFragment.setArguments(bundle);
- playbackSpeedBottomSheetFragment.show(getChildFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+ changePlaybackSpeed();
return true;
}
return false;
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 02560a7f..ba165592 100644
--- a/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
+++ b/app/src/main/java/ml/docilealligator/infinityforreddit/fragments/ViewRedditGalleryVideoFragment.java
@@ -79,6 +79,8 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
MaterialButton backButton;
@BindView(R.id.download_image_view_exo_playback_control_view)
MaterialButton downloadButton;
+ @BindView(R.id.playback_speed_image_view_exo_playback_control_view)
+ MaterialButton playbackSpeedButton;
private ViewRedditGalleryActivity activity;
private Post.Gallery galleryVideo;
private String subredditName;
@@ -185,11 +187,22 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
isDownloading = true;
requestPermissionAndDownload();
});
+ playbackSpeedButton.setOnClickListener(view -> {
+ changePlaybackSpeed();
+ });
}
return rootView;
}
+ private void changePlaybackSpeed() {
+ PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
+ Bundle bundle = new Bundle();
+ bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
+ playbackSpeedBottomSheetFragment.setArguments(bundle);
+ playbackSpeedBottomSheetFragment.show(getChildFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+ }
+
@Override
public void onCreateOptionsMenu(@NonNull Menu menu, @NonNull MenuInflater inflater) {
inflater.inflate(R.menu.view_reddit_gallery_video_fragment, menu);
@@ -207,11 +220,7 @@ public class ViewRedditGalleryVideoFragment extends Fragment {
requestPermissionAndDownload();
return true;
} else if (item.getItemId() == R.id.action_playback_speed_view_reddit_gallery_video_fragment) {
- PlaybackSpeedBottomSheetFragment playbackSpeedBottomSheetFragment = new PlaybackSpeedBottomSheetFragment();
- Bundle bundle = new Bundle();
- bundle.putInt(PlaybackSpeedBottomSheetFragment.EXTRA_PLAYBACK_SPEED, playbackSpeed);
- playbackSpeedBottomSheetFragment.setArguments(bundle);
- playbackSpeedBottomSheetFragment.show(getChildFragmentManager(), playbackSpeedBottomSheetFragment.getTag());
+
return true;
}
return false;