-Modified selected play queue item to highlight entire item instead of text.

-Added selected item bullet.
-Modified play queue panel darker on main video player.
-Fixed color issue on play queue panel on light-themed main video player.
-Fixed hold-to-enqueue tooltip flashing when clicked on earlier sdk versions.
-Fixed queue item removal causing metadata for currently playing to refresh.
This commit is contained in:
John Zhen Mo 2017-10-30 20:58:02 -07:00
parent 86c16fa5d8
commit b0948cf9fc
23 changed files with 65 additions and 29 deletions

View file

@ -483,9 +483,12 @@ public class VideoDetailFragment extends BaseStateFragment<StreamInfo> implement
if (!PreferenceManager.getDefaultSharedPreferences(activity).getBoolean(getString(R.string.show_hold_to_append_key), true)) return false;
if (motionEvent.getAction() == MotionEvent.ACTION_DOWN) {
appendControlsDetail.setVisibility(View.VISIBLE);
} else {
appendControlsDetail.setVisibility(View.GONE);
animateView(appendControlsDetail, true, 250, 0, new Runnable() {
@Override
public void run() {
animateView(appendControlsDetail, false, 1500, 1000);
}
});
}
return false;
}

View file

@ -178,7 +178,8 @@ public class MediaSourceManager {
case REMOVE:
final RemoveEvent removeEvent = (RemoveEvent) event;
remove(removeEvent.getRemoveIndex());
sync();
// Sync only when the currently playing is removed
if (removeEvent.getQueueIndex() == removeEvent.getRemoveIndex()) sync();
break;
case MOVE:
final MoveEvent moveEvent = (MoveEvent) event;

View file

@ -188,10 +188,15 @@ public class PlayQueueAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if(holder instanceof PlayQueueItemHolder) {
final PlayQueueItemHolder itemHolder = (PlayQueueItemHolder) holder;
// Build the list item
playQueueItemBuilder.buildStreamInfoItem((PlayQueueItemHolder) holder, playQueue.getStreams().get(position));
playQueueItemBuilder.buildStreamInfoItem(itemHolder, playQueue.getStreams().get(position));
// Check if the current item should be selected/highlighted
holder.itemView.setSelected(playQueue.getIndex() == position);
final boolean isSelected = playQueue.getIndex() == position;
itemHolder.itemSelected.setVisibility(isSelected ? View.VISIBLE : View.INVISIBLE);
itemHolder.itemView.setSelected(isSelected);
} else if(holder instanceof HFHolder && position == playQueue.getStreams().size() && footer != null && showFooter) {
((HFHolder) holder).view = footer;
}

View file

@ -32,7 +32,7 @@ import org.schabi.newpipe.info_list.holder.InfoItemHolder;
public class PlayQueueItemHolder extends RecyclerView.ViewHolder {
public final TextView itemVideoTitleView, itemDurationView, itemAdditionalDetailsView;
public final ImageView itemThumbnailView, itemHandle;
public final ImageView itemSelected, itemThumbnailView, itemHandle;
public final View itemRoot;
@ -42,6 +42,7 @@ public class PlayQueueItemHolder extends RecyclerView.ViewHolder {
itemVideoTitleView = v.findViewById(R.id.itemVideoTitleView);
itemDurationView = v.findViewById(R.id.itemDurationView);
itemAdditionalDetailsView = v.findViewById(R.id.itemAdditionalDetails);
itemSelected = v.findViewById(R.id.itemSelected);
itemThumbnailView = v.findViewById(R.id.itemThumbnailView);
itemHandle = v.findViewById(R.id.itemHandle);
}

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/dark_youtube_primary_color"/>
<item android:color="@color/dark_youtube_accent_color"/>
</selector>

View file

@ -1,5 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:color="@color/light_youtube_primary_color"/>
<item android:color="@color/light_youtube_accent_color"/>
</selector>

Binary file not shown.

After

Width:  |  Height:  |  Size: 256 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 252 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 184 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 181 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 335 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 328 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 468 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 461 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 618 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 614 B

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@color/selected_background_color"/>
<item android:drawable="@color/transparent_background_color"/>
</selector>

View file

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_selected="true" android:drawable="@color/selected_background_color"/>
<item android:drawable="@color/transparent_background_color"/>
</selector>

View file

@ -46,8 +46,8 @@
android:id="@+id/playQueuePanel"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#64000000"
android:visibility="gone"
android:background="?attr/queue_background_color"
tools:visibility="visible">
<RelativeLayout
@ -68,6 +68,7 @@
android:clickable="true"
android:focusable="true"
android:scaleType="fitXY"
android:tint="?attr/colorAccent"
android:src="@drawable/ic_close_white_24dp"
android:background="?android:selectableItemBackground"
tools:ignore="ContentDescription"/>
@ -85,6 +86,7 @@
android:clickable="true"
android:focusable="true"
android:scaleType="fitXY"
android:tint="?attr/colorAccent"
android:src="@drawable/exo_controls_repeat_off"
android:background="?android:selectableItemBackground"
tools:ignore="ContentDescription,RtlHardcoded"/>
@ -99,6 +101,7 @@
android:clickable="true"
android:focusable="true"
android:scaleType="fitXY"
android:tint="?attr/colorAccent"
android:src="@drawable/ic_shuffle_white_24dp"
android:background="?android:selectableItemBackground"
tools:ignore="ContentDescription,RtlHardcoded"/>

View file

@ -5,17 +5,32 @@
android:id="@+id/itemRoot"
android:layout_width="match_parent"
android:layout_height="48dp"
android:background="?attr/selectableItemBackground"
android:foreground="?attr/selectableItemBackground"
android:background="?attr/selector_drawable"
android:clickable="true"
android:focusable="true"
android:padding="6dp">
android:paddingTop="6dp"
android:paddingBottom="6dp">
<ImageView
android:id="@+id/itemSelected"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_centerInParent="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:scaleType="fitXY"
android:src="?attr/selected"
tools:ignore="ContentDescription,RtlHardcoded"/>
<ImageView
android:id="@+id/itemThumbnailView"
android:layout_width="@dimen/play_queue_thumbnail_width"
android:layout_height="@dimen/play_queue_thumbnail_height"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"
android:layout_toRightOf="@+id/itemSelected"
android:layout_toEndOf="@+id/itemSelected"
android:layout_alignParentTop="true"
android:layout_marginRight="@dimen/video_item_search_image_right_margin"
android:contentDescription="@string/list_thumbnail_view_description"
@ -29,8 +44,7 @@
android:layout_height="match_parent"
android:layout_gravity="center_vertical"
android:layout_alignParentRight="true"
android:layout_marginLeft="10dp"
android:layout_marginRight="5dp"
android:padding="@dimen/video_item_search_image_right_margin"
android:scaleType="center"
android:src="?attr/drag_handle"
tools:ignore="ContentDescription,RtlHardcoded"/>
@ -69,7 +83,6 @@
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_search_title_text_size"
android:textColor="?attr/selector_color"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. "/>
<TextView
@ -84,7 +97,6 @@
android:lines="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="@dimen/video_item_search_upload_date_text_size"
android:textColor="?attr/selector_color"
tools:text="Uploader"/>
</RelativeLayout>

View file

@ -19,11 +19,13 @@
<attr name="language" format="reference"/>
<attr name="history" format="reference"/>
<attr name="drag_handle" format="reference"/>
<attr name="selected" format="reference"/>
<!-- Can't refer to colors directly into drawable's xml-->
<attr name="toolbar_shadow_drawable" format="reference"/>
<attr name="selector_drawable" format="reference"/>
<attr name="selector_color" format="color"/>
<attr name="separator_color" format="color"/>
<attr name="queue_background_color" format="color"/>
<attr name="contrast_background_color" format="color"/>
</resources>

View file

@ -12,6 +12,7 @@
<color name="light_shadow_start_color">#5a000000</color>
<color name="light_license_background_color">#ffffff</color>
<color name="light_license_text_color">#212121</color>
<color name="light_queue_background_color">#c8ffffff</color>
<!-- Dark Theme -->
<color name="dark_background_color">#222222</color>
@ -24,6 +25,7 @@
<color name="dark_shadow_start_color">#82000000</color>
<color name="dark_license_background_color">#424242</color>
<color name="dark_license_text_color">#ffffff</color>
<color name="dark_queue_background_color">#af000000</color>
<!-- Black Theme -->
<color name="black_background_color">#000</color>
@ -44,6 +46,9 @@
<color name="subscribed_background_color">#d6d6d6</color>
<color name="subscribed_text_color">#717171</color>
<color name="transparent_background_color">#00000000</color>
<color name="selected_background_color">#96717171</color>
<!-- GigaGet theme -->
<color name="bluegray">#607D8B</color>

View file

@ -26,11 +26,13 @@
<item name="language">@drawable/ic_language_black_24dp</item>
<item name="history">@drawable/ic_history_black_24dp</item>
<item name="drag_handle">@drawable/ic_drag_handle_black_24dp</item>
<item name="selected">@drawable/ic_fiber_manual_record_black_24dp</item>
<item name="selector_color">@color/light_selector</item>
<item name="separator_color">@color/light_separator_color</item>
<item name="contrast_background_color">@color/light_contrast_background_color</item>
<item name="queue_background_color">@color/light_queue_background_color</item>
<item name="toolbar_shadow_drawable">@drawable/toolbar_shadow_light</item>
<item name="selector_drawable">@drawable/light_selector</item>
<item name="colorControlHighlight">@color/light_ripple_color</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>
@ -62,11 +64,13 @@
<item name="language">@drawable/ic_language_white_24dp</item>
<item name="history">@drawable/ic_history_white_24dp</item>
<item name="drag_handle">@drawable/ic_drag_handle_white_24dp</item>
<item name="selected">@drawable/ic_fiber_manual_record_white_24dp</item>
<item name="selector_color">@color/dark_selector</item>
<item name="separator_color">@color/dark_separator_color</item>
<item name="contrast_background_color">@color/dark_contrast_background_color</item>
<item name="queue_background_color">@color/dark_queue_background_color</item>
<item name="toolbar_shadow_drawable">@drawable/toolbar_shadow_dark</item>
<item name="selector_drawable">@drawable/dark_selector</item>
<item name="colorControlHighlight">@color/dark_ripple_color</item>
<item name="preferenceTheme">@style/PreferenceThemeOverlay.v14.Material</item>