fixed rolling cache + update UI text color

This commit is contained in:
reduplicated 2022-12-03 22:55:53 +01:00
parent 42d1dd9f7d
commit 2222a1b07b
13 changed files with 349 additions and 341 deletions

View file

@ -1,6 +1,7 @@
package com.lagradost.cloudstream3.ui package com.lagradost.cloudstream3.ui
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.unixTime
import com.lagradost.cloudstream3.APIHolder.unixTimeMS import com.lagradost.cloudstream3.APIHolder.unixTimeMS
import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.logError
@ -31,26 +32,47 @@ class APIRepository(val api: MainAPI) {
return data.isEmpty() || data == "[]" || data == "about:blank" return data.isEmpty() || data == "[]" || data == "about:blank"
} }
private val cacheHash: HashMap<Pair<String, String>, LoadResponse> = hashMapOf() data class SavedLoadResponse(
val unixTime: Long,
val response: LoadResponse,
val hash: Pair<String, String>
)
private val cache: ArrayList<SavedLoadResponse> = arrayListOf()
private var cacheIndex: Int = 0
const val cacheSize = 20
} }
val hasMainPage = api.hasMainPage val hasMainPage = api.hasMainPage
val providerType = api.providerType
val name = api.name val name = api.name
val mainUrl = api.mainUrl val mainUrl = api.mainUrl
val mainPage = api.mainPage val mainPage = api.mainPage
val hasQuickSearch = api.hasQuickSearch val hasQuickSearch = api.hasQuickSearch
val vpnStatus = api.vpnStatus val vpnStatus = api.vpnStatus
val providerType = api.providerType
suspend fun load(url: String): Resource<LoadResponse> { suspend fun load(url: String): Resource<LoadResponse> {
return safeApiCall { return safeApiCall {
if (isInvalidData(url)) throw ErrorLoadingException() if (isInvalidData(url)) throw ErrorLoadingException()
val fixedUrl = api.fixUrl(url) val fixedUrl = api.fixUrl(url)
val key = Pair(api.name, url) val lookingForHash = Pair(api.name, fixedUrl)
cacheHash[key] ?: api.load(fixedUrl)?.also {
// we cache 20 responses because ppl often go back to the same shit + 20 because I dont want to cause too much memory leak for (item in cache) {
if (cacheHash.size > 20) cacheHash.remove(cacheHash.keys.random()) // 10 min save
cacheHash[key] = it if (item.hash == lookingForHash && (unixTime - item.unixTime) < 60 * 10) {
return@safeApiCall item.response
}
}
api.load(fixedUrl)?.also { response ->
val add = SavedLoadResponse(unixTime, response, lookingForHash)
if (cache.size > cacheSize) {
cache[cacheIndex] = add // rolling cache
cacheIndex = (cacheIndex + 1) % cacheSize
} else {
cache.add(add)
}
} ?: throw ErrorLoadingException() } ?: throw ErrorLoadingException()
} }
} }

View file

@ -443,6 +443,7 @@ class HomeFragment : Fragment() {
home_main_poster_recyclerview?.isVisible = visible home_main_poster_recyclerview?.isVisible = visible
} }
@SuppressLint("NotifyDataSetChanged") // we need to notify to change poster
private fun fixGrid() { private fun fixGrid() {
activity?.getSpanCount()?.let { activity?.getSpanCount()?.let {
currentSpan = it currentSpan = it
@ -465,6 +466,7 @@ class HomeFragment : Fragment() {
override fun onConfigurationChanged(newConfig: Configuration) { override fun onConfigurationChanged(newConfig: Configuration) {
super.onConfigurationChanged(newConfig) super.onConfigurationChanged(newConfig)
(home_preview_viewpager?.adapter as? HomeScrollAdapter)?.notifyDataSetChanged()
fixGrid() fixGrid()
} }

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.home package com.lagradost.cloudstream3.ui.home
import android.content.res.Configuration
import android.view.LayoutInflater import android.view.LayoutInflater
import android.view.View import android.view.View
import android.view.ViewGroup import android.view.ViewGroup
@ -59,6 +60,10 @@ class HomeScrollAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
fun bind(card: LoadResponse) { fun bind(card: LoadResponse) {
card.apply { card.apply {
val isHorizontal =
itemView.resources.configuration.orientation == Configuration.ORIENTATION_LANDSCAPE
val posterUrl = if (isHorizontal) backgroundPosterUrl ?: posterUrl else posterUrl
?: backgroundPosterUrl
itemView.home_scroll_preview_tags?.text = tags?.joinToString("") ?: "" itemView.home_scroll_preview_tags?.text = tags?.joinToString("") ?: ""
itemView.home_scroll_preview_tags?.isGone = tags.isNullOrEmpty() itemView.home_scroll_preview_tags?.isGone = tags.isNullOrEmpty()
itemView.home_scroll_preview?.setImage(posterUrl, posterHeaders) itemView.home_scroll_preview?.setImage(posterUrl, posterHeaders)

View file

@ -16,8 +16,6 @@ import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog import com.lagradost.cloudstream3.utils.SingleSelectionHelper.showMultiDialog
import com.lagradost.cloudstream3.utils.SubtitleHelper import com.lagradost.cloudstream3.utils.SubtitleHelper
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import kotlin.reflect.jvm.internal.impl.descriptors.deserialization.PlatformDependentDeclarationFilter.All
class SettingsProviders : PreferenceFragmentCompat() { class SettingsProviders : PreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View file

@ -323,6 +323,7 @@
app:iconifiedByDefault="true" app:iconifiedByDefault="true"
app:queryBackground="@color/transparent" app:queryBackground="@color/transparent"
app:queryHint="@string/search" app:queryHint="@string/search"
app:closeIcon="@drawable/ic_baseline_close_24"
app:searchIcon="@drawable/search_icon" app:searchIcon="@drawable/search_icon"
tools:ignore="RtlSymmetry" /> tools:ignore="RtlSymmetry" />
@ -405,11 +406,11 @@
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>
</FrameLayout> </FrameLayout>
<View <View
android:id="@+id/home_fix_padding" android:id="@+id/home_fix_padding"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="0dp"> android:layout_height="0dp"></View>
</View>
<!-- <!--
All padding in home_watch_holder is determined in runtime All padding in home_watch_holder is determined in runtime
This is because the home poster can be invisible which forces This is because the home poster can be invisible which forces

View file

@ -26,10 +26,7 @@
android:contentDescription="@string/search_poster_img_des" /> android:contentDescription="@string/search_poster_img_des" />
<TextView <TextView
tools:text="@string/quality_hd" style="@style/TypeButton" />
android:id="@+id/text_quality"
style="@style/SearchBox"
android:background="@drawable/type_bg_color" />
<!-- <!--
<LinearLayout <LinearLayout
android:orientation="vertical" android:orientation="vertical"

View file

@ -5,69 +5,69 @@
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:foreground="@drawable/outline_drawable" android:id="@+id/background_card"
android:layout_margin="2dp"
android:layout_width="114dp" android:layout_width="114dp"
android:layout_height="180dp" android:layout_height="180dp"
android:layout_margin="2dp"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:elevation="10dp" android:elevation="10dp"
app:cardCornerRadius="@dimen/rounded_image_radius" android:foreground="@drawable/outline_drawable"
android:id="@+id/background_card" app:cardBackgroundColor="?attr/primaryGrayBackground"
app:cardBackgroundColor="?attr/primaryGrayBackground"> app:cardCornerRadius="@dimen/rounded_image_radius">
<ImageView <ImageView
android:duplicateParentState="true"
android:id="@+id/imageView" android:id="@+id/imageView"
tools:src="@drawable/example_poster"
android:scaleType="centerCrop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:contentDescription="@string/search_poster_img_des"
android:duplicateParentState="true"
android:foreground="?android:attr/selectableItemBackgroundBorderless" android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/search_poster_img_des" /> android:scaleType="centerCrop"
tools:src="@drawable/example_poster" />
<ImageView <ImageView
android:focusable="false" android:id="@+id/title_shadow"
android:clickable="false"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:id="@+id/title_shadow"
android:src="@drawable/title_shadow"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:clickable="false"
android:focusable="false"
android:src="@drawable/title_shadow"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
tools:text="The Perfect Run" android:id="@+id/imageText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:paddingBottom="5dp" android:ellipsize="end"
android:paddingTop="5dp" android:gravity="center"
android:textColor="@color/textColor"
android:id="@+id/imageText"
android:textStyle="bold"
android:maxLines="2" android:maxLines="2"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:ellipsize="end" /> android:paddingBottom="5dp"
android:textColor="@color/textColor"
android:textStyle="bold"
tools:text="The Perfect Run" />
<ImageView <ImageView
android:id="@+id/search_item_download_play" android:id="@+id/search_item_download_play"
android:layout_gravity="center"
android:src="@drawable/play_button"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" /> android:layout_height="60dp"
android:layout_gravity="center"
android:src="@drawable/play_button" />
<androidx.core.widget.ContentLoadingProgressBar <androidx.core.widget.ContentLoadingProgressBar
android:layout_marginBottom="-1.5dp"
android:id="@+id/watchProgress" android:id="@+id/watchProgress"
android:progressTint="?attr/colorPrimary"
android:progressBackgroundTint="?attr/colorPrimary"
style="@android:style/Widget.Material.ProgressBar.Horizontal" style="@android:style/Widget.Material.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
tools:progress="50" android:layout_height="5dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_height="5dp" /> android:layout_marginBottom="-1.5dp"
android:progressBackgroundTint="?attr/colorPrimary"
android:progressTint="?attr/colorPrimary"
tools:progress="50" />
<!--<View <!--<View
android:id="@+id/search_result_lang" android:id="@+id/search_result_lang"
@ -86,17 +86,13 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp"> android:layout_height="30dp">
</ImageView>--> </ImageView>-->
<TextView <TextView android:id="@+id/text_quality" style="@style/TypeButton" />
tools:text="@string/quality_hd"
android:id="@+id/text_quality"
style="@style/SearchBox"
android:background="@drawable/type_bg_color" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_gravity="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_gravity="end"
android:orientation="vertical">
<!-- <!--
<ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary" <ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary"
@ -105,27 +101,23 @@
</ImageView>--> </ImageView>-->
<TextView <TextView
android:text="@string/app_dubbed_text"
android:id="@+id/text_is_dub" android:id="@+id/text_is_dub"
style="@style/SearchBox" style="@style/DubButton"
android:layout_gravity="end" android:layout_gravity="end" />
android:background="@drawable/dub_bg_color" />
<TextView <TextView
android:id="@+id/text_is_sub" android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text" style="@style/SubButton"
style="@style/SearchBox" android:layout_gravity="end" />
android:layout_gravity="end"
android:background="@drawable/sub_bg_color" />
<TextView <TextView
tools:visibility="visible"
android:visibility="gone"
android:textSize="20sp"
android:id="@+id/text_flag" android:id="@+id/text_flag"
tools:text="🇸🇪"
style="@style/SearchBox" style="@style/SearchBox"
android:layout_gravity="end" android:layout_gravity="end"
android:background="@color/transparent" /> android:background="@color/transparent"
android:textSize="20sp"
android:visibility="gone"
tools:text="🇸🇪"
tools:visibility="visible" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -7,56 +7,56 @@
<androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android" <androidx.cardview.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/background_card"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="2dp"
android:backgroundTint="@color/transparent" android:backgroundTint="@color/transparent"
android:foreground="@drawable/outline_drawable" android:foreground="@drawable/outline_drawable"
app:cardElevation="0dp"
android:layout_height="wrap_content"
app:cardCornerRadius="@dimen/rounded_image_radius" app:cardCornerRadius="@dimen/rounded_image_radius"
android:layout_margin="2dp" app:cardElevation="0dp">
android:id="@+id/background_card"
android:layout_width="wrap_content">
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:id="@+id/image_holder" android:id="@+id/image_holder"
android:layout_width="114dp" android:layout_width="114dp"
android:layout_height="180dp" android:layout_height="180dp"
android:elevation="10dp" android:elevation="10dp"
app:cardCornerRadius="@dimen/rounded_image_radius" app:cardBackgroundColor="?attr/primaryGrayBackground"
app:cardBackgroundColor="?attr/primaryGrayBackground"> app:cardCornerRadius="@dimen/rounded_image_radius">
<ImageView <ImageView
android:duplicateParentState="true"
android:id="@+id/imageView" android:id="@+id/imageView"
tools:src="@drawable/example_poster"
android:scaleType="centerCrop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:contentDescription="@string/search_poster_img_des"
android:duplicateParentState="true"
android:foreground="?android:attr/selectableItemBackgroundBorderless" android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/search_poster_img_des" /> android:scaleType="centerCrop"
tools:src="@drawable/example_poster" />
<ImageView <ImageView
android:id="@+id/search_item_download_play" android:id="@+id/search_item_download_play"
android:layout_gravity="center"
android:src="@drawable/play_button"
android:layout_width="60dp" android:layout_width="60dp"
android:layout_height="60dp" /> android:layout_height="60dp"
android:layout_gravity="center"
android:src="@drawable/play_button" />
<androidx.core.widget.ContentLoadingProgressBar <androidx.core.widget.ContentLoadingProgressBar
android:layout_marginBottom="-1.5dp"
android:id="@+id/watchProgress" android:id="@+id/watchProgress"
android:progressTint="?attr/colorPrimary"
android:progressBackgroundTint="?attr/colorPrimary"
style="@android:style/Widget.Material.ProgressBar.Horizontal" style="@android:style/Widget.Material.ProgressBar.Horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
tools:progress="50" android:layout_height="5dp"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_height="5dp" /> android:layout_marginBottom="-1.5dp"
android:progressBackgroundTint="?attr/colorPrimary"
android:progressTint="?attr/colorPrimary"
tools:progress="50" />
<!--<View <!--<View
android:id="@+id/search_result_lang" android:id="@+id/search_result_lang"
@ -75,17 +75,13 @@
android:layout_width="30dp" android:layout_width="30dp"
android:layout_height="30dp"> android:layout_height="30dp">
</ImageView>--> </ImageView>-->
<TextView <TextView android:id="@+id/text_quality" style="@style/TypeButton" />
tools:text="@string/quality_hd"
android:id="@+id/text_quality"
style="@style/SearchBox"
android:background="@drawable/type_bg_color" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_gravity="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_gravity="end"
android:orientation="vertical">
<!-- <!--
<ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary" <ImageView android:id="@+id/text_is_dub" android:tint="?attr/colorPrimary"
@ -94,46 +90,42 @@
</ImageView>--> </ImageView>-->
<TextView <TextView
android:text="@string/app_dubbed_text"
android:id="@+id/text_is_dub" android:id="@+id/text_is_dub"
style="@style/SearchBox" style="@style/DubButton"
android:layout_gravity="end" android:layout_gravity="end" />
android:background="@drawable/dub_bg_color" />
<TextView <TextView
android:id="@+id/text_is_sub" android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text" style="@style/SubButton"
style="@style/SearchBox" android:layout_gravity="end" />
android:layout_gravity="end"
android:background="@drawable/sub_bg_color" />
<TextView <TextView
tools:visibility="visible"
android:visibility="gone"
android:textSize="20sp"
android:id="@+id/text_flag" android:id="@+id/text_flag"
tools:text="🇸🇪"
style="@style/SearchBox" style="@style/SearchBox"
android:layout_gravity="end" android:layout_gravity="end"
android:background="@color/transparent" /> android:background="@color/transparent"
android:textSize="20sp"
android:visibility="gone"
tools:text="🇸🇪"
tools:visibility="visible" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<TextView <TextView
tools:text="The Perfect Run\nThe Perfect Run\nhello" android:id="@+id/imageText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="13sp"
android:gravity="center"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:paddingBottom="5dp" android:ellipsize="end"
android:paddingTop="5dp" android:gravity="center"
android:textColor="?attr/textColor"
android:id="@+id/imageText"
android:minLines="2"
android:maxLines="2" android:maxLines="2"
android:minLines="2"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:ellipsize="end" /> android:paddingBottom="5dp"
android:textColor="?attr/textColor"
android:textSize="13sp"
tools:text="The Perfect Run\nThe Perfect Run\nhello" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -1,44 +1,44 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android" <FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/search_result_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:foreground="@drawable/outline_drawable"
android:focusable="true"
android:clickable="true" android:clickable="true"
android:id="@+id/search_result_root"> android:focusable="true"
android:foreground="@drawable/outline_drawable"
android:orientation="vertical">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_margin="2dp" android:id="@+id/background_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:elevation="10dp" android:elevation="10dp"
app:cardCornerRadius="@dimen/rounded_image_radius" app:cardBackgroundColor="?attr/primaryGrayBackground"
android:id="@+id/background_card" app:cardCornerRadius="@dimen/rounded_image_radius">
app:cardBackgroundColor="?attr/primaryGrayBackground">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
android:duplicateParentState="true"
android:scaleType="centerCrop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:contentDescription="@string/search_poster_img_des"
android:duplicateParentState="true"
android:foreground="?android:attr/selectableItemBackgroundBorderless" android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/search_poster_img_des" /> android:scaleType="centerCrop" />
<ImageView <ImageView
android:focusable="false" android:id="@+id/title_shadow"
android:clickable="false"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="50dp" android:layout_height="50dp"
android:id="@+id/title_shadow"
android:src="@drawable/title_shadow"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:clickable="false"
android:focusable="false"
android:src="@drawable/title_shadow"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView <TextView
@ -46,53 +46,44 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:paddingBottom="5dp" android:ellipsize="end"
android:paddingTop="5dp" android:gravity="center"
android:textColor="@color/textColor"
android:textStyle="bold"
android:maxLines="2" android:maxLines="2"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:ellipsize="end" /> android:paddingBottom="5dp"
<TextView
tools:text="@string/quality_hd"
android:id="@+id/text_quality"
android:textColor="@color/textColor" android:textColor="@color/textColor"
style="@style/SearchBox" android:textStyle="bold" />
android:background="@drawable/type_bg_color" />
<TextView android:id="@+id/text_quality" style="@style/TypeButton" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_gravity="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_gravity="end"
android:orientation="vertical">
<TextView <TextView
android:text="@string/app_dubbed_text"
android:id="@+id/text_is_dub" android:id="@+id/text_is_dub"
android:layout_gravity="end" style="@style/DubButton"
style="@style/SearchBox" android:layout_gravity="end" />
android:background="@drawable/dub_bg_color" />
<TextView <TextView
android:id="@+id/text_is_sub" android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text" style="@style/SubButton"
android:layout_gravity="end" android:layout_gravity="end" />
style="@style/SearchBox"
android:background="@drawable/sub_bg_color" />
<TextView <TextView
tools:visibility="visible"
android:visibility="gone"
android:textSize="20sp"
android:id="@+id/text_flag" android:id="@+id/text_flag"
tools:text="🇸🇪"
style="@style/SearchBox" style="@style/SearchBox"
android:layout_gravity="end" android:layout_gravity="end"
android:background="@color/transparent" /> android:background="@color/transparent"
android:textSize="20sp"
android:visibility="gone"
tools:text="🇸🇪"
tools:visibility="visible" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>

View file

@ -1,90 +1,81 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/search_result_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:foreground="@drawable/outline_drawable"
android:focusable="true"
android:clickable="true" android:clickable="true"
android:id="@+id/search_result_root"> android:focusable="true"
android:foreground="@drawable/outline_drawable"
android:orientation="vertical">
<androidx.cardview.widget.CardView <androidx.cardview.widget.CardView
android:layout_margin="2dp" android:id="@+id/background_card"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_margin="2dp"
android:layout_marginBottom="2dp" android:layout_marginBottom="2dp"
android:elevation="10dp" android:elevation="10dp"
app:cardCornerRadius="@dimen/rounded_image_radius" app:cardBackgroundColor="?attr/primaryGrayBackground"
android:id="@+id/background_card" app:cardCornerRadius="@dimen/rounded_image_radius">
app:cardBackgroundColor="?attr/primaryGrayBackground">
<ImageView <ImageView
android:id="@+id/imageView" android:id="@+id/imageView"
tools:src="@drawable/example_poster"
android:duplicateParentState="true"
android:scaleType="centerCrop"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"
android:foreground="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/search_poster_img_des" />
<TextView android:layout_height="match_parent"
tools:text="@string/quality_hd" android:contentDescription="@string/search_poster_img_des"
android:id="@+id/text_quality" android:duplicateParentState="true"
android:textColor="@color/textColor" android:foreground="?android:attr/selectableItemBackgroundBorderless"
style="@style/SearchBox" android:scaleType="centerCrop"
android:background="@drawable/type_bg_color" /> tools:src="@drawable/example_poster" />
<TextView android:id="@+id/text_quality" style="@style/TypeButton" />
<LinearLayout <LinearLayout
android:orientation="vertical"
android:layout_gravity="end"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent"
android:layout_gravity="end"
android:orientation="vertical">
<TextView <TextView
android:text="@string/app_dubbed_text"
android:id="@+id/text_is_dub" android:id="@+id/text_is_dub"
android:layout_gravity="end" style="@style/DubButton"
style="@style/SearchBox" android:layout_gravity="end" />
android:background="@drawable/dub_bg_color" />
<TextView <TextView
android:id="@+id/text_is_sub" android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text" style="@style/SubButton"
android:layout_gravity="end" android:layout_gravity="end" />
style="@style/SearchBox"
android:background="@drawable/sub_bg_color" />
<TextView <TextView
tools:visibility="visible"
android:visibility="gone"
android:textSize="20sp"
android:id="@+id/text_flag" android:id="@+id/text_flag"
tools:text="🇸🇪"
style="@style/SearchBox" style="@style/SearchBox"
android:layout_gravity="end" android:layout_gravity="end"
android:background="@color/transparent" /> android:background="@color/transparent"
android:textSize="20sp"
android:visibility="gone"
tools:text="🇸🇪"
tools:visibility="visible" />
</LinearLayout> </LinearLayout>
</androidx.cardview.widget.CardView> </androidx.cardview.widget.CardView>
<TextView <TextView
tools:text="The Perfect Run\nThe Perfect Run" android:id="@+id/imageText"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:textSize="13sp"
android:gravity="center"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:paddingBottom="5dp" android:ellipsize="end"
android:paddingTop="5dp" android:gravity="center"
android:textColor="?attr/textColor"
android:id="@+id/imageText"
android:minLines="2"
android:maxLines="2" android:maxLines="2"
android:minLines="2"
android:paddingStart="5dp" android:paddingStart="5dp"
android:paddingTop="5dp"
android:paddingEnd="5dp" android:paddingEnd="5dp"
android:ellipsize="end" /> android:paddingBottom="5dp"
android:textColor="?attr/textColor"
android:textSize="13sp"
tools:text="The Perfect Run\nThe Perfect Run" />
</LinearLayout> </LinearLayout>

View file

@ -25,13 +25,13 @@
<color name="whiteText">#FFF</color> <color name="whiteText">#FFF</color>
<color name="blackText">#000</color> <color name="blackText">#000</color>
<color name="dubColor">#3d50fa</color> <!--3b65f5 f18c82 8294F1--> <color name="dubColorText">#121950</color> <!--3b65f5 f18c82 8294F1-->
<color name="amoledModeLight">#121213</color> <color name="amoledModeLight">#121213</color>
<color name="dubColorBg">#3B65F5</color> <color name="dubColorBg">#3B65F5</color>
<color name="subColor">#F54A3B</color> <!--F53B66 FA3D79--> <color name="subColorText">#571711</color> <!--F53B66 FA3D79-->
<color name="subColorBg">#F53B66</color> <color name="subColorBg">#F53B66</color>
<color name="typeColor">#3BF585</color> <color name="typeColorText">#BEC8FF</color>
<color name="typeColorBg">?attr/colorPrimaryDark</color> <color name="typeColorBg">?attr/colorPrimaryDark</color>
<color name="adultColor">#FF6F63</color> <!-- same as sub color --> <color name="adultColor">#FF6F63</color> <!-- same as sub color -->

View file

@ -16,5 +16,4 @@
<integer name="loading_time">2000</integer> <integer name="loading_time">2000</integer>
<dimen name="storage_radius">3dp</dimen> <dimen name="storage_radius">3dp</dimen>
</resources> </resources>

View file

@ -98,6 +98,24 @@
<item name="colorOnPrimary">@color/whiteText</item> <item name="colorOnPrimary">@color/whiteText</item>
</style> </style>
<style name="DubButton" parent="@style/SearchBox">
<item name="android:background">@drawable/dub_bg_color</item>
<item name="android:text">@string/app_dubbed_text</item>
<item name="android:textColor">@color/dubColorText</item>
</style>
<style name="SubButton" parent="@style/SearchBox">
<item name="android:background">@drawable/sub_bg_color</item>
<item name="android:text">@string/app_subbed_text</item>
<item name="android:textColor">@color/subColorText</item>
</style>
<style name="TypeButton" parent="@style/SearchBox">
<item name="android:background">@drawable/type_bg_color</item>
<item name="android:text">@string/quality_hd</item>
<item name="android:textColor">@color/typeColorText</item>
</style>
<style name="LightMode"> <style name="LightMode">
<item name="primaryGrayBackground">@color/lightPrimaryGrayBackground</item> <item name="primaryGrayBackground">@color/lightPrimaryGrayBackground</item>
<item name="primaryBlackBackground">@color/lightBitDarkerGrayBackground</item> <item name="primaryBlackBackground">@color/lightBitDarkerGrayBackground</item>
@ -461,10 +479,10 @@
<item name="android:layout_width">wrap_content</item> <item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item> <item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">5dp</item> <item name="android:layout_marginBottom">5dp</item>
<item name="android:paddingLeft">10dp</item> <item name="android:paddingLeft">7dp</item>
<item name="android:paddingRight">10dp</item> <item name="android:paddingRight">7dp</item>
<item name="android:paddingTop">5dp</item> <item name="android:paddingTop">3dp</item>
<item name="android:paddingBottom">5dp</item> <item name="android:paddingBottom">3dp</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
<item name="textColor">@color/textColor</item> <item name="textColor">@color/textColor</item>
<item name="android:textColor">@color/textColor</item> <item name="android:textColor">@color/textColor</item>