1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-10-22 02:47:38 +00:00

-Added helper text on click for background and popup button on detail fragment for feature discovery.

-Fixed popup video queuing causes existing popup player to change quality.
This commit is contained in:
John Zhen Mo
2017-10-14 14:09:49 -07:00
parent a8f5cfa640
commit d54a6e0b0e
8 changed files with 383 additions and 363 deletions

View File

@@ -28,6 +28,7 @@ import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
@@ -144,6 +145,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
private TextView detailControlsBackground;
private TextView detailControlsPopup;
private TextView appendControlsDetail;
private LinearLayout videoDescriptionRootLayout;
private TextView videoUploadDateView;
@@ -419,6 +421,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
detailControlsBackground = rootView.findViewById(R.id.detail_controls_background);
detailControlsPopup = rootView.findViewById(R.id.detail_controls_popup);
appendControlsDetail = rootView.findViewById(R.id.touch_append_detail);
videoDescriptionRootLayout = rootView.findViewById(R.id.detail_description_root_layout);
videoUploadDateView = rootView.findViewById(R.id.detail_upload_date_view);
@@ -469,6 +472,22 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
detailControlsPopup.setLongClickable(true);
detailControlsBackground.setOnLongClickListener(this);
detailControlsPopup.setOnLongClickListener(this);
detailControlsBackground.setOnTouchListener(getOnControlsTouchListener());
detailControlsPopup.setOnTouchListener(getOnControlsTouchListener());
}
private View.OnTouchListener getOnControlsTouchListener() {
return new View.OnTouchListener() {
@Override
public boolean onTouch(View view, MotionEvent motionEvent) {
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
appendControlsDetail.setVisibility(View.VISIBLE);
} else {
appendControlsDetail.setVisibility(View.GONE);
}
return false;
}
};
}
private void initThumbnailViews(StreamInfo info) {

View File

@@ -289,9 +289,7 @@ public final class BackgroundPlayer extends Service {
}
@Override
public void handleIntent(Intent intent) {
super.handleIntent(intent);
protected void postProcess(@NonNull final Intent intent) {
resetNotification();
startForeground(NOTIFICATION_ID, notBuilder.build());

View File

@@ -251,6 +251,8 @@ public abstract class BasePlayer implements Player.EventListener,
});
}
protected abstract void postProcess(@NonNull final Intent intent);
public void handleIntent(Intent intent) {
if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]");
if (intent == null) return;
@@ -284,6 +286,7 @@ public abstract class BasePlayer implements Player.EventListener,
// Good to go...
initPlayback(this, queue);
postProcess(intent);
}
protected void initPlayback(@NonNull final PlaybackListener listener, @NonNull final PlayQueue queue) {

View File

@@ -270,11 +270,7 @@ public final class MainVideoPlayer extends Activity {
@Override
public int getPreferredResolution() {
if (sharedPreferences == null || context == null) return Integer.MAX_VALUE;
return Localization.resolutionOf(sharedPreferences.getString(
context.getString(R.string.default_resolution_key),
context.getString(R.string.default_resolution_value)
));
return Localization.resolutionOf(sharedPreferences.getString(context.getString(R.string.default_resolution_key), context.getString(R.string.default_resolution_value)));
}
/*//////////////////////////////////////////////////////////////////////////

View File

@@ -411,10 +411,7 @@ public final class PopupVideoPlayer extends Service {
@Override
public int getPreferredResolution() {
if (sharedPreferences == null || context == null) return Integer.MAX_VALUE;
return Localization.resolutionOf(sharedPreferences.getString(
context.getString(R.string.default_popup_resolution_key),
context.getString(R.string.default_popup_resolution_value)
));
return Localization.resolutionOf(sharedPreferences.getString(context.getString(R.string.default_popup_resolution_key), context.getString(R.string.default_popup_resolution_value)));
}
@Override

View File

@@ -217,11 +217,7 @@ public abstract class VideoPlayer extends BasePlayer implements SimpleExoPlayer.
}
@Override
@SuppressWarnings("unchecked")
public void handleIntent(Intent intent) {
super.handleIntent(intent);
if (intent == null) return;
protected void postProcess(@NonNull final Intent intent) {
final int resolutionTarget = intent.getIntExtra(MAX_RESOLUTION, getPreferredResolution());
trackSelector.setParameters(
// Assume video is horizontal