mirror of
https://github.com/Docile-Alligator/Infinity-For-Reddit.git
synced 2026-02-24 12:05:47 +00:00
Fix changing playback speed not working in ViewImgurVideoFragment and ViewRedditGalleryVideoFragment when using bottom app bar.
This commit is contained in:
@ -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;
|
||||
}
|
||||
|
||||
|
||||
@ -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;
|
||||
|
||||
@ -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;
|
||||
|
||||
Reference in New Issue
Block a user