updated homepage UI

This commit is contained in:
LagradOst 2021-10-22 15:23:48 +02:00
parent d5ae225070
commit 58f0af0187
11 changed files with 363 additions and 199 deletions

View file

@ -34,8 +34,8 @@ android {
applicationId "com.lagradost.cloudstream3" applicationId "com.lagradost.cloudstream3"
minSdkVersion 21 minSdkVersion 21
targetSdkVersion 31 targetSdkVersion 31
versionCode 29 versionCode 30
versionName "2.1.0" versionName "2.1.1"
resValue "string", "app_version", resValue "string", "app_version",
"${defaultConfig.versionName}${versionNameSuffix ?: ""}" "${defaultConfig.versionName}${versionNameSuffix ?: ""}"

View file

@ -11,12 +11,12 @@ import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
class HomeChildItemAdapter( class HomeChildItemAdapter(
var cardList: List<SearchResponse>, var cardList: List<SearchResponse>,
val layout: Int = R.layout.home_result_grid,
private val clickCallback: (SearchClickCallback) -> Unit private val clickCallback: (SearchClickCallback) -> Unit
) : ) :
RecyclerView.Adapter<RecyclerView.ViewHolder>() { RecyclerView.Adapter<RecyclerView.ViewHolder>() {
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder { override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
val layout = R.layout.home_result_grid
return CardViewHolder( return CardViewHolder(
LayoutInflater.from(parent.context).inflate(layout, parent, false), clickCallback LayoutInflater.from(parent.context).inflate(layout, parent, false), clickCallback
) )
@ -25,7 +25,7 @@ class HomeChildItemAdapter(
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) { override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
when (holder) { when (holder) {
is CardViewHolder -> { is CardViewHolder -> {
holder.bind(cardList[position]) holder.bind(cardList[position], position)
} }
} }
} }
@ -34,12 +34,21 @@ class HomeChildItemAdapter(
return cardList.size return cardList.size
} }
override fun getItemId(position: Int): Long {
return (cardList[position].id ?: position).toLong()
}
class CardViewHolder class CardViewHolder
constructor(itemView: View, private val clickCallback: (SearchClickCallback) -> Unit) : constructor(itemView: View, private val clickCallback: (SearchClickCallback) -> Unit) :
RecyclerView.ViewHolder(itemView) { RecyclerView.ViewHolder(itemView) {
fun bind(card: SearchResponse) { fun bind(card: SearchResponse, index: Int) {
SearchResultBuilder.bind(clickCallback, card, itemView) SearchResultBuilder.bind(clickCallback, card, itemView)
itemView.tag = index
//val ani = ScaleAnimation(0.9f, 1.0f, 0.9f, 1f)
//ani.fillAfter = true
//ani.duration = 200
//itemView.startAnimation(ani)
} }
} }
} }

View file

@ -15,10 +15,13 @@ import androidx.core.view.isVisible
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
import androidx.lifecycle.ViewModelProvider import androidx.lifecycle.ViewModelProvider
import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.GridLayoutManager
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.LinearSnapHelper
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import com.google.android.material.bottomsheet.BottomSheetDialog import com.google.android.material.bottomsheet.BottomSheetDialog
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.apis import com.lagradost.cloudstream3.APIHolder.apis
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.mvvm.observe
@ -39,10 +42,11 @@ import com.lagradost.cloudstream3.utils.DataStoreHelper.setResultWatchState
import com.lagradost.cloudstream3.utils.Event import com.lagradost.cloudstream3.utils.Event
import com.lagradost.cloudstream3.utils.HOMEPAGE_API import com.lagradost.cloudstream3.utils.HOMEPAGE_API
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbarView
import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact import com.lagradost.cloudstream3.utils.UIHelper.getGridIsCompact
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIcons import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIcons
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.widget.CenterZoomLayoutManager
import kotlinx.android.synthetic.main.fragment_home.* import kotlinx.android.synthetic.main.fragment_home.*
const val HOME_BOOKMARK_VALUE = "home_bookmarked_last" const val HOME_BOOKMARK_VALUE = "home_bookmarked_last"
@ -106,61 +110,32 @@ class HomeFragment : Fragment() {
} }
private var currentHomePage: HomePageResponse? = null private var currentHomePage: HomePageResponse? = null
var currentMainIndex = 0
var currentMainList: ArrayList<SearchResponse> = ArrayList()
private fun toggleMainVisibility(visible: Boolean) { private fun toggleMainVisibility(visible: Boolean) {
home_main_holder.isVisible = visible home_main_holder.isVisible = visible
} }
@SuppressLint("SetTextI18n") @SuppressLint("SetTextI18n")
private fun chooseRandomMainPage(item: SearchResponse? = null): SearchResponse? { private fun chooseRandomMainPage() {
val home = currentHomePage val home = currentHomePage
if (home != null && home.items.isNotEmpty()) { if (home != null && home.items.isNotEmpty()) {
var random: SearchResponse? = item val randomItems = home.items.shuffled().flatMap { it.list }.distinctBy { it.url }.toList().shuffled()
if (randomItems.isNullOrEmpty()) {
var breakCount = 0 toggleMainVisibility(false)
val MAX_BREAK_COUNT = 10 } else {
home_main_poster_recyclerview.adapter =
while (random?.posterUrl == null) { HomeChildItemAdapter(randomItems, R.layout.home_result_big_grid) { callback ->
try { handleSearchClickCallback(activity, callback)
random = home.items.random().list.random() }
} catch (e: Exception) { home_main_poster_recyclerview.post {
// probs Collection is empty. (home_main_poster_recyclerview.layoutManager as CenterZoomLayoutManager?)?.updateSize(forceUpdate = true)
} }
breakCount++
if (breakCount > MAX_BREAK_COUNT) {
break
}
}
if (random?.posterUrl != null) {
home_main_poster.setOnClickListener {
activity.loadSearchResult(random)
}
home_main_play.setOnClickListener {
activity.loadSearchResult(random, START_ACTION_RESUME_LATEST)
}
home_main_info.setOnClickListener {
activity.loadSearchResult(random)
}
home_main_text.text = random.name + if (random is AnimeSearchResponse && !random.dubStatus.isNullOrEmpty()) {
random.dubStatus?.joinToString(prefix = "", separator = " | ") { it.name }
} else ""
home_main_poster?.setImage(random.posterUrl)
toggleMainVisibility(true) toggleMainVisibility(true)
return random
} else {
toggleMainVisibility(false)
return null
} }
} else { } else {
toggleMainVisibility(false) toggleMainVisibility(false)
} }
return null
} }
private fun fixGrid() { private fun fixGrid() {
@ -214,39 +189,30 @@ class HomeFragment : Fragment() {
} }
}*/ }*/
@SuppressLint("SetTextI18n")
override fun onViewCreated(view: View, savedInstanceState: Bundle?) { override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState) super.onViewCreated(view, savedInstanceState)
fixGrid() fixGrid()
home_reroll_next.setOnClickListener {
currentMainIndex++
if (currentMainIndex >= currentMainList.size) {
val newItem = chooseRandomMainPage()
if (newItem != null) {
currentMainList.add(newItem)
}
currentMainIndex = currentMainList.size - 1
}
chooseRandomMainPage(currentMainList[currentMainIndex])
}
home_reroll_prev.setOnClickListener {
currentMainIndex--
if (currentMainIndex < 0) {
val newItem = chooseRandomMainPage()
if (newItem != null) {
currentMainList.add(0, newItem)
}
currentMainIndex = 0
}
chooseRandomMainPage(currentMainList[currentMainIndex])
}
home_change_api.setOnClickListener(apiChangeClickListener) home_change_api.setOnClickListener(apiChangeClickListener)
home_change_api_loading.setOnClickListener(apiChangeClickListener) home_change_api_loading.setOnClickListener(apiChangeClickListener)
observe(homeViewModel.apiName) { observe(homeViewModel.apiName) { apiName ->
context?.setKey(HOMEPAGE_API, it) context?.setKey(HOMEPAGE_API, apiName)
home_provider_name?.text = apiName
home_provider_meta_info?.isVisible = false
getApiFromNameNull(apiName)?.let { currentApi ->
val typeChoices = listOf(
Pair(R.string.movies, listOf(TvType.Movie)),
Pair(R.string.tv_series, listOf(TvType.TvSeries)),
Pair(R.string.cartoons, listOf(TvType.Cartoon)),
Pair(R.string.anime, listOf(TvType.Anime, TvType.ONA, TvType.AnimeMovie)),
Pair(R.string.torrent, listOf(TvType.Torrent)),
).filter { item -> currentApi.supportedTypes.any { type -> item.second.contains(type) } }
home_provider_meta_info?.text = typeChoices.joinToString(separator = " ") { getString(it.first) }
home_provider_meta_info?.isVisible = true
}
} }
observe(homeViewModel.page) { data -> observe(homeViewModel.page) { data ->
@ -259,18 +225,14 @@ class HomeFragment : Fragment() {
d.items.mapNotNull { d.items.mapNotNull {
try { try {
HomePageList(it.name, it.list.filterSearchResponse()) HomePageList(it.name, it.list.filterSearchResponse())
} catch (e : Exception) { } catch (e: Exception) {
logError(e) logError(e)
null null
} }
} }
home_master_recycler?.adapter?.notifyDataSetChanged() home_master_recycler?.adapter?.notifyDataSetChanged()
currentMainList.clear() chooseRandomMainPage()
chooseRandomMainPage()?.let { response ->
currentMainList.add(response)
}
currentMainIndex = 0
home_loading.visibility = View.GONE home_loading.visibility = View.GONE
home_loading_error.visibility = View.GONE home_loading_error.visibility = View.GONE
@ -407,15 +369,35 @@ class HomeFragment : Fragment() {
} }
} }
context?.fixPaddingStatusbar(home_root) context?.fixPaddingStatusbarView(home_statusbar)
context?.fixPaddingStatusbar(home_loading_statusbar)
home_master_recycler.adapter = adapter home_master_recycler.adapter = adapter
home_master_recycler.layoutManager = GridLayoutManager(context, 1) home_master_recycler.layoutManager = GridLayoutManager(context, 1)
LinearSnapHelper().attachToRecyclerView(home_main_poster_recyclerview) // snap
val centerLayoutManager = CenterZoomLayoutManager(context, LinearLayoutManager.HORIZONTAL, false)
centerLayoutManager.setOnSizeListener { index ->
(home_main_poster_recyclerview.adapter as HomeChildItemAdapter?)?.cardList?.get(index)?.let { random ->
home_main_play.setOnClickListener {
activity.loadSearchResult(random, START_ACTION_RESUME_LATEST)
}
home_main_info.setOnClickListener {
activity.loadSearchResult(random)
}
home_main_text.text =
random.name + if (random is AnimeSearchResponse && !random.dubStatus.isNullOrEmpty()) {
random.dubStatus.joinToString(prefix = "", separator = " | ") { it.name }
} else ""
}
}
home_main_poster_recyclerview.layoutManager = centerLayoutManager // scale
reloadStored() reloadStored()
val apiName = context?.getKey<String>(HOMEPAGE_API) val apiName = context?.getKey<String>(HOMEPAGE_API)
if(homeViewModel.apiName.value != apiName || apiName == null) { if (homeViewModel.apiName.value != apiName || apiName == null) {
println("Caught home: " + homeViewModel.apiName.value + " at " + apiName) //println("Caught home: " + homeViewModel.apiName.value + " at " + apiName)
homeViewModel.loadAndCancel(apiName) homeViewModel.loadAndCancel(apiName)
} }
} }

View file

@ -47,7 +47,7 @@ class ParentItemAdapter(
private val moreInfo: FrameLayout = itemView.home_child_more_info private val moreInfo: FrameLayout = itemView.home_child_more_info
fun bind(info: HomePageList) { fun bind(info: HomePageList) {
title.text = info.name title.text = info.name
recyclerView.adapter = HomeChildItemAdapter(info.list, clickCallback) recyclerView.adapter = HomeChildItemAdapter(info.list, clickCallback = clickCallback)
(recyclerView.adapter as HomeChildItemAdapter).notifyDataSetChanged() (recyclerView.adapter as HomeChildItemAdapter).notifyDataSetChanged()
moreInfo.setOnClickListener { moreInfo.setOnClickListener {

View file

@ -39,6 +39,7 @@ import com.lagradost.cloudstream3.MainActivity.Companion.getCastSession
import com.lagradost.cloudstream3.MainActivity.Companion.showToast import com.lagradost.cloudstream3.MainActivity.Companion.showToast
import com.lagradost.cloudstream3.mvvm.Resource import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
import com.lagradost.cloudstream3.mvvm.observe import com.lagradost.cloudstream3.mvvm.observe
import com.lagradost.cloudstream3.ui.WatchType import com.lagradost.cloudstream3.ui.WatchType
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD
@ -310,7 +311,8 @@ class ResultFragment : Fragment() {
CastButtonFactory.setUpMediaRouteButton(it, media_route_button) CastButtonFactory.setUpMediaRouteButton(it, media_route_button)
val castContext = CastContext.getSharedInstance(it.applicationContext) val castContext = CastContext.getSharedInstance(it.applicationContext)
if (castContext.castState != CastState.NO_DEVICES_AVAILABLE) media_route_button.visibility = VISIBLE if (castContext.castState != CastState.NO_DEVICES_AVAILABLE) media_route_button.visibility =
VISIBLE
castContext.addCastStateListener { state -> castContext.addCastStateListener { state ->
if (media_route_button != null) { if (media_route_button != null) {
if (state == CastState.NO_DEVICES_AVAILABLE) media_route_button.visibility = GONE else { if (state == CastState.NO_DEVICES_AVAILABLE) media_route_button.visibility = GONE else {
@ -318,7 +320,7 @@ class ResultFragment : Fragment() {
} }
} }
} }
} catch (e : Exception) { } catch (e: Exception) {
logError(e) logError(e)
} }
} }
@ -535,16 +537,18 @@ class ResultFragment : Fragment() {
val topFolder = "$folder" val topFolder = "$folder"
withContext(Dispatchers.IO) { withContext(Dispatchers.IO) {
VideoDownloadManager.downloadThing( normalSafeApiCall {
ctx, VideoDownloadManager.downloadThing(
link, ctx,
fileName, link,
topFolder, fileName,
"vtt", topFolder,
false, "vtt",
null false,
) { null
// no notification ) {
// no notification
}
} }
} }
} }
@ -841,7 +845,7 @@ class ResultFragment : Fragment() {
} }
is Resource.Loading -> { is Resource.Loading -> {
result_episode_loading?.isVisible = true result_episode_loading?.isVisible = true
// result_episodes?.isVisible = false // result_episodes?.isVisible = false
} }
is Resource.Success -> { is Resource.Success -> {
//result_episodes?.isVisible = true //result_episodes?.isVisible = true
@ -877,7 +881,7 @@ class ResultFragment : Fragment() {
if (count < 0) { if (count < 0) {
result_episodes_text?.isVisible = false result_episodes_text?.isVisible = false
} else { } else {
// result_episodes_text?.isVisible = true // result_episodes_text?.isVisible = true
result_episodes_text?.text = result_episodes_text?.text =
"$count ${if (count == 1) getString(R.string.episode) else getString(R.string.episodes)}" "$count ${if (count == 1) getString(R.string.episode) else getString(R.string.episodes)}"
} }

View file

@ -19,11 +19,10 @@ object SearchResultBuilder {
itemView: View itemView: View
) { ) {
val cardView: ImageView = itemView.imageView val cardView: ImageView = itemView.imageView
val cardText: TextView = itemView.imageText val cardText: TextView? = itemView.imageText
val textIsDub: TextView? = itemView.text_is_dub val textIsDub: TextView? = itemView.text_is_dub
val textIsSub: TextView? = itemView.text_is_sub val textIsSub: TextView? = itemView.text_is_sub
println(card.name)
val bg: CardView = itemView.backgroundCard val bg: CardView = itemView.backgroundCard
@ -37,7 +36,7 @@ object SearchResultBuilder {
textIsDub?.visibility = View.GONE textIsDub?.visibility = View.GONE
textIsSub?.visibility = View.GONE textIsSub?.visibility = View.GONE
cardText.text = card.name cardText?.text = card.name
//imageTextProvider.text = card.apiName //imageTextProvider.text = card.apiName
cardView.setImage(card.posterUrl) cardView.setImage(card.posterUrl)
@ -69,7 +68,7 @@ object SearchResultBuilder {
playImg?.visibility = View.VISIBLE playImg?.visibility = View.VISIBLE
if (!card.type.isMovieType()) { if (!card.type.isMovieType()) {
cardText.text = cardText.context.getNameFull(card.name, card.episode, card.season) cardText?.text = cardText?.context?.getNameFull(card.name, card.episode, card.season)
} }
} }
is AnimeSearchResponse -> { is AnimeSearchResponse -> {

View file

@ -214,6 +214,12 @@ object UIHelper {
v.setPadding(v.paddingLeft, v.paddingTop + getStatusBarHeight(), v.paddingRight, v.paddingBottom) v.setPadding(v.paddingLeft, v.paddingTop + getStatusBarHeight(), v.paddingRight, v.paddingBottom)
} }
fun Context.fixPaddingStatusbarView(v: View) {
val params = v.layoutParams
params.height = getStatusBarHeight()
v.layoutParams = params
}
fun Context.getNavigationBarHeight(): Int { fun Context.getNavigationBarHeight(): Int {
var result = 0 var result = 0
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android") val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")

View file

@ -0,0 +1,88 @@
package com.lagradost.cloudstream3.widget
import android.content.Context
import android.util.AttributeSet
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import kotlin.math.abs
import kotlin.math.min
class CenterZoomLayoutManager : LinearLayoutManager {
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int, defStyleRes: Int) : super(
context, attrs, defStyleAttr, defStyleRes
)
constructor(context: Context?) : super(context)
constructor(context: Context?, orientation: Int, reverseLayout: Boolean) : super(
context,
orientation,
reverseLayout
)
private var itemListener: ((Int) -> Unit)? = null
// to not spam updates
private var lastViewIndex: Int? = null
private val mShrinkAmount = 0.15f
private val mShrinkDistance = 0.9f
fun updateSize(forceUpdate: Boolean = false) {
val midpoint = width / 2f
val d0 = 0f
val d1 = mShrinkDistance * midpoint
val s0 = 1f
val s1 = 1f - mShrinkAmount
var largestTag: Int? = null
var largestSize = 0f
for (i in 0 until childCount) {
getChildAt(i)?.let { child ->
val childMidpoint = (getDecoratedRight(child) + getDecoratedLeft(child)) / 2f
val d = min(d1, abs(midpoint - childMidpoint))
val scale = s0 + (s1 - s0) * (d - d0) / (d1 - d0)
child.scaleX = scale
child.scaleY = scale
if (scale > largestSize) {
(child.tag as Int?)?.let { tag ->
largestSize = scale
largestTag = tag
}
}
}
}
largestTag?.let { tag ->
if (lastViewIndex != tag || forceUpdate) {
lastViewIndex = tag
itemListener?.invoke(tag)
}
}
}
fun setOnSizeListener(listener: (Int) -> Unit) {
lastViewIndex = null
itemListener = listener
}
fun removeOnSizeListener() {
itemListener = null
}
override fun onLayoutCompleted(state: RecyclerView.State?) {
super.onLayoutCompleted(state)
updateSize()
}
override fun scrollHorizontallyBy(dx: Int, recycler: RecyclerView.Recycler, state: RecyclerView.State): Int {
val orientation = orientation
return if (orientation == HORIZONTAL) {
val scrolled = super.scrollHorizontallyBy(dx, recycler, state)
updateSize()
scrolled
} else {
0
}
}
}

View file

@ -11,7 +11,7 @@
<FrameLayout <FrameLayout
android:visibility="gone" android:visibility="gone"
tools:visibility="gone" tools:visibility="visible"
android:id="@+id/home_loading" android:id="@+id/home_loading"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -22,22 +22,27 @@
android:layout_width="50dp" android:layout_width="50dp"
android:layout_height="50dp"> android:layout_height="50dp">
</ProgressBar> </ProgressBar>
<ImageView <FrameLayout
android:id="@+id/home_change_api_loading" android:id="@+id/home_loading_statusbar"
android:layout_margin="10dp" android:layout_width="match_parent"
android:layout_gravity="end" android:layout_height="60dp">
android:background="?android:attr/selectableItemBackgroundBorderless" <ImageView
android:id="@+id/home_change_api_loading"
android:layout_margin="10dp"
android:layout_gravity="center_vertical|end"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_outline_settings_24" android:src="@drawable/ic_outline_settings_24"
android:layout_width="25dp" android:layout_width="25dp"
android:layout_height="25dp" android:layout_height="25dp"
android:contentDescription="@string/home_change_provider_img_des"> android:contentDescription="@string/home_change_provider_img_des">
</ImageView> </ImageView>
</FrameLayout>
</FrameLayout> </FrameLayout>
<LinearLayout <LinearLayout
android:visibility="gone" android:visibility="gone"
tools:visibility="gone" tools:visibility="visible"
android:id="@+id/home_loading_error" android:id="@+id/home_loading_error"
android:orientation="vertical" android:orientation="vertical"
android:layout_gravity="center" android:layout_gravity="center"
@ -47,6 +52,8 @@
android:layout_gravity="center" android:layout_gravity="center"
style="@style/WhiteButton" style="@style/WhiteButton"
android:layout_margin="5dp"
app:icon="@drawable/ic_baseline_autorenew_24" app:icon="@drawable/ic_baseline_autorenew_24"
android:text="@string/reload_error" android:text="@string/reload_error"
android:id="@+id/home_reload_connectionerror" android:id="@+id/home_reload_connectionerror"
@ -57,6 +64,8 @@
android:layout_gravity="center" android:layout_gravity="center"
style="@style/BlackButton" style="@style/BlackButton"
android:layout_margin="5dp"
app:icon="@drawable/ic_baseline_public_24" app:icon="@drawable/ic_baseline_public_24"
android:text="@string/result_open_in_browser" android:text="@string/result_open_in_browser"
android:id="@+id/home_reload_connection_open_in_browser" android:id="@+id/home_reload_connection_open_in_browser"
@ -74,7 +83,8 @@
/> />
</LinearLayout> </LinearLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
tools:visibility="visible" android:background="?attr/primaryBlackBackground"
tools:visibility="gone"
android:visibility="gone" android:visibility="gone"
android:id="@+id/home_loaded" android:id="@+id/home_loaded"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -84,26 +94,83 @@
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<ImageView <View
android:nextFocusDown="@id/home_main_info" android:background="?attr/darkBackground"
android:id="@+id/home_change_api" android:id="@+id/home_statusbar"
android:layout_margin="10dp" android:layout_height="wrap_content"
android:layout_gravity="end" android:layout_width="match_parent"/>
android:background="?android:attr/selectableItemBackgroundBorderless" <FrameLayout
android:id="@+id/home_settings_bar"
android:background="?attr/darkBackground"
android:layout_width="match_parent"
android:layout_height="60dp">
<LinearLayout
android:gravity="center"
android:paddingTop="10dp"
android:paddingBottom="10dp"
android:paddingStart="10dp"
android:paddingEnd="10dp"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_marginEnd="50dp"
android:layout_height="match_parent">
<TextView
android:gravity="center_vertical"
android:layout_gravity="center"
android:id="@+id/home_provider_name"
android:textColor="?attr/textColor"
android:textSize="20sp"
tools:text="Hello World"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TextView>
<TextView
android:gravity="center_vertical"
android:layout_gravity="center"
android:id="@+id/home_provider_meta_info"
android:textColor="?attr/grayTextColor"
android:textSize="14sp"
tools:text="Hello World"
android:layout_width="match_parent"
android:layout_height="wrap_content">
</TextView>
</LinearLayout>
<ImageView
android:nextFocusDown="@id/home_main_info"
android:id="@+id/home_change_api"
android:layout_margin="10dp"
android:layout_gravity="center|end"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_outline_settings_24"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/home_change_provider_img_des">
<requestFocus/>
</ImageView>
</FrameLayout>
android:src="@drawable/ic_outline_settings_24"
android:layout_width="25dp"
android:layout_height="25dp"
android:contentDescription="@string/home_change_provider_img_des">
<requestFocus/>
</ImageView>
<LinearLayout <LinearLayout
android:layout_marginTop="-20dp" android:layout_marginTop="10dp"
android:id="@+id/home_main_holder" android:id="@+id/home_main_holder"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView <androidx.recyclerview.widget.RecyclerView
android:descendantFocusability="afterDescendants"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
android:id="@+id/home_main_poster_recyclerview"
android:orientation="horizontal"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
tools:listitem="@layout/home_result_grid"
/>
<!--<ImageView
android:foreground="@drawable/outline_drawable" android:foreground="@drawable/outline_drawable"
android:id="@+id/home_main_poster" android:id="@+id/home_main_poster"
tools:src="@drawable/example_poster" tools:src="@drawable/example_poster"
@ -112,7 +179,7 @@
android:layout_width="150dp" android:layout_width="150dp"
android:layout_height="212dp" android:layout_height="212dp"
android:contentDescription="@string/home_main_poster_img_des"> android:contentDescription="@string/home_main_poster_img_des">
</ImageView> </ImageView>-->
<TextView <TextView
android:id="@+id/home_main_text" android:id="@+id/home_main_text"
android:layout_gravity="center" android:layout_gravity="center"
@ -123,31 +190,18 @@
android:textSize="15sp" android:textSize="15sp"
android:textColor="@color/textColor" android:textColor="@color/textColor"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"/> android:maxLines="2"
android:ellipsize="end"
android:layout_height="40sp"/>
<LinearLayout <LinearLayout
android:layout_gravity="center" android:layout_gravity="center"
android:gravity="center" android:gravity="center"
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<ImageView
android:nextFocusLeft="@id/home_reroll_next"
android:nextFocusUp="@id/home_change_api"
android:nextFocusRight="@id/home_main_play"
android:nextFocusDown="@id/home_watch_child_more_info"
android:layout_gravity="center"
android:layout_marginEnd="2dp"
android:id="@+id/home_reroll_prev"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_baseline_arrow_back_24"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="10dp"
android:contentDescription="@string/home_next_random_img_des">
</ImageView>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:nextFocusLeft="@id/home_reroll_prev" android:nextFocusLeft="@id/home_main_info"
android:nextFocusUp="@id/home_change_api" android:nextFocusUp="@id/home_change_api"
android:nextFocusRight="@id/home_main_info" android:nextFocusRight="@id/home_main_info"
android:nextFocusDown="@id/home_watch_child_more_info" android:nextFocusDown="@id/home_watch_child_more_info"
@ -164,7 +218,7 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:nextFocusLeft="@id/home_main_play" android:nextFocusLeft="@id/home_main_play"
android:nextFocusUp="@id/home_change_api" android:nextFocusUp="@id/home_change_api"
android:nextFocusRight="@id/home_reroll_next" android:nextFocusRight="@id/home_main_play"
android:nextFocusDown="@id/home_watch_child_more_info" android:nextFocusDown="@id/home_watch_child_more_info"
style="@style/BlackButton" style="@style/BlackButton"
@ -178,22 +232,6 @@
android:focusable="true" android:focusable="true"
android:layout_width="120dp"> android:layout_width="120dp">
</com.google.android.material.button.MaterialButton> </com.google.android.material.button.MaterialButton>
<ImageView
android:nextFocusLeft="@id/home_main_info"
android:nextFocusUp="@id/home_change_api"
android:nextFocusRight="@id/home_reroll_prev"
android:nextFocusDown="@id/home_watch_child_more_info"
android:layout_gravity="center"
android:layout_marginStart="2dp"
android:id="@+id/home_reroll_next"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:src="@drawable/ic_baseline_arrow_forward_24"
android:layout_width="40dp"
android:layout_height="40dp"
android:padding="10dp"
android:contentDescription="@string/home_next_random_img_des">
</ImageView>
</LinearLayout> </LinearLayout>
</LinearLayout> </LinearLayout>

View file

@ -21,62 +21,35 @@
android:id="@+id/result_loading_error" android:id="@+id/result_loading_error"
android:visibility="gone" android:visibility="gone"
tools:visibility="gone" tools:visibility="visible"
android:orientation="vertical" android:orientation="vertical"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/result_reload_connectionerror"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_height="50dp" style="@style/WhiteButton"
android:layout_margin="5dp"
android:visibility="visible" android:layout_margin="5dp"
android:textStyle="bold"
app:rippleColor="?attr/iconGrayBackground"
android:textColor="?attr/iconGrayBackground"
app:iconTint="?attr/iconGrayBackground"
android:textAllCaps="false"
app:iconGravity="textStart"
app:strokeColor="?attr/iconGrayBackground"
app:backgroundTint="?attr/textColor"
app:icon="@drawable/ic_baseline_autorenew_24" app:icon="@drawable/ic_baseline_autorenew_24"
app:iconSize="20dp"
android:text="@string/reload_error" android:text="@string/reload_error"
android:textSize="15sp" android:id="@+id/result_reload_connectionerror"
app:cornerRadius="5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:minWidth="200dp" android:minWidth="200dp"
> />
</com.google.android.material.button.MaterialButton>
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:id="@+id/result_reload_connection_open_in_browser"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_height="50dp" style="@style/BlackButton"
android:layout_margin="5dp" android:layout_margin="5dp"
app:iconGravity="textStart"
app:strokeColor="?attr/textColor"
android:backgroundTint="?attr/iconGrayBackground"
app:rippleColor="?attr/textColor"
android:textColor="?attr/textColor"
app:iconTint="?attr/textColor"
android:textAllCaps="false"
android:textStyle="bold"
app:icon="@drawable/ic_baseline_public_24" app:icon="@drawable/ic_baseline_public_24"
app:iconSize="20dp"
android:text="@string/result_open_in_browser" android:text="@string/result_open_in_browser"
android:textSize="15sp" android:id="@+id/result_reload_connection_open_in_browser"
app:cornerRadius="5dp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:minWidth="200dp" android:minWidth="200dp"
> />
</com.google.android.material.button.MaterialButton>
<TextView <TextView
android:layout_margin="5dp" android:layout_margin="5dp"
android:gravity="center" android:gravity="center"
@ -322,7 +295,7 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:layout_marginBottom="5dp" android:layout_marginBottom="10dp"
android:nextFocusUp="@id/result_descript" android:nextFocusUp="@id/result_descript"
android:nextFocusDown="@id/result_download_movie" android:nextFocusDown="@id/result_download_movie"
@ -339,6 +312,7 @@
<com.google.android.material.button.MaterialButton <com.google.android.material.button.MaterialButton
android:nextFocusUp="@id/result_play_movie" android:nextFocusUp="@id/result_play_movie"
android:nextFocusDown="@id/result_season_button" android:nextFocusDown="@id/result_season_button"
android:layout_marginBottom="10dp"
android:id="@+id/result_download_movie" android:id="@+id/result_download_movie"
style="@style/BlackButton" style="@style/BlackButton"

View file

@ -0,0 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- android:layout_width="114dp"
android:layout_height="180dp"-->
<androidx.cardview.widget.CardView
android:foreground="@drawable/outline_drawable"
android:layout_margin="2dp"
android:layout_width="148dp"
android:layout_height="234dp"
android:layout_marginBottom="2dp"
android:elevation="10dp"
app:cardCornerRadius="@dimen/roundedImageRadius"
android:id="@+id/backgroundCard"
app:cardBackgroundColor="@color/primaryGrayBackground"
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">
<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"/>
<!--
<LinearLayout
android:orientation="vertical"
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:textColor="@color/textColor"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:layout_marginBottom="5dp"
android:layout_gravity="end"
android:paddingBottom="4dp"
android:minWidth="50dp"
android:gravity="center"
android:background="@drawable/dub_bg_color"
android:layout_width="wrap_content" android:layout_height="wrap_content">
</TextView>
<TextView
android:id="@+id/text_is_sub"
android:text="@string/app_subbed_text"
android:layout_gravity="end"
android:textColor="@color/textColor"
android:paddingRight="10dp"
android:paddingLeft="10dp"
android:paddingTop="4dp"
android:paddingBottom="4dp"
android:minWidth="50dp"
android:gravity="center"
android:background="@drawable/sub_bg_color"
android:layout_width="wrap_content" android:layout_height="wrap_content"
/>
</LinearLayout>
-->
</androidx.cardview.widget.CardView>