-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

View File

@ -1,13 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
<FrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/video_item_detail"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:focusableInTouchMode="true">
@ -32,6 +28,7 @@
android:layout_height="wrap_content"
android:background="@android:color/black"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground">
<ImageView
@ -56,6 +53,23 @@
tools:ignore="ContentDescription"
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>
<!-- CONTENT -->
@ -72,6 +86,7 @@
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingLeft="12dp"
android:paddingRight="12dp">
@ -227,10 +242,12 @@
android:layout_width="80dp"
android:layout_height="55dp"
android:layout_alignParentRight="true"
android:layout_alignParentEnd="true"
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/open_in_popup_mode"
android:drawableTop="?attr/popup"
android:gravity="center"
@ -246,8 +263,10 @@
android:layout_alignParentTop="true"
android:layout_gravity="center_vertical"
android:layout_toLeftOf="@id/detail_controls_popup"
android:layout_toStartOf="@id/detail_controls_popup"
android:background="?attr/selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:contentDescription="@string/play_audio"
android:drawableTop="?attr/audio"
android:gravity="center"
@ -399,11 +418,3 @@
</LinearLayout>
</com.nirhart.parallaxscroll.views.ParallaxScrollView>
</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_stream_detail">Details</string>
<string name="play_queue_audio_settings">Audio Settings</string>
<string name="hold_to_append">Hold To Append</string>
</resources>