-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.Menu;
import android.view.MenuInflater; import android.view.MenuInflater;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View; import android.view.View;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.widget.FrameLayout; import android.widget.FrameLayout;
@ -144,6 +145,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
private TextView detailControlsBackground; private TextView detailControlsBackground;
private TextView detailControlsPopup; private TextView detailControlsPopup;
private TextView appendControlsDetail;
private LinearLayout videoDescriptionRootLayout; private LinearLayout videoDescriptionRootLayout;
private TextView videoUploadDateView; private TextView videoUploadDateView;
@ -419,6 +421,7 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
detailControlsBackground = rootView.findViewById(R.id.detail_controls_background); detailControlsBackground = rootView.findViewById(R.id.detail_controls_background);
detailControlsPopup = rootView.findViewById(R.id.detail_controls_popup); 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); videoDescriptionRootLayout = rootView.findViewById(R.id.detail_description_root_layout);
videoUploadDateView = rootView.findViewById(R.id.detail_upload_date_view); videoUploadDateView = rootView.findViewById(R.id.detail_upload_date_view);
@ -469,6 +472,22 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
detailControlsPopup.setLongClickable(true); detailControlsPopup.setLongClickable(true);
detailControlsBackground.setOnLongClickListener(this); detailControlsBackground.setOnLongClickListener(this);
detailControlsPopup.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) { private void initThumbnailViews(StreamInfo info) {

View File

@ -289,9 +289,7 @@ public final class BackgroundPlayer extends Service {
} }
@Override @Override
public void handleIntent(Intent intent) { protected void postProcess(@NonNull final Intent intent) {
super.handleIntent(intent);
resetNotification(); resetNotification();
startForeground(NOTIFICATION_ID, notBuilder.build()); 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) { public void handleIntent(Intent intent) {
if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]"); if (DEBUG) Log.d(TAG, "handleIntent() called with: intent = [" + intent + "]");
if (intent == null) return; if (intent == null) return;
@ -284,6 +286,7 @@ public abstract class BasePlayer implements Player.EventListener,
// Good to go... // Good to go...
initPlayback(this, queue); initPlayback(this, queue);
postProcess(intent);
} }
protected void initPlayback(@NonNull final PlaybackListener listener, @NonNull final PlayQueue queue) { protected void initPlayback(@NonNull final PlaybackListener listener, @NonNull final PlayQueue queue) {

View File

@ -270,11 +270,7 @@ public final class MainVideoPlayer extends Activity {
@Override @Override
public int getPreferredResolution() { public int getPreferredResolution() {
if (sharedPreferences == null || context == null) return Integer.MAX_VALUE; 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 @Override
public int getPreferredResolution() { public int getPreferredResolution() {
if (sharedPreferences == null || context == null) return Integer.MAX_VALUE; if (sharedPreferences == null || context == null) return Integer.MAX_VALUE;
return Localization.resolutionOf(sharedPreferences.getString( return Localization.resolutionOf(sharedPreferences.getString(context.getString(R.string.default_popup_resolution_key), context.getString(R.string.default_popup_resolution_value)));
context.getString(R.string.default_popup_resolution_key),
context.getString(R.string.default_popup_resolution_value)
));
} }
@Override @Override

View File

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

View File

@ -1,13 +1,9 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android" xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_item_detail" android:id="@+id/video_item_detail"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:focusableInTouchMode="true"> android:focusableInTouchMode="true">
@ -32,6 +28,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="@android:color/black" android:background="@android:color/black"
android:clickable="true" android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"> android:foreground="?attr/selectableItemBackground">
<ImageView <ImageView
@ -56,6 +53,23 @@
tools:ignore="ContentDescription" tools:ignore="ContentDescription"
tools:visibility="visible"/> tools:visibility="visible"/>
<TextView
android:id="@+id/touch_append_detail"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#64000000"
android:paddingBottom="10dp"
android:paddingLeft="30dp"
android:paddingRight="30dp"
android:paddingTop="10dp"
android:layout_gravity="center"
android:textColor="@android:color/white"
android:textSize="26sp"
android:textStyle="bold"
android:text="@string/hold_to_append"
android:visibility="gone"
tools:ignore="RtlHardcoded"
tools:visibility="visible"/>
</FrameLayout> </FrameLayout>
<!-- CONTENT --> <!-- CONTENT -->
@ -72,6 +86,7 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground" android:background="?attr/selectableItemBackground"
android:clickable="true" android:clickable="true"
android:focusable="true"
android:paddingLeft="12dp" android:paddingLeft="12dp"
android:paddingRight="12dp"> android:paddingRight="12dp">
@ -227,10 +242,12 @@
android:layout_width="80dp" android:layout_width="80dp"
android:layout_height="55dp" android:layout_height="55dp"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
android:focusable="true"
android:contentDescription="@string/open_in_popup_mode" android:contentDescription="@string/open_in_popup_mode"
android:drawableTop="?attr/popup" android:drawableTop="?attr/popup"
android:gravity="center" android:gravity="center"
@ -246,8 +263,10 @@
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_gravity="center_vertical" android:layout_gravity="center_vertical"
android:layout_toLeftOf="@id/detail_controls_popup" android:layout_toLeftOf="@id/detail_controls_popup"
android:layout_toStartOf="@id/detail_controls_popup"
android:background="?attr/selectableItemBackgroundBorderless" android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true" android:clickable="true"
android:focusable="true"
android:contentDescription="@string/play_audio" android:contentDescription="@string/play_audio"
android:drawableTop="?attr/audio" android:drawableTop="?attr/audio"
android:gravity="center" android:gravity="center"
@ -399,11 +418,3 @@
</LinearLayout> </LinearLayout>
</com.nirhart.parallaxscroll.views.ParallaxScrollView> </com.nirhart.parallaxscroll.views.ParallaxScrollView>
</FrameLayout> </FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="?attr/toolbar_shadow_drawable"
android:layout_alignParentTop="true"/>
</RelativeLayout>

View File

@ -301,5 +301,5 @@
<string name="play_queue_remove">Remove</string> <string name="play_queue_remove">Remove</string>
<string name="play_queue_stream_detail">Details</string> <string name="play_queue_stream_detail">Details</string>
<string name="play_queue_audio_settings">Audio Settings</string> <string name="play_queue_audio_settings">Audio Settings</string>
<string name="hold_to_append">Hold To Append</string>
</resources> </resources>