Implement new feed and subscriptions groups

- Introduce Groupie for easier lists implementations
- Use some of the new components of the Android Architecture libraries
- Add a bunch of icons for groups, using vectors, which still is
compatible with older APIs through the compatibility layer
This commit is contained in:
Mauricio Colli 2019-04-28 17:43:54 -03:00
parent c1765bf035
commit ee00c8c26f
143 changed files with 4099 additions and 1370 deletions

View file

@ -0,0 +1,153 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout 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:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/options_root"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:minHeight="150dp"
android:orientation="vertical"
android:padding="8dp"
android:visibility="gone"
tools:visibility="visible">
<ImageButton
android:id="@+id/icon_preview"
android:layout_width="64dp"
android:layout_height="64dp"
android:layout_gravity="center"
android:scaleType="centerInside"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:ignore="ContentDescription"
tools:src="?attr/ic_asterisk" />
<com.google.android.material.textfield.TextInputLayout
android:id="@+id/group_name_input_container"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:gravity="center_vertical"
android:hint="@string/feed_group_dialog_name_input"
app:errorEnabled="true"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/icon_preview"
app:layout_constraintTop_toTopOf="parent">
<EditText
android:id="@+id/group_name_input"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:importantForAutofill="no"
android:inputType="textCapSentences"
android:maxLines="1"
tools:ignore="LabelFor,UnusedAttribute" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/selected_subscription_count_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="6dp"
android:textAppearance="@style/TextAppearance.AppCompat.Caption"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/group_name_input_container"
tools:text="15 selected" />
<Button
android:id="@+id/select_channel_button"
style="@style/Widget.AppCompat.Button.Borderless"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_marginBottom="4dp"
android:text="@string/feed_group_dialog_select_subscriptions"
android:textAllCaps="true"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/selected_subscription_count_view" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/icon_selector"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:clipToPadding="false"
android:padding="4dp"
android:paddingTop="16dp"
android:paddingBottom="16dp"
android:visibility="gone"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listItem="@layout/item_icon_picker"
tools:spanCount="7" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/subscriptions_selector"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:visibility="gone"
tools:itemCount="200"
tools:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
tools:listItem="@layout/item_icon_picker"
tools:spanCount="4" />
<View
android:id="@+id/separator"
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/separator_color" />
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:paddingLeft="12dp"
android:paddingTop="4dp"
android:paddingRight="12dp"
android:paddingBottom="4dp">
<ImageButton
android:id="@+id/delete_button"
style="?buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_centerVertical="true"
android:minWidth="0dp"
android:scaleType="centerInside"
android:src="?attr/ic_delete"
android:visibility="gone"
tools:ignore="ContentDescription"
tools:visibility="visible" />
<Button
android:id="@+id/cancel_button"
style="?buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toStartOf="@+id/confirm_button"
android:text="@android:string/cancel" />
<Button
android:id="@+id/confirm_button"
style="?buttonBarButtonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentEnd="true"
android:text="@string/create" />
</RelativeLayout>
</LinearLayout>

View file

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
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:layout_width="64dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="?attr/card_item_background_color">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="?attr/dashed_border_drawable"
android:orientation="vertical"
android:gravity="center"
android:padding="4dp">
<ImageView
android:id="@+id/icon"
android:layout_width="14dp"
android:layout_height="14dp"
android:layout_gravity="center"
android:scaleType="centerInside"
app:srcCompat="?attr/ic_add"
tools:ignore="ContentDescription"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:maxLines="1"
android:layout_marginTop="2dp"
android:text="@string/feed_create_new_group_button_title"
android:textAllCaps="true"
android:textColor="?attr/colorAccent"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View file

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.cardview.widget.CardView
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:layout_width="64dp"
android:layout_height="48dp"
android:layout_gravity="center_vertical"
android:clickable="true"
android:focusable="true"
android:foreground="?attr/selectableItemBackground"
app:cardBackgroundColor="?attr/card_item_background_color">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
android:paddingTop="2dp">
<ImageView
android:id="@+id/icon"
android:layout_width="18dp"
android:layout_height="0dp"
android:layout_gravity="center"
android:layout_weight="1"
android:paddingBottom="2dp"
android:paddingTop="2dp"
android:scaleType="fitCenter"
tools:ignore="ContentDescription"
tools:src="?attr/ic_fastfood"/>
<TextView
android:id="@+id/title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/card_item_contrast_color"
android:ellipsize="end"
android:gravity="center"
android:maxLines="2"
android:padding="2dp"
android:textAllCaps="false"
android:textColor="?attr/colorAccent"
android:textSize="10sp"
android:textStyle="bold"
tools:ignore="SmallSp"
tools:text="ALL"/>
</LinearLayout>
</androidx.cardview.widget.CardView>

View file

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
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:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="16dp"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="14dp"
android:background="?attr/contrast_background_color">
<View
android:layout_width="match_parent"
android:layout_height="5dp"
android:background="?attr/toolbar_shadow_drawable"/>
</FrameLayout>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:background="?attr/separator_color"/>
<LinearLayout
android:id="@+id/import_export"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/header_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:paddingBottom="8dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="8dp"
android:text="@string/tab_subscriptions"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Header"/>
<ImageView
android:id="@+id/import_export_expand_icon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_marginRight="16dp"
app:srcCompat="?attr/expand"
tools:ignore="ContentDescription,RtlHardcoded"/>
</LinearLayout>
<org.schabi.newpipe.views.CollapsibleView
android:id="@+id/import_export_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingBottom="6dp"
tools:ignore="RtlSymmetry">
<TextView
android:id="@+id/import_from_title"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_title_height"
android:gravity="left|center"
android:maxLines="1"
android:paddingLeft="36dp"
android:text="@string/import_from"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="13sp"
tools:ignore="RtlHardcoded"/>
<LinearLayout
android:id="@+id/import_from_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="36dp"
android:layout_marginStart="36dp"
android:orientation="vertical"/>
<TextView
android:id="@+id/export_to_title"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_title_height"
android:background="?attr/selectableItemBackground"
android:gravity="left|center"
android:maxLines="1"
android:paddingLeft="36dp"
android:text="@string/export_to"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="13sp"
tools:ignore="RtlHardcoded"/>
<LinearLayout
android:id="@+id/export_to_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="36dp"
android:orientation="vertical"/>
<View
android:layout_width="match_parent"
android:layout_height="2dp"
android:layout_gravity="center_vertical"
android:layout_marginEnd="8dp"
android:layout_marginStart="8dp"
android:layout_marginTop="6dp"
android:background="?attr/separator_color"/>
</org.schabi.newpipe.views.CollapsibleView>
</LinearLayout>

View file

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.recyclerview.widget.RecyclerView
xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/recycler_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scrollbars="none"/>

View file

@ -6,13 +6,92 @@
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:id="@+id/refresh_root_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:paddingTop="8dp"
android:visibility="gone"
tools:visibility="visible">
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/refresh_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_toStartOf="@+id/refreshIcon"
android:ellipsize="end"
android:gravity="start|center_vertical"
android:maxLines="1"
android:minHeight="24dp"
android:textAppearance="@style/TextAppearance.AppCompat.Body1"
android:textSize="14sp"
tools:text="@string/feed_last_updated"/>
<ImageView
android:id="@+id/refreshIcon"
android:layout_width="24dp"
android:layout_height="24dp"
android:layout_alignParentEnd="true"
android:layout_marginEnd="12dp"
android:layout_marginStart="6dp"
app:srcCompat="?attr/ic_refresh"
tools:ignore="ContentDescription"/>
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@+id/refresh_text"
android:layout_marginLeft="8dp"
android:layout_marginRight="8dp"
android:layout_marginTop="8dp"
android:background="?attr/separator_color"/>
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/items_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_below="@+id/refresh_root_view"
android:scrollbars="vertical"
app:layoutManager="LinearLayoutManager"
tools:listitem="@layout/list_channel_item"/>
android:visibility="gone"
tools:visibility="visible"
tools:listitem="@layout/list_stream_item"/>
<LinearLayout
android:id="@+id/loading_panel_root"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerInParent="true"
android:gravity="center"
android:orientation="vertical">
<ProgressBar
android:id="@+id/loading_progress_bar"
style="@style/Widget.AppCompat.ProgressBar.Horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:indeterminate="true"
android:minWidth="128dp"
android:visibility="gone"
tools:visibility="visible"/>
<TextView
android:id="@+id/loading_progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="8dp"
android:text="∞/∞"
android:textAppearance="@style/TextAppearance.AppCompat.Title"
android:textSize="16sp"
android:visibility="gone"
tools:text="1/120"
tools:visibility="visible"/>
</LinearLayout>
<!--ERROR PANEL-->
<include
@ -37,7 +116,6 @@
<View
android:layout_width="match_parent"
android:layout_height="4dp"
android:background="?attr/toolbar_shadow_drawable"
android:layout_alignParentTop="true"/>
android:layout_alignParentTop="true"
android:background="?attr/toolbar_shadow_drawable"/>
</RelativeLayout>

View file

@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
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:layout_width="match_parent"
android:layout_height="match_parent">
@ -9,11 +8,10 @@
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/items_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_height="match_parent"
android:scrollbars="vertical"
android:visibility="gone"
tools:listitem="@layout/list_channel_item"
tools:visibility="visible"/>
tools:listitem="@layout/list_channel_item"/>
<!--ERROR PANEL-->
<include

View file

@ -0,0 +1,32 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:minHeight="38dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:gravity="center_vertical"
android:orientation="horizontal">
<TextView
android:id="@+id/header_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:textColor="?android:attr/textColorPrimary"
android:layout_marginStart="16dp"
android:textSize="14sp"
android:textStyle="bold"
tools:text="@string/fragment_whats_new"/>
<View
android:layout_width="wrap_content"
android:layout_height="2dp"
android:layout_gravity="center_vertical"
android:layout_marginStart="16dp"
android:layout_marginEnd="4dp"
android:background="?attr/separator_color"/>
</LinearLayout>

View file

@ -0,0 +1,16 @@
<?xml version="1.0" encoding="utf-8"?>
<TextView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/header_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Header"/>

View file

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView
android:id="@+id/header_title"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="start|center_vertical"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Header"/>
<TextView
android:id="@+id/header_info"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start|center_vertical"
android:paddingBottom="12dp"
android:paddingLeft="16dp"
android:paddingRight="16dp"
android:paddingTop="12dp"
android:textColor="?android:attr/textColorPrimary"
android:textSize="12sp"
tools:text="1 selected"/>
</LinearLayout>

View file

@ -3,7 +3,8 @@
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_height="wrap_content"
android:minHeight="128dp"
android:gravity="center"
android:orientation="vertical">

View file

@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<ImageView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/icon_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?attr/selectableItemBackground"
android:focusable="true"
android:minHeight="24dp"
android:minWidth="24dp"
android:padding="8dp"
android:scaleType="centerInside"
tools:ignore="ContentDescription"
tools:src="?attr/rss"/>

View file

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<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:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:clickable="true"
android:focusable="true"
android:background="?attr/focused_selector_drawable">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center"
android:minWidth="72dp"
android:orientation="vertical"
android:padding="4dp"
tools:layout_width="wrap_content">
<de.hdodenhof.circleimageview.CircleImageView
android:id="@+id/thumbnail_view"
android:layout_width="48dp"
android:layout_height="48dp"
android:contentDescription="@string/list_thumbnail_view_description"
tools:src="@drawable/buddy_channel_item"/>
<TextView
android:id="@+id/title_view"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:ellipsize="end"
android:gravity="center"
android:lines="1"
android:maxLines="1"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="10sp"
tools:ignore="SmallSp"
tools:text="Channel Title, Lorem ipsum"/>
</LinearLayout>
<FrameLayout
android:id="@+id/selected_highlight"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="#9A000000"
android:visibility="gone"
tools:visibility="visible">
<ImageView
android:layout_width="match_parent"
android:layout_height="match_parent"
android:scaleType="centerInside"
app:srcCompat="@drawable/ic_done_white_24dp"
tools:ignore="ContentDescription"/>
</FrameLayout>
</FrameLayout>

View file

@ -7,37 +7,6 @@
android:orientation="vertical"
android:paddingBottom="12dp">
<LinearLayout
android:id="@+id/whats_new"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:background="?attr/selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:orientation="horizontal">
<ImageView
android:id="@+id/whats_new_icon"
android:layout_width="48dp"
android:layout_height="24dp"
android:layout_gravity="center"
android:layout_marginLeft="12dp"
android:layout_marginRight="12dp"
android:src="?attr/rss"
tools:ignore="ContentDescription,RtlHardcoded"/>
<TextView
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="left|center"
android:text="@string/fragment_whats_new"
android:textAppearance="?android:attr/textAppearanceLarge"
android:textSize="15sp"
android:textStyle="bold"
tools:ignore="RtlHardcoded"/>
</LinearLayout>
<RelativeLayout
android:id="@+id/import_export"
android:layout_width="match_parent"
@ -85,13 +54,14 @@
android:id="@+id/import_export_options"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:orientation="vertical"
tools:ignore="RtlSymmetry">
<TextView
android:id="@+id/import_from_title"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_item_height"
android:layout_height="@dimen/subscription_import_export_title_height"
android:gravity="left|center"
android:maxLines="1"
android:paddingLeft="72dp"
@ -111,7 +81,7 @@
<TextView
android:id="@+id/export_to_title"
android:layout_width="match_parent"
android:layout_height="@dimen/subscription_import_export_item_height"
android:layout_height="@dimen/subscription_import_export_title_height"
android:background="?attr/selectableItemBackground"
android:gravity="left|center"
android:maxLines="1"