parent
e8b71e867c
commit
40213b2d6a
2 changed files with 31 additions and 27 deletions
|
@ -67,12 +67,12 @@ class ActionBarHandler {
|
||||||
|
|
||||||
public void setupStreamList(final List<VideoStream> videoStreams, Spinner toolbarSpinner) {
|
public void setupStreamList(final List<VideoStream> videoStreams, Spinner toolbarSpinner) {
|
||||||
if (activity == null) return;
|
if (activity == null) return;
|
||||||
selectedVideoStream = 0;
|
|
||||||
|
|
||||||
int defaultResolutionIndex = Utils.getDefaultResolution(activity, videoStreams);
|
selectedVideoStream = Utils.getDefaultResolution(activity, videoStreams);
|
||||||
|
|
||||||
boolean isExternalPlayerEnabled = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(activity.getString(R.string.use_external_video_player_key), false);
|
boolean isExternalPlayerEnabled = PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(activity.getString(R.string.use_external_video_player_key), false);
|
||||||
toolbarSpinner.setAdapter(new SpinnerToolbarAdapter(activity, videoStreams, isExternalPlayerEnabled));
|
toolbarSpinner.setAdapter(new SpinnerToolbarAdapter(activity, videoStreams, isExternalPlayerEnabled));
|
||||||
toolbarSpinner.setSelection(defaultResolutionIndex);
|
toolbarSpinner.setSelection(selectedVideoStream);
|
||||||
toolbarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
toolbarSpinner.setOnItemSelectedListener(new AdapterView.OnItemSelectedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
public void onItemSelected(AdapterView<?> parent, View view, int position, long id) {
|
||||||
|
|
|
@ -111,6 +111,10 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
private boolean showRelatedStreams;
|
private boolean showRelatedStreams;
|
||||||
private boolean wasRelatedStreamsExpanded = false;
|
private boolean wasRelatedStreamsExpanded = false;
|
||||||
|
|
||||||
|
private Handler uiHandler;
|
||||||
|
private Handler backgroundHandler;
|
||||||
|
private HandlerThread backgroundHandlerThread;
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Views
|
// Views
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -150,9 +154,6 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
private LinearLayout relatedStreamRootLayout;
|
private LinearLayout relatedStreamRootLayout;
|
||||||
private LinearLayout relatedStreamsView;
|
private LinearLayout relatedStreamsView;
|
||||||
private ImageButton relatedStreamExpandButton;
|
private ImageButton relatedStreamExpandButton;
|
||||||
private Handler uiHandler;
|
|
||||||
private Handler backgroundHandler;
|
|
||||||
private HandlerThread backgroundHandlerThread;
|
|
||||||
|
|
||||||
/*////////////////////////////////////////////////////////////////////////*/
|
/*////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
|
@ -619,7 +620,6 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
// Menu
|
// Menu
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
@ -940,10 +940,16 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
setTitleToUrl(info.webpage_url, info.title);
|
setTitleToUrl(info.webpage_url, info.title);
|
||||||
setStreamInfoToUrl(info.webpage_url, info);
|
setStreamInfoToUrl(info.webpage_url, info);
|
||||||
|
|
||||||
|
|
||||||
prepareDescription(info.description);
|
prepareDescription(info.description);
|
||||||
prepareUploadDate(info.upload_date);
|
prepareUploadDate(info.upload_date);
|
||||||
|
|
||||||
|
if (autoPlayEnabled) {
|
||||||
|
playVideo(info);
|
||||||
|
// Only auto play in the first open
|
||||||
|
autoPlayEnabled = false;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void prepareUploadDate(final String uploadDate) {
|
private void prepareUploadDate(final String uploadDate) {
|
||||||
// Hide until date is prepared or forever if no date is supplied
|
// Hide until date is prepared or forever if no date is supplied
|
||||||
videoUploadDateView.setVisibility(View.GONE);
|
videoUploadDateView.setVisibility(View.GONE);
|
||||||
|
@ -1076,9 +1082,6 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
.setStartDelay((long) (duration * .8f) + delay).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).start();
|
.setStartDelay((long) (duration * .8f) + delay).setDuration(duration).setInterpolator(new FastOutSlowInInterpolator()).start();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
/*//////////////////////////////////////////////////////////////////////////
|
|
||||||
// OnStreamInfoReceivedListener callbacks
|
|
||||||
//////////////////////////////////////////////////////////////////////////*/
|
|
||||||
|
|
||||||
private void setErrorImage(final int imageResource) {
|
private void setErrorImage(final int imageResource) {
|
||||||
if (thumbnailImageView == null || activity == null) return;
|
if (thumbnailImageView == null || activity == null) return;
|
||||||
|
@ -1099,6 +1102,10 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
currentStreamInfo = null;
|
currentStreamInfo = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
// OnStreamInfoReceivedListener callbacks
|
||||||
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onReceive(StreamInfo info) {
|
public void onReceive(StreamInfo info) {
|
||||||
if (DEBUG) Log.d(TAG, "onReceive() called with: info = [" + info + "]");
|
if (DEBUG) Log.d(TAG, "onReceive() called with: info = [" + info + "]");
|
||||||
|
@ -1106,15 +1113,8 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
|
|
||||||
handleStreamInfo(info, true);
|
handleStreamInfo(info, true);
|
||||||
showContentWithAnimation(300, 0, 0);
|
showContentWithAnimation(300, 0, 0);
|
||||||
|
|
||||||
animateView(loadingProgressBar, false, 200);
|
animateView(loadingProgressBar, false, 200);
|
||||||
|
|
||||||
if (autoPlayEnabled) {
|
|
||||||
playVideo(info);
|
|
||||||
// Only auto play in the first open
|
|
||||||
autoPlayEnabled = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
StreamInfoCache.getInstance().putInfo(info);
|
StreamInfoCache.getInstance().putInfo(info);
|
||||||
isLoading.set(false);
|
isLoading.set(false);
|
||||||
|
|
||||||
|
@ -1171,6 +1171,10 @@ public class VideoDetailFragment extends BaseFragment implements StreamExtractor
|
||||||
activity.finish();
|
activity.finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*//////////////////////////////////////////////////////////////////////////
|
||||||
|
// Background handling
|
||||||
|
//////////////////////////////////////////////////////////////////////////*/
|
||||||
|
|
||||||
private static class BackgroundCallback implements Handler.Callback {
|
private static class BackgroundCallback implements Handler.Callback {
|
||||||
private static final int MESSAGE_DESCRIPTION = 1;
|
private static final int MESSAGE_DESCRIPTION = 1;
|
||||||
public static final int MESSAGE_UPLOADER_DATE = 2;
|
public static final int MESSAGE_UPLOADER_DATE = 2;
|
||||||
|
|
Loading…
Reference in a new issue