This commit is contained in:
Javi Rueda 2020-09-07 09:56:24 +02:00
commit f602418b31
3 changed files with 20 additions and 0 deletions

View file

@ -3013,6 +3013,9 @@ public class MainActivity extends AppCompatActivity implements SdkStatusListener
if (appPlayer != null && inPictureInPictureMode && !isBackgroundPlaybackEnabled()) {
appPlayer.setPlayWhenReady(false);
}
if (inPictureInPictureMode) {
MainActivity.playerReassigned = true;
}
super.onStop();
}

View file

@ -728,6 +728,7 @@ public class FileViewFragment extends BaseFragment implements
}
}
updatePlaybackSpeedView(root);
loadAndScheduleDurations();
}
@ -772,6 +773,7 @@ public class FileViewFragment extends BaseFragment implements
View root = getView();
if (root != null) {
PlayerView view = root.findViewById(R.id.file_view_exoplayer_view);
view.setVisibility(View.VISIBLE);
view.setPlayer(null);
view.setPlayer(MainActivity.appPlayer);
}
@ -1183,6 +1185,16 @@ public class FileViewFragment extends BaseFragment implements
commentsList.setLayoutManager(commentsListLLM);
}
private void updatePlaybackSpeedView(View root) {
if (root != null) {
PlayerView playerView = root.findViewById(R.id.file_view_exoplayer_view);
TextView textPlaybackSpeed = playerView.findViewById(R.id.player_playback_speed_label);
textPlaybackSpeed.setText(MainActivity.appPlayer != null && MainActivity.appPlayer.getPlaybackParameters() != null ?
Helper.getDisplayValueForPlaybackSpeed((double) MainActivity.appPlayer.getPlaybackParameters().speed) :
DEFAULT_PLAYBACK_SPEED);
}
}
private void deleteCurrentClaim() {
if (claim != null) {
Helper.setViewVisibility(layoutDisplayArea, View.INVISIBLE);

View file

@ -103,6 +103,11 @@ public final class Helper {
}
}
public static String getDisplayValueForPlaybackSpeed(Double speed) {
DecimalFormat formatter = new DecimalFormat("0.##");
return String.format("%sx", formatter.format(speed));
}
public static String capitalize(String value) {
StringBuilder sb = new StringBuilder();
boolean capitalizeNext = true;