add favorite list to home screen

This commit is contained in:
2020-10-15 21:00:31 +02:00
parent a8dc243d0e
commit 474b72df49
15 changed files with 206 additions and 29 deletions

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M12,21.35l-1.45,-1.32C5.4,15.36 2,12.28 2,8.5 2,5.42 4.42,3 7.5,3c1.74,0 3.41,0.81 4.5,2.09C13.09,3.81 14.76,3 16.5,3 19.58,3 22,5.42 22,8.5c0,3.78 -3.4,6.86 -8.55,11.54L12,21.35z"/>
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M16.5,3c-1.74,0 -3.41,0.81 -4.5,2.09C10.91,3.81 9.24,3 7.5,3 4.42,3 2,5.42 2,8.5c0,3.78 3.4,6.86 8.55,11.54L12,21.35l1.45,-1.32C18.6,15.36 22,12.28 22,8.5 22,5.42 19.58,3 16.5,3zM12.1,18.55l-0.1,0.1 -0.1,-0.1C7.14,14.24 4,11.39 4,8.5 4,6.5 5.5,5 7.5,5c1.54,0 3.04,0.99 3.57,2.36h1.87C13.46,5.99 14.96,5 16.5,5c2,0 3.5,1.5 3.5,3.5 0,2.89 -3.14,5.74 -7.9,10.05z"/>
</vector>

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item
android:drawable="@drawable/ic_baseline_favorite_border_24"
android:state_checked="false" />
<item
android:drawable="@drawable/ic_baseline_favorite_24"
android:state_checked="true" />
<item
android:drawable="@drawable/ic_baseline_favorite_border_24" />
</selector>

View File

@ -7,6 +7,41 @@
android:background="#f5f5f5"
tools:context=".ui.fragments.HomeFragment">
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical" >
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:id="@+id/textView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="5dp"
android:text="My List"
android:textSize="16sp"
android:textStyle="bold" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_my_list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:listitem="@layout/item_media" />
</LinearLayout>
</LinearLayout>
</ScrollView>
<TextView
android:id="@+id/text_home"
android:layout_width="match_parent"

View File

@ -13,9 +13,13 @@
android:layout_height="match_parent"
android:clipToPadding="false"
android:padding="3dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
app:layout_constraintTop_toTopOf="parent"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/item_media" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -113,6 +113,20 @@
android:layout_marginEnd="12dp"
android:text="@string/text_overview_ex" />
<CheckBox
android:id="@+id/check_my_list"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginStart="31dp"
android:layout_marginTop="7dp"
android:layout_marginEnd="7dp"
android:layout_marginBottom="7dp"
android:button="@drawable/sl_favourite_24dp"
android:scaleX="2.0"
android:scaleY="2.0"
app:buttonTint="#4A4141" />
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/recycler_episodes"
android:layout_width="match_parent"
@ -120,7 +134,8 @@
android:layout_marginStart="7dp"
android:layout_marginTop="17dp"
android:layout_marginEnd="7dp"
tools:layout_editor_absoluteY="298dp" />
tools:layout_editor_absoluteY="298dp"
tools:listitem="@layout/item_episode" />
</LinearLayout>
</androidx.core.widget.NestedScrollView>

View File

@ -28,10 +28,14 @@
android:layout_height="0dp"
android:clipToPadding="false"
android:padding="3dp"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/search_text">
app:layout_constraintTop_toBottomOf="@+id/search_text"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:spanCount="2"
tools:listitem="@layout/item_media">
</androidx.recyclerview.widget.RecyclerView>

View File

@ -1,26 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<com.google.android.material.card.MaterialCardView 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_width="195dp"
android:layout_height="wrap_content"
android:backgroundTint="#FFFFFF"
android:visibility="visible"
app:cardCornerRadius="7dp"
app:cardElevation="4dp">
<LinearLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
android:layout_height="match_parent">
<ImageView
android:id="@+id/image_poster"
android:layout_width="match_parent"
android:layout_height="112.5dp"
android:layout_width="0dp"
android:layout_height="0dp"
android:contentDescription="@string/media_poster_desc"
android:maxWidth="200dp"
android:scaleType="centerCrop"
app:layout_constraintBottom_toTopOf="@+id/text_title"
app:layout_constraintDimensionRatio="H,16:9"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:srcCompat="@color/md_disabled_text_dark_theme" />
<TextView
@ -33,6 +35,8 @@
android:padding="3dp"
android:text="@string/text_title_ex"
android:textAlignment="center"
android:textSize="15sp" />
</LinearLayout>
android:textSize="15sp"
app:layout_constraintTop_toBottomOf="@+id/image_poster" />
</androidx.constraintlayout.widget.ConstraintLayout>
</com.google.android.material.card.MaterialCardView>