Use constraint layout for play queue item

Also remove invalid ic_selected attribute
pull/6443/head
Stypox 2021-06-07 07:57:26 +02:00
rodzic f6bca68da2
commit a102fc9cad
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: 4BDF1B40A49FDD23
6 zmienionych plików z 56 dodań i 60 usunięć

Wyświetl plik

@ -294,8 +294,10 @@ class SubscriptionFragment : BaseStateFragment<SubscriptionState>() {
} }
private fun showLongTapDialog(selectedItem: ChannelInfoItem) { private fun showLongTapDialog(selectedItem: ChannelInfoItem) {
val commands = arrayOf(getString(R.string.share), getString(R.string.open_in_browser), val commands = arrayOf(
getString(R.string.unsubscribe)) getString(R.string.share), getString(R.string.open_in_browser),
getString(R.string.unsubscribe)
)
val actions = DialogInterface.OnClickListener { _, i -> val actions = DialogInterface.OnClickListener { _, i ->
when (i) { when (i) {

Wyświetl plik

@ -182,8 +182,10 @@ public class PlayQueueAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
return ITEM_VIEW_TYPE_ID; return ITEM_VIEW_TYPE_ID;
} }
@NonNull
@Override @Override
public RecyclerView.ViewHolder onCreateViewHolder(final ViewGroup parent, final int type) { public RecyclerView.ViewHolder onCreateViewHolder(@NonNull final ViewGroup parent,
final int type) {
switch (type) { switch (type) {
case FOOTER_VIEW_TYPE_ID: case FOOTER_VIEW_TYPE_ID:
return new HFHolder(footer); return new HFHolder(footer);
@ -197,7 +199,8 @@ public class PlayQueueAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
} }
@Override @Override
public void onBindViewHolder(final RecyclerView.ViewHolder holder, final int position) { public void onBindViewHolder(@NonNull final RecyclerView.ViewHolder holder,
final int position) {
if (holder instanceof PlayQueueItemHolder) { if (holder instanceof PlayQueueItemHolder) {
final PlayQueueItemHolder itemHolder = (PlayQueueItemHolder) holder; final PlayQueueItemHolder itemHolder = (PlayQueueItemHolder) holder;
@ -207,7 +210,6 @@ public class PlayQueueAdapter extends RecyclerView.Adapter<RecyclerView.ViewHold
// Check if the current item should be selected/highlighted // Check if the current item should be selected/highlighted
final boolean isSelected = playQueue.getIndex() == position; final boolean isSelected = playQueue.getIndex() == position;
itemHolder.itemSelected.setVisibility(isSelected ? View.VISIBLE : View.INVISIBLE);
itemHolder.itemView.setSelected(isSelected); itemHolder.itemView.setSelected(isSelected);
} else if (holder instanceof HFHolder && position == playQueue.getStreams().size() } else if (holder instanceof HFHolder && position == playQueue.getStreams().size()
&& footer != null && showFooter) { && footer != null && showFooter) {

Wyświetl plik

@ -37,7 +37,6 @@ public class PlayQueueItemHolder extends RecyclerView.ViewHolder {
public final TextView itemDurationView; public final TextView itemDurationView;
final TextView itemAdditionalDetailsView; final TextView itemAdditionalDetailsView;
final ImageView itemSelected;
public final ImageView itemThumbnailView; public final ImageView itemThumbnailView;
final ImageView itemHandle; final ImageView itemHandle;
@ -49,7 +48,6 @@ public class PlayQueueItemHolder extends RecyclerView.ViewHolder {
itemVideoTitleView = v.findViewById(R.id.itemVideoTitleView); itemVideoTitleView = v.findViewById(R.id.itemVideoTitleView);
itemDurationView = v.findViewById(R.id.itemDurationView); itemDurationView = v.findViewById(R.id.itemDurationView);
itemAdditionalDetailsView = v.findViewById(R.id.itemAdditionalDetails); itemAdditionalDetailsView = v.findViewById(R.id.itemAdditionalDetails);
itemSelected = v.findViewById(R.id.itemSelected);
itemThumbnailView = v.findViewById(R.id.itemThumbnailView); itemThumbnailView = v.findViewById(R.id.itemThumbnailView);
itemHandle = v.findViewById(R.id.itemHandle); itemHandle = v.findViewById(R.id.itemHandle);
} }

Wyświetl plik

@ -1,102 +1,99 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout 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/itemRoot" android:id="@+id/itemRoot"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="48dp" android:layout_height="wrap_content"
android:background="?attr/selector" android:background="?attr/selector"
android:clickable="true" android:clickable="true"
android:focusable="true" android:focusable="true"
android:foreground="?attr/selectableItemBackground" android:foreground="?attr/selectableItemBackground">
android:paddingTop="6dp"
android:paddingBottom="6dp">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/itemSelected"
android:layout_width="10dp"
android:layout_height="10dp"
android:layout_alignParentStart="true"
android:layout_alignParentLeft="true"
android:layout_centerInParent="true"
android:layout_marginLeft="2dp"
android:layout_marginRight="2dp"
android:scaleType="fitXY"
app:srcCompat="?attr/ic_selected"
tools:ignore="ContentDescription,RtlHardcoded" />
<ImageView <ImageView
android:id="@+id/itemThumbnailView" android:id="@+id/itemThumbnailView"
android:layout_width="@dimen/play_queue_thumbnail_width" android:layout_width="@dimen/play_queue_thumbnail_width"
android:layout_height="@dimen/play_queue_thumbnail_height" android:layout_height="@dimen/play_queue_thumbnail_height"
android:layout_alignParentTop="true" android:layout_marginStart="@dimen/video_item_search_image_right_margin"
android:layout_marginRight="@dimen/video_item_search_image_right_margin" android:layout_marginTop="@dimen/video_item_search_image_right_margin"
android:layout_toEndOf="@+id/itemSelected" android:layout_marginBottom="@dimen/video_item_search_image_right_margin"
android:layout_toRightOf="@+id/itemSelected"
android:contentDescription="@string/list_thumbnail_view_description" android:contentDescription="@string/list_thumbnail_view_description"
android:scaleType="centerCrop" android:scaleType="centerCrop"
android:src="@drawable/dummy_thumbnail" android:src="@drawable/dummy_thumbnail"
tools:ignore="RtlHardcoded" /> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
<androidx.appcompat.widget.AppCompatImageView app:layout_constraintTop_toTopOf="parent" />
android:id="@+id/itemHandle"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:padding="@dimen/video_item_search_image_right_margin"
android:scaleType="center"
app:srcCompat="@drawable/ic_drag_handle"
tools:ignore="ContentDescription,RtlHardcoded" />
<TextView <TextView
android:id="@+id/itemDurationView" android:id="@+id/itemDurationView"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignRight="@id/itemThumbnailView" android:layout_alignEnd="@id/itemThumbnailView"
android:layout_alignBottom="@id/itemThumbnailView" android:layout_alignBottom="@id/itemThumbnailView"
android:layout_marginRight="@dimen/video_item_search_duration_margin" android:layout_marginEnd="@dimen/video_item_search_duration_margin"
android:layout_marginBottom="@dimen/video_item_search_duration_margin" android:layout_marginBottom="@dimen/video_item_search_duration_margin"
android:background="@color/duration_background_color" android:background="@color/duration_background_color"
android:paddingLeft="@dimen/video_item_search_duration_horizontal_padding" android:paddingStart="@dimen/video_item_search_duration_horizontal_padding"
android:paddingTop="@dimen/video_item_search_duration_vertical_padding" android:paddingTop="@dimen/video_item_search_duration_vertical_padding"
android:paddingRight="@dimen/video_item_search_duration_horizontal_padding" android:paddingEnd="@dimen/video_item_search_duration_horizontal_padding"
android:paddingBottom="@dimen/video_item_search_duration_vertical_padding" android:paddingBottom="@dimen/video_item_search_duration_vertical_padding"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/duration_text_color" android:textColor="@color/duration_text_color"
android:textSize="@dimen/video_item_search_duration_text_size" android:textSize="@dimen/video_item_search_duration_text_size"
tools:ignore="RtlHardcoded" app:layout_constraintBottom_toBottomOf="@+id/itemThumbnailView"
app:layout_constraintEnd_toEndOf="@+id/itemThumbnailView"
tools:text="1:09:10" /> tools:text="1:09:10" />
<TextView <TextView
android:id="@+id/itemVideoTitleView" android:id="@+id/itemVideoTitleView"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentTop="true" android:layout_alignParentTop="true"
android:layout_marginStart="8dp"
android:layout_toStartOf="@id/itemHandle" android:layout_toStartOf="@id/itemHandle"
android:layout_toLeftOf="@id/itemHandle"
android:layout_toEndOf="@id/itemThumbnailView" android:layout_toEndOf="@id/itemThumbnailView"
android:layout_toRightOf="@id/itemThumbnailView"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceLarge" android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_search_title_text_size" android:textSize="@dimen/video_item_search_title_text_size"
tools:text="Lorem ipsum dolor sit amet, consectetur adipiscing elit. " /> app:layout_constraintBottom_toTopOf="@+id/itemAdditionalDetails"
app:layout_constraintEnd_toStartOf="@+id/itemHandle"
app:layout_constraintStart_toEndOf="@+id/itemThumbnailView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="Lorem ipsum dolor sit amet, consectetur adipisci elit. " />
<TextView <TextView
android:id="@+id/itemAdditionalDetails" android:id="@+id/itemAdditionalDetails"
android:layout_width="match_parent" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_alignParentBottom="true" android:layout_alignParentBottom="true"
android:layout_marginStart="8dp"
android:layout_toStartOf="@id/itemHandle" android:layout_toStartOf="@id/itemHandle"
android:layout_toLeftOf="@id/itemHandle"
android:layout_toEndOf="@id/itemThumbnailView" android:layout_toEndOf="@id/itemThumbnailView"
android:layout_toRightOf="@id/itemThumbnailView"
android:ellipsize="end" android:ellipsize="end"
android:singleLine="true" android:singleLine="true"
android:textAppearance="?android:attr/textAppearanceSmall" android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="@dimen/video_item_search_upload_date_text_size" android:textSize="@dimen/video_item_search_upload_date_text_size"
tools:text="Uploader" /> app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toStartOf="@+id/itemHandle"
app:layout_constraintStart_toEndOf="@+id/itemThumbnailView"
app:layout_constraintTop_toBottomOf="@+id/itemVideoTitleView"
tools:text="Uploader uploader uploader uploader uploader · Youtube" />
</RelativeLayout> <androidx.appcompat.widget.AppCompatImageView
android:id="@+id/itemHandle"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:paddingHorizontal="@dimen/video_item_search_image_right_margin"
android:scaleType="center"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@drawable/ic_drag_handle"
tools:ignore="ContentDescription,RtlHardcoded" />
</androidx.constraintlayout.widget.ConstraintLayout>

Wyświetl plik

@ -1,8 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<attr name="ic_selected" format="reference" />
<attr name="progress_horizontal_drawable" format="reference" /> <attr name="progress_horizontal_drawable" format="reference" />
<!-- Can't refer to colors directly in drawable's xml--> <!-- Can't refer to colors directly in drawable's xml-->
<attr name="toolbar_shadow" format="reference" /> <attr name="toolbar_shadow" format="reference" />

Wyświetl plik

@ -114,9 +114,9 @@
<dimen name="playlist_detail_uploader_image_size">24dp</dimen> <dimen name="playlist_detail_uploader_image_size">24dp</dimen>
<dimen name="playlist_detail_uploader_layout_height">28dp</dimen> <dimen name="playlist_detail_uploader_layout_height">28dp</dimen>
<!-- Play Queue View Dimensions --> <!-- Play queue thumbnail view dimensions (16:9) -->
<dimen name="play_queue_thumbnail_width">62dp</dimen> <dimen name="play_queue_thumbnail_width">62dp</dimen>
<dimen name="play_queue_thumbnail_height">40dp</dimen> <dimen name="play_queue_thumbnail_height">35dp</dimen>
<!-- Kiosk view Dimensions--> <!-- Kiosk view Dimensions-->
<dimen name="kiosk_title_text_size">30sp</dimen> <dimen name="kiosk_title_text_size">30sp</dimen>