Merge pull request #4138 from XiangRongLin/checkstyle_final
Add checkstyle rule to show final local variable violations as warning
This commit is contained in:
commit
5485e994ee
133 changed files with 1028 additions and 1005 deletions
|
|
@ -54,7 +54,6 @@ import com.nostra13.universalimageloader.core.ImageLoader;
|
|||
import com.nostra13.universalimageloader.core.assist.FailReason;
|
||||
import com.nostra13.universalimageloader.core.listener.ImageLoadingListener;
|
||||
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import org.schabi.newpipe.BuildConfig;
|
||||
import org.schabi.newpipe.DownloaderImpl;
|
||||
import org.schabi.newpipe.R;
|
||||
|
|
@ -79,6 +78,7 @@ import org.schabi.newpipe.util.SerializedCache;
|
|||
import java.io.IOException;
|
||||
|
||||
import io.reactivex.Observable;
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers;
|
||||
import io.reactivex.disposables.CompositeDisposable;
|
||||
import io.reactivex.disposables.Disposable;
|
||||
import io.reactivex.disposables.SerialDisposable;
|
||||
|
|
@ -280,7 +280,7 @@ public abstract class BasePlayer implements
|
|||
|
||||
// Resolve append intents
|
||||
if (intent.getBooleanExtra(APPEND_ONLY, false) && playQueue != null) {
|
||||
int sizeBeforeAppend = playQueue.size();
|
||||
final int sizeBeforeAppend = playQueue.size();
|
||||
playQueue.append(queue.getStreams());
|
||||
|
||||
if ((intent.getBooleanExtra(SELECT_ON_APPEND, false)
|
||||
|
|
@ -1452,7 +1452,7 @@ public abstract class BasePlayer implements
|
|||
return false;
|
||||
}
|
||||
|
||||
Timeline.Window timelineWindow = new Timeline.Window();
|
||||
final Timeline.Window timelineWindow = new Timeline.Window();
|
||||
currentTimeline.getWindow(currentWindowIndex, timelineWindow);
|
||||
return timelineWindow.getDefaultPositionMs() <= simpleExoPlayer.getCurrentPosition();
|
||||
}
|
||||
|
|
@ -1463,7 +1463,7 @@ public abstract class BasePlayer implements
|
|||
}
|
||||
try {
|
||||
return simpleExoPlayer.isCurrentWindowDynamic();
|
||||
} catch (@NonNull IndexOutOfBoundsException e) {
|
||||
} catch (@NonNull final IndexOutOfBoundsException e) {
|
||||
// Why would this even happen =(
|
||||
// But lets log it anyway. Save is save
|
||||
if (DEBUG) {
|
||||
|
|
|
|||
|
|
@ -580,7 +580,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
private void shareUrl(final String subject, final String url) {
|
||||
Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
final Intent intent = new Intent(Intent.ACTION_SEND);
|
||||
intent.setType("text/plain");
|
||||
intent.putExtra(Intent.EXTRA_SUBJECT, subject);
|
||||
intent.putExtra(Intent.EXTRA_TEXT, url);
|
||||
|
|
@ -734,7 +734,7 @@ public abstract class ServicePlayerActivity extends AppCompatActivity
|
|||
|
||||
private void onMaybeMuteChanged() {
|
||||
if (menu != null && player != null) {
|
||||
MenuItem item = menu.findItem(R.id.action_mute);
|
||||
final MenuItem item = menu.findItem(R.id.action_mute);
|
||||
|
||||
//Change the mute-button item in ActionBar
|
||||
//1) Text change:
|
||||
|
|
|
|||
|
|
@ -167,7 +167,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
|
||||
// workaround to match normalized captions like english to English or deutsch to Deutsch
|
||||
private static boolean containsCaseInsensitive(final List<String> list, final String toFind) {
|
||||
for (String i : list) {
|
||||
for (final String i : list) {
|
||||
if (i.equalsIgnoreCase(toFind)) {
|
||||
return true;
|
||||
}
|
||||
|
|
@ -279,7 +279,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
|
||||
qualityPopupMenu.getMenu().removeGroup(qualityPopupMenuGroupId);
|
||||
for (int i = 0; i < availableStreams.size(); i++) {
|
||||
VideoStream videoStream = availableStreams.get(i);
|
||||
final VideoStream videoStream = availableStreams.get(i);
|
||||
qualityPopupMenu.getMenu().add(qualityPopupMenuGroupId, i, Menu.NONE, MediaFormat
|
||||
.getNameById(videoStream.getFormatId()) + " " + videoStream.resolution);
|
||||
}
|
||||
|
|
@ -311,7 +311,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
}
|
||||
captionPopupMenu.getMenu().removeGroup(captionPopupMenuGroupId);
|
||||
|
||||
String userPreferredLanguage = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
final String userPreferredLanguage = PreferenceManager.getDefaultSharedPreferences(context)
|
||||
.getString(context.getString(R.string.caption_user_set_key), null);
|
||||
/*
|
||||
* only search for autogenerated cc as fallback
|
||||
|
|
@ -323,7 +323,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
&& !userPreferredLanguage.contains("(");
|
||||
|
||||
// Add option for turning off caption
|
||||
MenuItem captionOffItem = captionPopupMenu.getMenu().add(captionPopupMenuGroupId,
|
||||
final MenuItem captionOffItem = captionPopupMenu.getMenu().add(captionPopupMenuGroupId,
|
||||
0, Menu.NONE, R.string.caption_none);
|
||||
captionOffItem.setOnMenuItemClickListener(menuItem -> {
|
||||
final int textRendererIndex = getRendererIndex(C.TRACK_TYPE_TEXT);
|
||||
|
|
@ -339,7 +339,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
// Add all available captions
|
||||
for (int i = 0; i < availableLanguages.size(); i++) {
|
||||
final String captionLanguage = availableLanguages.get(i);
|
||||
MenuItem captionItem = captionPopupMenu.getMenu().add(captionPopupMenuGroupId,
|
||||
final MenuItem captionItem = captionPopupMenu.getMenu().add(captionPopupMenuGroupId,
|
||||
i + 1, Menu.NONE, captionLanguage);
|
||||
captionItem.setOnMenuItemClickListener(menuItem -> {
|
||||
final int textRendererIndex = getRendererIndex(C.TRACK_TYPE_TEXT);
|
||||
|
|
@ -579,7 +579,7 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
.getTrackGroups(textRenderer);
|
||||
|
||||
// Extract all loaded languages
|
||||
List<String> availableLanguages = new ArrayList<>(textTracks.length);
|
||||
final List<String> availableLanguages = new ArrayList<>(textTracks.length);
|
||||
for (int i = 0; i < textTracks.length; i++) {
|
||||
final TrackGroup textTrack = textTracks.get(i);
|
||||
if (textTrack.length > 0 && textTrack.getFormat(0) != null) {
|
||||
|
|
@ -729,8 +729,8 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
qualityTextView.setText(menuItem.getTitle());
|
||||
return true;
|
||||
} else if (playbackSpeedPopupMenuGroupId == menuItem.getGroupId()) {
|
||||
int speedIndex = menuItem.getItemId();
|
||||
float speed = PLAYBACK_SPEEDS[speedIndex];
|
||||
final int speedIndex = menuItem.getItemId();
|
||||
final float speed = PLAYBACK_SPEEDS[speedIndex];
|
||||
|
||||
setPlaybackSpeed(speed);
|
||||
playbackSpeedTextView.setText(formatSpeed(speed));
|
||||
|
|
@ -921,10 +921,10 @@ public abstract class VideoPlayer extends BasePlayer
|
|||
return;
|
||||
}
|
||||
|
||||
float scaleFrom = goneOnEnd ? 1f : 1f;
|
||||
float scaleTo = goneOnEnd ? 1.8f : 1.4f;
|
||||
float alphaFrom = goneOnEnd ? 1f : 0f;
|
||||
float alphaTo = goneOnEnd ? 0f : 1f;
|
||||
final float scaleFrom = goneOnEnd ? 1f : 1f;
|
||||
final float scaleTo = goneOnEnd ? 1.8f : 1.4f;
|
||||
final float alphaFrom = goneOnEnd ? 1f : 0f;
|
||||
final float alphaTo = goneOnEnd ? 0f : 1f;
|
||||
|
||||
|
||||
controlViewAnimator = ObjectAnimator.ofPropertyValuesHolder(controlAnimationView,
|
||||
|
|
|
|||
|
|
@ -320,7 +320,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||
final float captionScale,
|
||||
@NonNull final CaptionStyleCompat captionStyle) {
|
||||
if (popupPlayerSelected()) {
|
||||
float captionRatio = (captionScale - 1.0f) / 5.0f + 1.0f;
|
||||
final float captionRatio = (captionScale - 1.0f) / 5.0f + 1.0f;
|
||||
view.setFractionalTextSize(SubtitleView.DEFAULT_TEXT_SIZE_FRACTION * captionRatio);
|
||||
view.setApplyEmbeddedStyles(captionStyle.equals(CaptionStyleCompat.DEFAULT));
|
||||
view.setStyle(captionStyle);
|
||||
|
|
@ -717,7 +717,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||
if (popupPlayerSelected()) {
|
||||
setRecovery();
|
||||
service.removeViewFromParent();
|
||||
Intent intent = NavigationHelper.getPlayerIntent(
|
||||
final Intent intent = NavigationHelper.getPlayerIntent(
|
||||
service,
|
||||
MainActivity.class,
|
||||
this.getPlayQueue(),
|
||||
|
|
@ -894,7 +894,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||
onPause();
|
||||
try {
|
||||
NavigationHelper.playWithKore(getParentActivity(), Uri.parse(getVideoUrl()));
|
||||
} catch (Exception e) {
|
||||
} catch (final Exception e) {
|
||||
if (DEBUG) {
|
||||
Log.i(TAG, "Failed to start kore", e);
|
||||
}
|
||||
|
|
@ -979,9 +979,9 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||
if (l != ol || t != ot || r != or || b != ob) {
|
||||
// Use smaller value to be consistent between screen orientations
|
||||
// (and to make usage easier)
|
||||
int width = r - l;
|
||||
int height = b - t;
|
||||
int min = Math.min(width, height);
|
||||
final int width = r - l;
|
||||
final int height = b - t;
|
||||
final int min = Math.min(width, height);
|
||||
maxGestureLength = (int) (min * MAX_GESTURE_LENGTH);
|
||||
|
||||
if (DEBUG) {
|
||||
|
|
@ -995,7 +995,7 @@ public class VideoPlayerImpl extends VideoPlayer
|
|||
queueLayout.getLayoutParams().height = height - queueLayout.getTop();
|
||||
|
||||
if (popupPlayerSelected()) {
|
||||
float widthDp = Math.abs(r - l) / service.getResources()
|
||||
final float widthDp = Math.abs(r - l) / service.getResources()
|
||||
.getDisplayMetrics().density;
|
||||
final int visibility = widthDp > MINIMUM_SHOW_EXTRA_WIDTH_DP
|
||||
? View.VISIBLE
|
||||
|
|
|
|||
|
|
@ -227,8 +227,8 @@ public class PlayerGestureListener
|
|||
|
||||
isMovingInMain = true;
|
||||
|
||||
boolean acceptAnyArea = isVolumeGestureEnabled != isBrightnessGestureEnabled;
|
||||
boolean acceptVolumeArea = acceptAnyArea
|
||||
final boolean acceptAnyArea = isVolumeGestureEnabled != isBrightnessGestureEnabled;
|
||||
final boolean acceptVolumeArea = acceptAnyArea
|
||||
|| initialEvent.getX() > playerImpl.getRootView().getWidth() / 2.0;
|
||||
|
||||
if (isVolumeGestureEnabled && acceptVolumeArea) {
|
||||
|
|
@ -563,13 +563,13 @@ public class PlayerGestureListener
|
|||
private boolean handleMultiDrag(final MotionEvent event) {
|
||||
if (initPointerDistance != -1 && event.getPointerCount() == 2) {
|
||||
// get the movements of the fingers
|
||||
double firstPointerMove = Math.hypot(event.getX(0) - initFirstPointerX,
|
||||
final double firstPointerMove = Math.hypot(event.getX(0) - initFirstPointerX,
|
||||
event.getY(0) - initFirstPointerY);
|
||||
double secPointerMove = Math.hypot(event.getX(1) - initSecPointerX,
|
||||
final double secPointerMove = Math.hypot(event.getX(1) - initSecPointerX,
|
||||
event.getY(1) - initSecPointerY);
|
||||
|
||||
// minimum threshold beyond which pinch gesture will work
|
||||
int minimumMove = ViewConfiguration.get(service).getScaledTouchSlop();
|
||||
final int minimumMove = ViewConfiguration.get(service).getScaledTouchSlop();
|
||||
|
||||
if (Math.max(firstPointerMove, secPointerMove) > minimumMove) {
|
||||
// calculate current distance between the pointers
|
||||
|
|
@ -577,9 +577,9 @@ public class PlayerGestureListener
|
|||
Math.hypot(event.getX(0) - event.getX(1),
|
||||
event.getY(0) - event.getY(1));
|
||||
|
||||
double popupWidth = playerImpl.getPopupWidth();
|
||||
final double popupWidth = playerImpl.getPopupWidth();
|
||||
// change co-ordinates of popup so the center stays at the same position
|
||||
double newWidth = (popupWidth * currentPointerDistance / initPointerDistance);
|
||||
final double newWidth = (popupWidth * currentPointerDistance / initPointerDistance);
|
||||
initPointerDistance = currentPointerDistance;
|
||||
playerImpl.getPopupLayoutParams().x += (popupWidth - newWidth) / 2;
|
||||
|
||||
|
|
@ -601,7 +601,7 @@ public class PlayerGestureListener
|
|||
* */
|
||||
|
||||
private int getNavigationBarHeight(final Context context) {
|
||||
int resId = context.getResources()
|
||||
final int resId = context.getResources()
|
||||
.getIdentifier("navigation_bar_height", "dimen", "android");
|
||||
if (resId > 0) {
|
||||
return context.getResources().getDimensionPixelSize(resId);
|
||||
|
|
@ -610,7 +610,7 @@ public class PlayerGestureListener
|
|||
}
|
||||
|
||||
private int getStatusBarHeight(final Context context) {
|
||||
int resId = context.getResources()
|
||||
final int resId = context.getResources()
|
||||
.getIdentifier("status_bar_height", "dimen", "android");
|
||||
if (resId > 0) {
|
||||
return context.getResources().getDimensionPixelSize(resId);
|
||||
|
|
|
|||
|
|
@ -133,7 +133,7 @@ public class AudioReactor implements AudioManager.OnAudioFocusChangeListener, An
|
|||
}
|
||||
|
||||
private void animateAudio(final float from, final float to) {
|
||||
ValueAnimator valueAnimator = new ValueAnimator();
|
||||
final ValueAnimator valueAnimator = new ValueAnimator();
|
||||
valueAnimator.setFloatValues(from, to);
|
||||
valueAnimator.setDuration(AudioReactor.DUCK_DURATION);
|
||||
valueAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
|
|
|
|||
|
|
@ -80,13 +80,13 @@ import java.io.File;
|
|||
}
|
||||
|
||||
try {
|
||||
for (File file : cacheDir.listFiles()) {
|
||||
for (final File file : cacheDir.listFiles()) {
|
||||
final String filePath = file.getAbsolutePath();
|
||||
final boolean deleteSuccessful = file.delete();
|
||||
|
||||
Log.d(TAG, "tryDeleteCacheFiles: " + filePath + " deleted = " + deleteSuccessful);
|
||||
}
|
||||
} catch (Exception ignored) {
|
||||
} catch (final Exception ignored) {
|
||||
Log.e(TAG, "Failed to delete file.", ignored);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -29,7 +29,7 @@ public class LoadController implements LoadControl {
|
|||
final int optimalPlaybackBufferMs) {
|
||||
this.initialPlaybackBufferUs = initialPlaybackBufferMs * 1000;
|
||||
|
||||
DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder();
|
||||
final DefaultLoadControl.Builder builder = new DefaultLoadControl.Builder();
|
||||
builder.setBufferDurationsMs(minimumPlaybackbufferMs, optimalPlaybackBufferMs,
|
||||
initialPlaybackBufferMs, initialPlaybackBufferMs);
|
||||
internalLoadControl = builder.createDefaultLoadControl();
|
||||
|
|
|
|||
|
|
@ -62,7 +62,7 @@ public class MediaSessionManager {
|
|||
.build()
|
||||
);
|
||||
|
||||
MediaStyle mediaStyle = new MediaStyle()
|
||||
final MediaStyle mediaStyle = new MediaStyle()
|
||||
.setMediaSession(mediaSession.getSessionToken());
|
||||
|
||||
builder.setStyle(mediaStyle);
|
||||
|
|
@ -76,7 +76,7 @@ public class MediaSessionManager {
|
|||
.build()
|
||||
);
|
||||
|
||||
MediaStyle mediaStyle = new MediaStyle()
|
||||
final MediaStyle mediaStyle = new MediaStyle()
|
||||
.setMediaSession(mediaSession.getSessionToken());
|
||||
|
||||
builder.setStyle(mediaStyle);
|
||||
|
|
|
|||
|
|
@ -94,7 +94,7 @@ public class PlaybackParameterDialog extends DialogFragment {
|
|||
final double playbackPitch,
|
||||
final boolean playbackSkipSilence,
|
||||
final Callback callback) {
|
||||
PlaybackParameterDialog dialog = new PlaybackParameterDialog();
|
||||
final PlaybackParameterDialog dialog = new PlaybackParameterDialog();
|
||||
dialog.callback = callback;
|
||||
dialog.initialTempo = playbackTempo;
|
||||
dialog.initialPitch = playbackPitch;
|
||||
|
|
@ -187,8 +187,8 @@ public class PlaybackParameterDialog extends DialogFragment {
|
|||
|
||||
private void setupTempoControl(@NonNull final View rootView) {
|
||||
tempoSlider = rootView.findViewById(R.id.tempoSeekbar);
|
||||
TextView tempoMinimumText = rootView.findViewById(R.id.tempoMinimumText);
|
||||
TextView tempoMaximumText = rootView.findViewById(R.id.tempoMaximumText);
|
||||
final TextView tempoMinimumText = rootView.findViewById(R.id.tempoMinimumText);
|
||||
final TextView tempoMaximumText = rootView.findViewById(R.id.tempoMaximumText);
|
||||
tempoCurrentText = rootView.findViewById(R.id.tempoCurrentText);
|
||||
tempoStepUpText = rootView.findViewById(R.id.tempoStepUp);
|
||||
tempoStepDownText = rootView.findViewById(R.id.tempoStepDown);
|
||||
|
|
@ -212,8 +212,8 @@ public class PlaybackParameterDialog extends DialogFragment {
|
|||
|
||||
private void setupPitchControl(@NonNull final View rootView) {
|
||||
pitchSlider = rootView.findViewById(R.id.pitchSeekbar);
|
||||
TextView pitchMinimumText = rootView.findViewById(R.id.pitchMinimumText);
|
||||
TextView pitchMaximumText = rootView.findViewById(R.id.pitchMaximumText);
|
||||
final TextView pitchMinimumText = rootView.findViewById(R.id.pitchMinimumText);
|
||||
final TextView pitchMaximumText = rootView.findViewById(R.id.pitchMaximumText);
|
||||
pitchCurrentText = rootView.findViewById(R.id.pitchCurrentText);
|
||||
pitchStepDownText = rootView.findViewById(R.id.pitchStepDown);
|
||||
pitchStepUpText = rootView.findViewById(R.id.pitchStepUp);
|
||||
|
|
@ -269,12 +269,12 @@ public class PlaybackParameterDialog extends DialogFragment {
|
|||
}
|
||||
|
||||
private void setupStepSizeSelector(@NonNull final View rootView) {
|
||||
TextView stepSizeOnePercentText = rootView.findViewById(R.id.stepSizeOnePercent);
|
||||
TextView stepSizeFivePercentText = rootView.findViewById(R.id.stepSizeFivePercent);
|
||||
TextView stepSizeTenPercentText = rootView.findViewById(R.id.stepSizeTenPercent);
|
||||
TextView stepSizeTwentyFivePercentText = rootView
|
||||
final TextView stepSizeOnePercentText = rootView.findViewById(R.id.stepSizeOnePercent);
|
||||
final TextView stepSizeFivePercentText = rootView.findViewById(R.id.stepSizeFivePercent);
|
||||
final TextView stepSizeTenPercentText = rootView.findViewById(R.id.stepSizeTenPercent);
|
||||
final TextView stepSizeTwentyFivePercentText = rootView
|
||||
.findViewById(R.id.stepSizeTwentyFivePercent);
|
||||
TextView stepSizeOneHundredPercentText = rootView
|
||||
final TextView stepSizeOneHundredPercentText = rootView
|
||||
.findViewById(R.id.stepSizeOneHundredPercent);
|
||||
|
||||
if (stepSizeOnePercentText != null) {
|
||||
|
|
|
|||
|
|
@ -76,10 +76,10 @@ public final class PlayerHelper {
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
public static String getTimeString(final int milliSeconds) {
|
||||
int seconds = (milliSeconds % 60000) / 1000;
|
||||
int minutes = (milliSeconds % 3600000) / 60000;
|
||||
int hours = (milliSeconds % 86400000) / 3600000;
|
||||
int days = (milliSeconds % (86400000 * 7)) / 86400000;
|
||||
final int seconds = (milliSeconds % 60000) / 1000;
|
||||
final int minutes = (milliSeconds % 3600000) / 60000;
|
||||
final int hours = (milliSeconds % 86400000) / 3600000;
|
||||
final int days = (milliSeconds % (86400000 * 7)) / 86400000;
|
||||
|
||||
STRING_BUILDER.setLength(0);
|
||||
return days > 0
|
||||
|
|
@ -405,7 +405,7 @@ public final class PlayerHelper {
|
|||
|
||||
private static void setScreenBrightness(@NonNull final Context context,
|
||||
final float screenBrightness, final long timestamp) {
|
||||
SharedPreferences.Editor editor = getPreferences(context).edit();
|
||||
final SharedPreferences.Editor editor = getPreferences(context).edit();
|
||||
editor.putFloat(context.getString(R.string.screen_brightness_key), screenBrightness);
|
||||
editor.putLong(context.getString(R.string.screen_brightness_timestamp_key), timestamp);
|
||||
editor.apply();
|
||||
|
|
@ -413,8 +413,8 @@ public final class PlayerHelper {
|
|||
|
||||
private static float getScreenBrightness(@NonNull final Context context,
|
||||
final float screenBrightness) {
|
||||
SharedPreferences sp = getPreferences(context);
|
||||
long timestamp = sp
|
||||
final SharedPreferences sp = getPreferences(context);
|
||||
final long timestamp = sp
|
||||
.getLong(context.getString(R.string.screen_brightness_timestamp_key), 0);
|
||||
// Hypothesis: 4h covers a viewing block, e.g. evening.
|
||||
// External lightning conditions will change in the next
|
||||
|
|
@ -441,7 +441,7 @@ public final class PlayerHelper {
|
|||
|
||||
private static SinglePlayQueue getAutoQueuedSinglePlayQueue(
|
||||
final StreamInfoItem streamInfoItem) {
|
||||
SinglePlayQueue singlePlayQueue = new SinglePlayQueue(streamInfoItem);
|
||||
final SinglePlayQueue singlePlayQueue = new SinglePlayQueue(streamInfoItem);
|
||||
singlePlayQueue.getItem().setAutoQueued(true);
|
||||
return singlePlayQueue;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -87,13 +87,13 @@ public class PlayQueueNavigator implements MediaSessionConnector.QueueNavigator
|
|||
}
|
||||
|
||||
// Yes this is almost a copypasta, got a problem with that? =\
|
||||
int windowCount = callback.getQueueSize();
|
||||
int currentWindowIndex = callback.getCurrentPlayingIndex();
|
||||
int queueSize = Math.min(maxQueueSize, windowCount);
|
||||
int startIndex = Util.constrainValue(currentWindowIndex - ((queueSize - 1) / 2), 0,
|
||||
final int windowCount = callback.getQueueSize();
|
||||
final int currentWindowIndex = callback.getCurrentPlayingIndex();
|
||||
final int queueSize = Math.min(maxQueueSize, windowCount);
|
||||
final int startIndex = Util.constrainValue(currentWindowIndex - ((queueSize - 1) / 2), 0,
|
||||
windowCount - queueSize);
|
||||
|
||||
List<MediaSessionCompat.QueueItem> queue = new ArrayList<>();
|
||||
final List<MediaSessionCompat.QueueItem> queue = new ArrayList<>();
|
||||
for (int i = startIndex; i < startIndex + queueSize; i++) {
|
||||
queue.add(new MediaSessionCompat.QueueItem(callback.getQueueMetadata(i), i));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -57,13 +57,14 @@ public class BasePlayerMediaSession implements MediaSessionCallback {
|
|||
}
|
||||
|
||||
final PlayQueueItem item = player.getPlayQueue().getItem(index);
|
||||
MediaDescriptionCompat.Builder descriptionBuilder = new MediaDescriptionCompat.Builder()
|
||||
final MediaDescriptionCompat.Builder descriptionBuilder
|
||||
= new MediaDescriptionCompat.Builder()
|
||||
.setMediaId(String.valueOf(index))
|
||||
.setTitle(item.getTitle())
|
||||
.setSubtitle(item.getUploader());
|
||||
|
||||
// set additional metadata for A2DP/AVRCP
|
||||
Bundle additionalMetadata = new Bundle();
|
||||
final Bundle additionalMetadata = new Bundle();
|
||||
additionalMetadata.putString(MediaMetadataCompat.METADATA_KEY_TITLE, item.getTitle());
|
||||
additionalMetadata.putString(MediaMetadataCompat.METADATA_KEY_ARTIST, item.getUploader());
|
||||
additionalMetadata
|
||||
|
|
|
|||
|
|
@ -60,14 +60,14 @@ public class CustomTrackSelector extends DefaultTrackSelector {
|
|||
TextTrackScore selectedTrackScore = null;
|
||||
|
||||
for (int groupIndex = 0; groupIndex < groups.length; groupIndex++) {
|
||||
TrackGroup trackGroup = groups.get(groupIndex);
|
||||
@Capabilities int[] trackFormatSupport = formatSupport[groupIndex];
|
||||
final TrackGroup trackGroup = groups.get(groupIndex);
|
||||
@Capabilities final int[] trackFormatSupport = formatSupport[groupIndex];
|
||||
|
||||
for (int trackIndex = 0; trackIndex < trackGroup.length; trackIndex++) {
|
||||
if (isSupported(trackFormatSupport[trackIndex],
|
||||
params.exceedRendererCapabilitiesIfNecessary)) {
|
||||
Format format = trackGroup.getFormat(trackIndex);
|
||||
TextTrackScore trackScore = new TextTrackScore(format, params,
|
||||
final Format format = trackGroup.getFormat(trackIndex);
|
||||
final TextTrackScore trackScore = new TextTrackScore(format, params,
|
||||
trackFormatSupport[trackIndex], selectedAudioLanguage);
|
||||
|
||||
if (formatHasLanguage(format, preferredTextLanguage)) {
|
||||
|
|
|
|||
|
|
@ -129,7 +129,7 @@ abstract class AbstractInfoPlayQueue<T extends ListInfo, U extends InfoItem> ext
|
|||
}
|
||||
|
||||
private static List<PlayQueueItem> extractListItems(final List<StreamInfoItem> infos) {
|
||||
List<PlayQueueItem> result = new ArrayList<>();
|
||||
final List<PlayQueueItem> result = new ArrayList<>();
|
||||
for (final InfoItem stream : infos) {
|
||||
if (stream instanceof StreamInfoItem) {
|
||||
result.add(new PlayQueueItem((StreamInfoItem) stream));
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public final class SinglePlayQueue extends PlayQueue {
|
|||
}
|
||||
|
||||
private static List<PlayQueueItem> playQueueItemsOf(final List<StreamInfoItem> items) {
|
||||
List<PlayQueueItem> playQueueItems = new ArrayList<>(items.size());
|
||||
final List<PlayQueueItem> playQueueItems = new ArrayList<>(items.size());
|
||||
for (final StreamInfoItem item : items) {
|
||||
playQueueItems.add(new PlayQueueItem(item));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -52,7 +52,7 @@ public class VideoPlaybackResolver implements PlaybackResolver {
|
|||
return liveSource;
|
||||
}
|
||||
|
||||
List<MediaSource> mediaSources = new ArrayList<>();
|
||||
final List<MediaSource> mediaSources = new ArrayList<>();
|
||||
|
||||
// Create video stream source
|
||||
final List<VideoStream> videos = ListHelper.getSortedStreamVideosList(context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue