From 379a3f2fe6927d9e5574e0d5e4314dccfd307999 Mon Sep 17 00:00:00 2001 From: LagradOst Date: Wed, 19 May 2021 00:13:16 +0200 Subject: [PATCH] Search UI --- app/build.gradle | 2 ++ .../cloudstream3/ui/search/SearchAdaptor.kt | 25 +++++++++------ app/src/main/res/drawable/dub_bg_color.xml | 2 +- .../res/drawable/ic_baseline_bookmark_24.xml | 5 +++ .../main/res/drawable/ic_baseline_star_24.xml | 5 +++ .../res/drawable/ic_baseline_subtitles_24.xml | 5 +++ .../main/res/drawable/search_background.xml | 2 +- app/src/main/res/drawable/sub_bg_color.xml | 2 +- app/src/main/res/layout/fragment_search.xml | 20 +++++++----- .../main/res/layout/search_result_grid.xml | 31 ++++++++++++++++--- app/src/main/res/values/colors.xml | 16 +++++----- 11 files changed, 83 insertions(+), 32 deletions(-) create mode 100644 app/src/main/res/drawable/ic_baseline_bookmark_24.xml create mode 100644 app/src/main/res/drawable/ic_baseline_star_24.xml create mode 100644 app/src/main/res/drawable/ic_baseline_subtitles_24.xml diff --git a/app/build.gradle b/app/build.gradle index 31b89e46..3db3ad96 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -66,4 +66,6 @@ dependencies { implementation 'com.github.bumptech.glide:glide:4.12.0' implementation 'jp.wasabeef:glide-transformations:4.0.0' + + implementation 'androidx.swiperefreshlayout:swiperefreshlayout:1.0.0' } \ No newline at end of file diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt index a68f4c4f..e113573f 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/search/SearchAdaptor.kt @@ -9,6 +9,7 @@ import android.widget.FrameLayout import android.widget.ImageView import android.widget.TextView import androidx.appcompat.app.AppCompatActivity +import androidx.core.content.ContextCompat import androidx.recyclerview.widget.RecyclerView import com.bumptech.glide.Glide import com.bumptech.glide.load.model.GlideUrl @@ -63,8 +64,10 @@ class SearchAdapter( val cardView: ImageView = itemView.imageView val cardText: TextView = itemView.imageText val text_type: TextView? = itemView.text_type - val text_is_dub: TextView? = itemView.text_is_dub - val text_is_sub: TextView? = itemView.text_is_sub + val search_result_lang: ImageView? = itemView.search_result_lang + /* + val text_is_dub: View? = itemView.text_is_dub + val text_is_sub: View? = itemView.text_is_sub*/ //val cardTextExtra: TextView? = itemView.imageTextExtra //val imageTextProvider: TextView? = itemView.imageTextProvider @@ -89,9 +92,10 @@ class SearchAdapter( TvType.ONA -> "ONA" TvType.TvSeries -> "TV" } - + search_result_lang?.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 @@ -111,11 +115,14 @@ class SearchAdapter( when (card) { is AnimeSearchResponse -> { - if (card.dubStatus?.contains(DubStatus.HasDub) == true) { - text_is_dub?.visibility = View.VISIBLE - } - if (card.dubStatus?.contains(DubStatus.HasSub) == true) { - text_is_sub?.visibility = View.VISIBLE + if (card.dubStatus?.size == 1) { + 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 + } } } } diff --git a/app/src/main/res/drawable/dub_bg_color.xml b/app/src/main/res/drawable/dub_bg_color.xml index bd68e0f6..0ed149bd 100644 --- a/app/src/main/res/drawable/dub_bg_color.xml +++ b/app/src/main/res/drawable/dub_bg_color.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/drawable/ic_baseline_bookmark_24.xml b/app/src/main/res/drawable/ic_baseline_bookmark_24.xml new file mode 100644 index 00000000..8f0b1b18 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_bookmark_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_star_24.xml b/app/src/main/res/drawable/ic_baseline_star_24.xml new file mode 100644 index 00000000..954e7723 --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_star_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/ic_baseline_subtitles_24.xml b/app/src/main/res/drawable/ic_baseline_subtitles_24.xml new file mode 100644 index 00000000..f1863edf --- /dev/null +++ b/app/src/main/res/drawable/ic_baseline_subtitles_24.xml @@ -0,0 +1,5 @@ + + + diff --git a/app/src/main/res/drawable/search_background.xml b/app/src/main/res/drawable/search_background.xml index 23d61387..fc189d55 100644 --- a/app/src/main/res/drawable/search_background.xml +++ b/app/src/main/res/drawable/search_background.xml @@ -1,5 +1,5 @@ - + diff --git a/app/src/main/res/drawable/sub_bg_color.xml b/app/src/main/res/drawable/sub_bg_color.xml index 90113428..a3eded0d 100644 --- a/app/src/main/res/drawable/sub_bg_color.xml +++ b/app/src/main/res/drawable/sub_bg_color.xml @@ -1,6 +1,6 @@ - + \ No newline at end of file diff --git a/app/src/main/res/layout/fragment_search.xml b/app/src/main/res/layout/fragment_search.xml index 3a786732..2af060de 100644 --- a/app/src/main/res/layout/fragment_search.xml +++ b/app/src/main/res/layout/fragment_search.xml @@ -11,14 +11,16 @@ android:layout_marginTop="@dimen/navbarHeight" android:background="@color/grayBackground"> - - - + + + \ No newline at end of file diff --git a/app/src/main/res/layout/search_result_grid.xml b/app/src/main/res/layout/search_result_grid.xml index fd7dff71..6032c598 100644 --- a/app/src/main/res/layout/search_result_grid.xml +++ b/app/src/main/res/layout/search_result_grid.xml @@ -12,6 +12,7 @@ > + + + + + diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 1bb88936..b41676dd 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,28 +2,28 @@ #3d50fa #1A3D50FA - @color/itemBackground + #303135 #1E1E32 #F53B66 #3700B3 #3b65f5 - #0E0E10 - #19181E - #141419 + #2B2C30 + #1C1C20 + #1C1C20 #131217 - #FFF - #5e5f62 + #e9eaee + #9ba0a4 #9f9fa0 @color/textColor #1AFFFFFF #00000000 #FFF - #3b65f5 + #3d50fa #4D3B65F5 - #F53B66 + #F54A3B #4DF53B66 #F54A3B #4DF54A3B