Detect if the subscription list should be shown as a grid

Also used proper string keys for the preferences, left a TODO to fix it
in other places later.
This commit is contained in:
Mauricio Colli 2020-03-05 21:26:00 -03:00
parent f01e40e671
commit b62142db82
No known key found for this signature in database
GPG key ID: F200BFD6F29DDD85
5 changed files with 94 additions and 50 deletions

View file

@ -1,48 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/itemRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:padding="@dimen/video_item_search_padding">
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/itemRoot"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:minWidth="@dimen/channel_item_grid_min_width"
android:padding="@dimen/channel_item_grid_padding">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/itemThumbnailView"
android:layout_width="@dimen/video_item_grid_thumbnail_image_height"
android:layout_height="@dimen/video_item_grid_thumbnail_image_height"
android:layout_centerHorizontal="true"
android:padding="2dp"
android:contentDescription="@string/list_thumbnail_view_description"
android:src="@drawable/buddy_channel_item"
tools:ignore="RtlHardcoded"/>
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/itemThumbnailView"
android:layout_width="@dimen/channel_item_grid_thumbnail_image_size"
android:layout_height="@dimen/channel_item_grid_thumbnail_image_size"
android:layout_centerHorizontal="true"
android:layout_margin="2dp"
android:contentDescription="@string/detail_uploader_thumbnail_view_description"
android:src="@drawable/buddy_channel_item"
tools:ignore="RtlHardcoded" />
<TextView
android:id="@+id/itemTitleView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/itemThumbnailView"
android:ellipsize="end"
android:lines="1"
android:gravity="center_horizontal"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_search_title_text_size"
tools:ignore="RtlHardcoded"
tools:text="Channel Title, Lorem ipsum"/>
<TextView
android:id="@+id/itemTitleView"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/itemThumbnailView"
android:layout_centerHorizontal="true"
android:ellipsize="end"
android:lines="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="@dimen/video_item_search_title_text_size"
tools:ignore="RtlHardcoded"
tools:text="Channel Title, Lorem ipsum" />
<TextView
android:id="@+id/itemAdditionalDetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/itemTitleView"
android:layout_centerHorizontal="true"
android:lines="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="@dimen/video_item_search_upload_date_text_size"
tools:ignore="RtlHardcoded"
tools:text="10M subscribers"/>
<TextView
android:id="@+id/itemAdditionalDetails"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/itemTitleView"
android:layout_centerHorizontal="true"
android:lines="1"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textSize="@dimen/video_item_search_upload_date_text_size"
tools:ignore="RtlHardcoded"
tools:text="10M subscribers" />
</RelativeLayout>

View file

@ -14,6 +14,9 @@
<dimen name="video_item_search_thumbnail_image_height">70dp</dimen>
<dimen name="video_item_grid_thumbnail_image_width">164dp</dimen>
<dimen name="video_item_grid_thumbnail_image_height">92dp</dimen>
<dimen name="channel_item_grid_thumbnail_image_size">42dp</dimen>
<dimen name="channel_item_grid_min_width">128dp</dimen>
<!-- Calculated: 2*video_item_search_padding + video_item_search_thumbnail_image_height -->
<dimen name="video_item_search_height">96dp</dimen>
<!-- Paddings & Margins -->
@ -24,6 +27,7 @@
<dimen name="video_item_search_duration_margin">2dp</dimen>
<dimen name="video_item_detail_description_to_details_margin">4dp</dimen>
<dimen name="software_component_item_padding">8dp</dimen>
<dimen name="channel_item_grid_padding">12dp</dimen>
<!-- Miscellaneous -->
<dimen name="popup_default_width">180dp</dimen>
<dimen name="popup_minimum_width">150dp</dimen>

View file

@ -1106,12 +1106,17 @@
</string-array>
<string name="list_view_mode_key" translatable="false">list_view_mode</string>
<string name="list_view_mode_value" translatable="false">auto</string>
<string name="list_view_mode_value" translatable="false">@string/list_view_mode_auto_key</string>
<!-- TODO: Use these across the app instead of hardcoding it -->
<string name="list_view_mode_auto_key" translatable="false">auto</string>
<string name="list_view_mode_list_key" translatable="false">list</string>
<string name="list_view_mode_grid_key" translatable="false">grid</string>
<string-array name="list_view_mode_values" translatable="false">
<item>auto</item>
<item>list</item>
<item>grid</item>
<item>@string/list_view_mode_auto_key</item>
<item>@string/list_view_mode_list_key</item>
<item>@string/list_view_mode_grid_key</item>
</string-array>
<string-array name="list_view_mode_description" translatable="false">
<item>@string/auto</item>