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
import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.unixTime
import com.lagradost.cloudstream3.APIHolder.unixTimeMS
import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.logError
@ -31,26 +32,47 @@ class APIRepository(val api: MainAPI) {
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 providerType = api.providerType
val name = api.name
val mainUrl = api.mainUrl
val mainPage = api.mainPage
val hasQuickSearch = api.hasQuickSearch
val vpnStatus = api.vpnStatus
val providerType = api.providerType
suspend fun load(url: String): Resource<LoadResponse> {
return safeApiCall {
if (isInvalidData(url)) throw ErrorLoadingException()
val fixedUrl = api.fixUrl(url)
val key = Pair(api.name, url)
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
if (cacheHash.size > 20) cacheHash.remove(cacheHash.keys.random())
cacheHash[key] = it
val lookingForHash = Pair(api.name, fixedUrl)
for (item in cache) {
// 10 min save
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()
}
}

View file

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

View file

@ -1,5 +1,6 @@
package com.lagradost.cloudstream3.ui.home
import android.content.res.Configuration
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -16,7 +17,7 @@ class HomeScrollAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
private var items: MutableList<LoadResponse> = mutableListOf()
var hasMoreItems: Boolean = false
fun getItem(position: Int) : LoadResponse? {
fun getItem(position: Int): LoadResponse? {
return items.getOrNull(position)
}
@ -59,6 +60,10 @@ class HomeScrollAdapter : RecyclerView.Adapter<RecyclerView.ViewHolder>() {
fun bind(card: LoadResponse) {
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?.isGone = tags.isNullOrEmpty()
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.SubtitleHelper
import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard
import kotlin.reflect.jvm.internal.impl.descriptors.deserialization.PlatformDependentDeclarationFilter.All
class SettingsProviders : PreferenceFragmentCompat() {
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {

View file

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

View file

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

View file

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

View file

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

View file

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

View file

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

View file

@ -25,13 +25,13 @@
<color name="whiteText">#FFF</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="dubColorBg">#3B65F5</color>
<color name="subColor">#F54A3B</color> <!--F53B66 FA3D79-->
<color name="subColorText">#571711</color> <!--F53B66 FA3D79-->
<color name="subColorBg">#F53B66</color>
<color name="typeColor">#3BF585</color>
<color name="typeColorText">#BEC8FF</color>
<color name="typeColorBg">?attr/colorPrimaryDark</color>
<color name="adultColor">#FF6F63</color> <!-- same as sub color -->

View file

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

View file

@ -97,6 +97,24 @@
<item name="white">@color/white</item>
<item name="colorOnPrimary">@color/whiteText</item>
</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">
<item name="primaryGrayBackground">@color/lightPrimaryGrayBackground</item>
@ -461,10 +479,10 @@
<item name="android:layout_width">wrap_content</item>
<item name="android:layout_height">wrap_content</item>
<item name="android:layout_marginBottom">5dp</item>
<item name="android:paddingLeft">10dp</item>
<item name="android:paddingRight">10dp</item>
<item name="android:paddingTop">5dp</item>
<item name="android:paddingBottom">5dp</item>
<item name="android:paddingLeft">7dp</item>
<item name="android:paddingRight">7dp</item>
<item name="android:paddingTop">3dp</item>
<item name="android:paddingBottom">3dp</item>
<item name="android:textSize">12sp</item>
<item name="textColor">@color/textColor</item>
<item name="android:textColor">@color/textColor</item>