Search UI

This commit is contained in:
LagradOst 2021-05-19 00:13:16 +02:00
parent 719b60db26
commit 379a3f2fe6
11 changed files with 83 additions and 32 deletions

View file

@ -66,4 +66,6 @@ dependencies {
implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'com.github.bumptech.glide:glide:4.12.0'
implementation 'jp.wasabeef:glide-transformations:4.0.0' implementation 'jp.wasabeef:glide-transformations:4.0.0'
implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0'
} }

View file

@ -9,6 +9,7 @@ import android.widget.FrameLayout
import android.widget.ImageView import android.widget.ImageView
import android.widget.TextView import android.widget.TextView
import androidx.appcompat.app.AppCompatActivity import androidx.appcompat.app.AppCompatActivity
import androidx.core.content.ContextCompat
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.bumptech.glide.load.model.GlideUrl import com.bumptech.glide.load.model.GlideUrl
@ -63,8 +64,10 @@ class SearchAdapter(
val cardView: ImageView = itemView.imageView val cardView: ImageView = itemView.imageView
val cardText: TextView = itemView.imageText val cardText: TextView = itemView.imageText
val text_type: TextView? = itemView.text_type val text_type: TextView? = itemView.text_type
val text_is_dub: TextView? = itemView.text_is_dub val search_result_lang: ImageView? = itemView.search_result_lang
val text_is_sub: TextView? = itemView.text_is_sub /*
val text_is_dub: View? = itemView.text_is_dub
val text_is_sub: View? = itemView.text_is_sub*/
//val cardTextExtra: TextView? = itemView.imageTextExtra //val cardTextExtra: TextView? = itemView.imageTextExtra
//val imageTextProvider: TextView? = itemView.imageTextProvider //val imageTextProvider: TextView? = itemView.imageTextProvider
@ -89,9 +92,10 @@ class SearchAdapter(
TvType.ONA -> "ONA" TvType.ONA -> "ONA"
TvType.TvSeries -> "TV" TvType.TvSeries -> "TV"
} }
search_result_lang?.visibility = View.GONE
/*
text_is_dub?.visibility = View.GONE text_is_dub?.visibility = View.GONE
text_is_sub?.visibility = View.GONE text_is_sub?.visibility = View.GONE*/
cardText.text = card.name cardText.text = card.name
@ -111,11 +115,14 @@ class SearchAdapter(
when (card) { when (card) {
is AnimeSearchResponse -> { is AnimeSearchResponse -> {
if (card.dubStatus?.contains(DubStatus.HasDub) == true) { if (card.dubStatus?.size == 1) {
text_is_dub?.visibility = View.VISIBLE search_result_lang?.visibility = View.VISIBLE
if (card.dubStatus.contains(DubStatus.HasDub)) {
search_result_lang?.setColorFilter(ContextCompat.getColor(activity, R.color.dubColor))
} else if (card.dubStatus.contains(DubStatus.HasSub)) {
search_result_lang?.setColorFilter(ContextCompat.getColor(activity, R.color.subColor))
// text_is_sub?.visibility = View.VISIBLE
} }
if (card.dubStatus?.contains(DubStatus.HasSub) == true) {
text_is_sub?.visibility = View.VISIBLE
} }
} }
} }

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/dubColorBg"/> <solid android:color="@color/dubColor"/>
<corners android:radius="@dimen/roundedImageRadius"/> <corners android:radius="@dimen/roundedImageRadius"/>
<stroke android:color="@color/dubColor" android:width="1dp"/> <stroke android:color="@color/dubColor" android:width="1dp"/>
</shape> </shape>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M17,3H7c-1.1,0 -1.99,0.9 -1.99,2L5,21l7,-3 7,3V5c0,-1.1 -0.9,-2 -2,-2z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M12,17.27L18.18,21l-1.64,-7.03L22,9.24l-7.19,-0.61L12,2 9.19,8.63 2,9.24l5.46,4.73L5.82,21z"/>
</vector>

View file

@ -0,0 +1,5 @@
<vector android:height="24dp" android:tint="#FFFFFF"
android:viewportHeight="24" android:viewportWidth="24"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
<path android:fillColor="@android:color/white" android:pathData="M20,4L4,4c-1.1,0 -2,0.9 -2,2v12c0,1.1 0.9,2 2,2h16c1.1,0 2,-0.9 2,-2L22,6c0,-1.1 -0.9,-2 -2,-2zM4,12h4v2L4,14v-2zM14,18L4,18v-2h10v2zM20,18h-4v-2h4v2zM20,14L10,14v-2h10v2z"/>
</vector>

View file

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle"> <shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<corners android:radius="5dp" /> <corners android:radius="10dp" />
<solid android:color="@color/colorSearch"/> <solid android:color="@color/colorSearch"/>
<!--<stroke android:width="0.5dp" android:color="@color/searchColorTransparent" />--> <!--<stroke android:width="0.5dp" android:color="@color/searchColorTransparent" />-->
</shape> </shape>

View file

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"> <shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="@color/subColorBg"/> <solid android:color="@color/subColor"/>
<corners android:radius="@dimen/roundedImageRadius"/> <corners android:radius="@dimen/roundedImageRadius"/>
<stroke android:color="@color/subColor" android:width="1dp"/> <stroke android:color="@color/subColor" android:width="1dp"/>
</shape> </shape>

View file

@ -11,14 +11,16 @@
android:layout_marginTop="@dimen/navbarHeight" android:layout_marginTop="@dimen/navbarHeight"
android:background="@color/grayBackground"> android:background="@color/grayBackground">
<FrameLayout android:visibility="visible"
<FrameLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_margin="10dp"
android:layout_margin="10dp" android:background="@drawable/search_background" android:background="@drawable/search_background"
android:layout_width="match_parent"
android:layout_height="wrap_content"
> >
<FrameLayout android:layout_width="match_parent" android:layout_marginEnd="30dp" <FrameLayout android:layout_gravity="center_vertical" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_marginEnd="30dp"
android:layout_height="30dp">
<androidx.appcompat.widget.SearchView <androidx.appcompat.widget.SearchView
android:animateLayoutChanges="true" android:animateLayoutChanges="true"
android:id="@+id/main_search" android:id="@+id/main_search"
app:queryBackground="@color/transparent" app:queryBackground="@color/transparent"
@ -27,8 +29,8 @@
android:iconifiedByDefault="false" android:iconifiedByDefault="false"
app:queryHint="@string/search_hint" app:queryHint="@string/search_hint"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="40dp" android:layout_height="match_parent"
android:layout_margin="10dp" android:layout_gravity="center_vertical"
app:iconifiedByDefault="false" app:iconifiedByDefault="false"
tools:ignore="RtlSymmetry"> tools:ignore="RtlSymmetry">
<androidx.core.widget.ContentLoadingProgressBar <androidx.core.widget.ContentLoadingProgressBar
@ -59,6 +61,7 @@
android:contentDescription="@string/change_providers_descript"> android:contentDescription="@string/change_providers_descript">
</ImageView> </ImageView>
</FrameLayout> </FrameLayout>
<com.lagradost.cloudstream3.ui.AutofitRecyclerView <com.lagradost.cloudstream3.ui.AutofitRecyclerView
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -71,4 +74,5 @@
android:orientation="vertical" android:orientation="vertical"
> >
</com.lagradost.cloudstream3.ui.AutofitRecyclerView> </com.lagradost.cloudstream3.ui.AutofitRecyclerView>
</LinearLayout> </LinearLayout>

View file

@ -12,6 +12,7 @@
> >
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:foreground="?android:attr/selectableItemBackgroundBorderless" android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:layout_margin="2dp" android:layout_margin="2dp"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -64,20 +65,42 @@
android:paddingTop="4dp" android:paddingTop="4dp"
android:layout_marginBottom="5dp" android:layout_marginBottom="5dp"
android:layout_gravity="start" android:layout_gravity="start"
android:paddingBottom="4dp" android:paddingBottom="8dp"
android:minWidth="50dp" android:minWidth="50dp"
android:gravity="center" android:gravity="center"
android:background="@drawable/type_bg_color" android:background="@drawable/type_bg_color"
android:layout_width="wrap_content" android:layout_height="wrap_content"> android:layout_width="wrap_content" android:layout_height="wrap_content">
</TextView> </TextView>
<!--<View
android:id="@+id/search_result_lang"
android:layout_gravity="bottom"
android:layout_width="match_parent"
android:layout_height="4dp"
android:alpha="0.9">
</View>-->
<ImageView
android:src="@drawable/ic_baseline_bookmark_24"
android:id="@+id/search_result_lang"
android:layout_gravity="right"
android:layout_marginTop="-5dp"
android:layout_marginRight="-6.5dp"
android:layout_width="30dp"
android:layout_height="30dp">
</ImageView>
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"
android:layout_gravity="end" android:layout_gravity="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<!--
<ImageView android:id="@+id/text_is_dub" android:tint="@color/colorPrimary" android:src="@drawable/ic_baseline_subtitles_24" android:layout_width="wrap_content" android:layout_height="20dp">
</ImageView>
<TextView <TextView
android:text="Dub" android:text="Dub"
android:id="@+id/text_is_dub" android:id="@+id/_text_is_dub"
android:textColor="@color/textColor" android:textColor="@color/textColor"
android:paddingRight="10dp" android:paddingRight="10dp"
android:paddingLeft="10dp" android:paddingLeft="10dp"
@ -102,9 +125,9 @@
android:minWidth="50dp" android:minWidth="50dp"
android:gravity="center" android:gravity="center"
android:background="@drawable/sub_bg_color" android:background="@drawable/sub_bg_color"
android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_width="wrap_content" android:layout_height="match_parent"
android:baselineAligned="false"> android:baselineAligned="false">
</TextView> </TextView>-->
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -2,28 +2,28 @@
<resources> <resources>
<color name="colorPrimary">#3d50fa</color> <color name="colorPrimary">#3d50fa</color>
<color name="colorRipple">#1A3D50FA</color> <color name="colorRipple">#1A3D50FA</color>
<color name="colorSearch">@color/itemBackground</color> <!--#3444D1--> <color name="colorSearch">#303135</color> <!--#3444D1 @color/itemBackground-->
<color name="colorItemSeen">#1E1E32</color> <color name="colorItemSeen">#1E1E32</color>
<color name="colorOngoing">#F53B66</color> <!--FF8181--> <color name="colorOngoing">#F53B66</color> <!--FF8181-->
<color name="colorPrimaryDark">#3700B3</color> <color name="colorPrimaryDark">#3700B3</color>
<color name="colorAccent">#3b65f5</color> <!-- 818fff--> <color name="colorAccent">#3b65f5</color> <!-- 818fff-->
<color name="darkBackground">#0E0E10</color> <!--0f0f10--> <color name="darkBackground">#2B2C30</color> <!--0f0f10 0E0E10 303135 2B2C30-->
<color name="bitDarkerGrayBackground">#19181E</color> <!--191a1f--> <color name="bitDarkerGrayBackground">#1C1C20</color> <!--191a1f 19181E 202125 1C1C20-->
<color name="grayBackground">#141419</color> <color name="grayBackground">#1C1C20</color> <!--141419 202125-->
<color name="itemBackground">#131217</color> <!--1B1B20--> <color name="itemBackground">#131217</color> <!--1B1B20-->
<color name="textColor">#FFF</color> <color name="textColor">#e9eaee</color> <!--FFF-->
<color name="grayTextColor">#5e5f62</color> <color name="grayTextColor">#9ba0a4</color> <!-- 5e5f62-->
<color name="lightGrayTextColor">#9f9fa0</color> <color name="lightGrayTextColor">#9f9fa0</color>
<color name="searchColor">@color/textColor</color> <!--DADADA--> <color name="searchColor">@color/textColor</color> <!--DADADA-->
<color name="searchColorTransparent">#1AFFFFFF</color> <!--DADADA--> <color name="searchColorTransparent">#1AFFFFFF</color> <!--DADADA-->
<color name="transparent">#00000000</color> <color name="transparent">#00000000</color>
<color name="white">#FFF</color> <color name="white">#FFF</color>
<color name="dubColor">#3b65f5</color> <color name="dubColor">#3d50fa</color> <!--3b65f5 f18c82 8294F1-->
<color name="dubColorBg">#4D3B65F5</color> <color name="dubColorBg">#4D3B65F5</color>
<color name="subColor">#F53B66</color> <color name="subColor">#F54A3B</color> <!--F53B66 FA3D79-->
<color name="subColorBg">#4DF53B66</color> <color name="subColorBg">#4DF53B66</color>
<color name="typeColor">#F54A3B</color> <color name="typeColor">#F54A3B</color>
<color name="typeColorBg">#4DF54A3B</color> <color name="typeColorBg">#4DF54A3B</color>