mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
updated homepage UI
This commit is contained in:
parent
d5ae225070
commit
58f0af0187
11 changed files with 363 additions and 199 deletions
|
@ -34,8 +34,8 @@ android {
|
|||
applicationId "com.lagradost.cloudstream3"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 31
|
||||
versionCode 29
|
||||
versionName "2.1.0"
|
||||
versionCode 30
|
||||
versionName "2.1.1"
|
||||
|
||||
resValue "string", "app_version",
|
||||
"${defaultConfig.versionName}${versionNameSuffix ?: ""}"
|
||||
|
|
|
@ -11,12 +11,12 @@ import com.lagradost.cloudstream3.ui.search.SearchResultBuilder
|
|||
|
||||
class HomeChildItemAdapter(
|
||||
var cardList: List<SearchResponse>,
|
||||
val layout: Int = R.layout.home_result_grid,
|
||||
private val clickCallback: (SearchClickCallback) -> Unit
|
||||
) :
|
||||
RecyclerView.Adapter<RecyclerView.ViewHolder>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): RecyclerView.ViewHolder {
|
||||
val layout = R.layout.home_result_grid
|
||||
return CardViewHolder(
|
||||
LayoutInflater.from(parent.context).inflate(layout, parent, false), clickCallback
|
||||
)
|
||||
|
@ -25,7 +25,7 @@ class HomeChildItemAdapter(
|
|||
override fun onBindViewHolder(holder: RecyclerView.ViewHolder, position: Int) {
|
||||
when (holder) {
|
||||
is CardViewHolder -> {
|
||||
holder.bind(cardList[position])
|
||||
holder.bind(cardList[position], position)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -34,12 +34,21 @@ class HomeChildItemAdapter(
|
|||
return cardList.size
|
||||
}
|
||||
|
||||
override fun getItemId(position: Int): Long {
|
||||
return (cardList[position].id ?: position).toLong()
|
||||
}
|
||||
|
||||
class CardViewHolder
|
||||
constructor(itemView: View, private val clickCallback: (SearchClickCallback) -> Unit) :
|
||||
RecyclerView.ViewHolder(itemView) {
|
||||
|
||||
fun bind(card: SearchResponse) {
|
||||
fun bind(card: SearchResponse, index: Int) {
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,10 +15,13 @@ import androidx.core.view.isVisible
|
|||
import androidx.fragment.app.Fragment
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import androidx.recyclerview.widget.GridLayoutManager
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.LinearSnapHelper
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.APIHolder.apis
|
||||
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
|
||||
import com.lagradost.cloudstream3.mvvm.Resource
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
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.HOMEPAGE_API
|
||||
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.popupMenuNoIcons
|
||||
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.*
|
||||
|
||||
const val HOME_BOOKMARK_VALUE = "home_bookmarked_last"
|
||||
|
@ -106,61 +110,32 @@ class HomeFragment : Fragment() {
|
|||
}
|
||||
|
||||
private var currentHomePage: HomePageResponse? = null
|
||||
var currentMainIndex = 0
|
||||
var currentMainList: ArrayList<SearchResponse> = ArrayList()
|
||||
|
||||
private fun toggleMainVisibility(visible: Boolean) {
|
||||
home_main_holder.isVisible = visible
|
||||
}
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
private fun chooseRandomMainPage(item: SearchResponse? = null): SearchResponse? {
|
||||
private fun chooseRandomMainPage() {
|
||||
val home = currentHomePage
|
||||
if (home != null && home.items.isNotEmpty()) {
|
||||
var random: SearchResponse? = item
|
||||
|
||||
var breakCount = 0
|
||||
val MAX_BREAK_COUNT = 10
|
||||
|
||||
while (random?.posterUrl == null) {
|
||||
try {
|
||||
random = home.items.random().list.random()
|
||||
} catch (e: Exception) {
|
||||
// probs Collection is empty.
|
||||
val randomItems = home.items.shuffled().flatMap { it.list }.distinctBy { it.url }.toList().shuffled()
|
||||
if (randomItems.isNullOrEmpty()) {
|
||||
toggleMainVisibility(false)
|
||||
} else {
|
||||
home_main_poster_recyclerview.adapter =
|
||||
HomeChildItemAdapter(randomItems, R.layout.home_result_big_grid) { callback ->
|
||||
handleSearchClickCallback(activity, callback)
|
||||
}
|
||||
|
||||
breakCount++
|
||||
if (breakCount > MAX_BREAK_COUNT) {
|
||||
break
|
||||
home_main_poster_recyclerview.post {
|
||||
(home_main_poster_recyclerview.layoutManager as CenterZoomLayoutManager?)?.updateSize(forceUpdate = true)
|
||||
}
|
||||
}
|
||||
|
||||
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)
|
||||
return random
|
||||
} else {
|
||||
toggleMainVisibility(false)
|
||||
return null
|
||||
}
|
||||
} else {
|
||||
toggleMainVisibility(false)
|
||||
}
|
||||
return null
|
||||
}
|
||||
|
||||
private fun fixGrid() {
|
||||
|
@ -214,39 +189,30 @@ class HomeFragment : Fragment() {
|
|||
}
|
||||
}*/
|
||||
|
||||
@SuppressLint("SetTextI18n")
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
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_loading.setOnClickListener(apiChangeClickListener)
|
||||
|
||||
observe(homeViewModel.apiName) {
|
||||
context?.setKey(HOMEPAGE_API, it)
|
||||
observe(homeViewModel.apiName) { apiName ->
|
||||
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 ->
|
||||
|
@ -266,11 +232,7 @@ class HomeFragment : Fragment() {
|
|||
}
|
||||
|
||||
home_master_recycler?.adapter?.notifyDataSetChanged()
|
||||
currentMainList.clear()
|
||||
chooseRandomMainPage()?.let { response ->
|
||||
currentMainList.add(response)
|
||||
}
|
||||
currentMainIndex = 0
|
||||
chooseRandomMainPage()
|
||||
|
||||
home_loading.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.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()
|
||||
val apiName = context?.getKey<String>(HOMEPAGE_API)
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,7 +47,7 @@ class ParentItemAdapter(
|
|||
private val moreInfo: FrameLayout = itemView.home_child_more_info
|
||||
fun bind(info: HomePageList) {
|
||||
title.text = info.name
|
||||
recyclerView.adapter = HomeChildItemAdapter(info.list, clickCallback)
|
||||
recyclerView.adapter = HomeChildItemAdapter(info.list, clickCallback = clickCallback)
|
||||
(recyclerView.adapter as HomeChildItemAdapter).notifyDataSetChanged()
|
||||
|
||||
moreInfo.setOnClickListener {
|
||||
|
|
|
@ -39,6 +39,7 @@ import com.lagradost.cloudstream3.MainActivity.Companion.getCastSession
|
|||
import com.lagradost.cloudstream3.MainActivity.Companion.showToast
|
||||
import com.lagradost.cloudstream3.mvvm.Resource
|
||||
import com.lagradost.cloudstream3.mvvm.logError
|
||||
import com.lagradost.cloudstream3.mvvm.normalSafeApiCall
|
||||
import com.lagradost.cloudstream3.mvvm.observe
|
||||
import com.lagradost.cloudstream3.ui.WatchType
|
||||
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_ACTION_DOWNLOAD
|
||||
|
@ -310,7 +311,8 @@ class ResultFragment : Fragment() {
|
|||
CastButtonFactory.setUpMediaRouteButton(it, media_route_button)
|
||||
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 ->
|
||||
if (media_route_button != null) {
|
||||
if (state == CastState.NO_DEVICES_AVAILABLE) media_route_button.visibility = GONE else {
|
||||
|
@ -535,6 +537,7 @@ class ResultFragment : Fragment() {
|
|||
val topFolder = "$folder"
|
||||
|
||||
withContext(Dispatchers.IO) {
|
||||
normalSafeApiCall {
|
||||
VideoDownloadManager.downloadThing(
|
||||
ctx,
|
||||
link,
|
||||
|
@ -552,6 +555,7 @@ class ResultFragment : Fragment() {
|
|||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
val isLoaded = when (episodeClick.action) {
|
||||
ACTION_PLAY_EPISODE_IN_PLAYER -> true
|
||||
|
|
|
@ -19,11 +19,10 @@ object SearchResultBuilder {
|
|||
itemView: View
|
||||
) {
|
||||
val cardView: ImageView = itemView.imageView
|
||||
val cardText: TextView = itemView.imageText
|
||||
val cardText: TextView? = itemView.imageText
|
||||
|
||||
val textIsDub: TextView? = itemView.text_is_dub
|
||||
val textIsSub: TextView? = itemView.text_is_sub
|
||||
println(card.name)
|
||||
|
||||
val bg: CardView = itemView.backgroundCard
|
||||
|
||||
|
@ -37,7 +36,7 @@ object SearchResultBuilder {
|
|||
textIsDub?.visibility = View.GONE
|
||||
textIsSub?.visibility = View.GONE
|
||||
|
||||
cardText.text = card.name
|
||||
cardText?.text = card.name
|
||||
|
||||
//imageTextProvider.text = card.apiName
|
||||
cardView.setImage(card.posterUrl)
|
||||
|
@ -69,7 +68,7 @@ object SearchResultBuilder {
|
|||
playImg?.visibility = View.VISIBLE
|
||||
|
||||
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 -> {
|
||||
|
|
|
@ -214,6 +214,12 @@ object UIHelper {
|
|||
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 {
|
||||
var result = 0
|
||||
val resourceId = resources.getIdentifier("navigation_bar_height", "dimen", "android")
|
||||
|
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,7 +11,7 @@
|
|||
|
||||
<FrameLayout
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/home_loading"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
@ -22,10 +22,14 @@
|
|||
android:layout_width="50dp"
|
||||
android:layout_height="50dp">
|
||||
</ProgressBar>
|
||||
<FrameLayout
|
||||
android:id="@+id/home_loading_statusbar"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="60dp">
|
||||
<ImageView
|
||||
android:id="@+id/home_change_api_loading"
|
||||
android:layout_margin="10dp"
|
||||
android:layout_gravity="end"
|
||||
android:layout_gravity="center_vertical|end"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
|
||||
android:src="@drawable/ic_outline_settings_24"
|
||||
|
@ -34,10 +38,11 @@
|
|||
android:contentDescription="@string/home_change_provider_img_des">
|
||||
</ImageView>
|
||||
</FrameLayout>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:id="@+id/home_loading_error"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center"
|
||||
|
@ -47,6 +52,8 @@
|
|||
android:layout_gravity="center"
|
||||
style="@style/WhiteButton"
|
||||
|
||||
android:layout_margin="5dp"
|
||||
|
||||
app:icon="@drawable/ic_baseline_autorenew_24"
|
||||
android:text="@string/reload_error"
|
||||
android:id="@+id/home_reload_connectionerror"
|
||||
|
@ -57,6 +64,8 @@
|
|||
android:layout_gravity="center"
|
||||
style="@style/BlackButton"
|
||||
|
||||
android:layout_margin="5dp"
|
||||
|
||||
app:icon="@drawable/ic_baseline_public_24"
|
||||
android:text="@string/result_open_in_browser"
|
||||
android:id="@+id/home_reload_connection_open_in_browser"
|
||||
|
@ -74,7 +83,8 @@
|
|||
/>
|
||||
</LinearLayout>
|
||||
<androidx.core.widget.NestedScrollView
|
||||
tools:visibility="visible"
|
||||
android:background="?attr/primaryBlackBackground"
|
||||
tools:visibility="gone"
|
||||
android:visibility="gone"
|
||||
android:id="@+id/home_loaded"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -84,11 +94,56 @@
|
|||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<View
|
||||
android:background="?attr/darkBackground"
|
||||
android:id="@+id/home_statusbar"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"/>
|
||||
<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="end"
|
||||
android:layout_gravity="center|end"
|
||||
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||
|
||||
android:src="@drawable/ic_outline_settings_24"
|
||||
|
@ -97,13 +152,25 @@
|
|||
android:contentDescription="@string/home_change_provider_img_des">
|
||||
<requestFocus/>
|
||||
</ImageView>
|
||||
</FrameLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_marginTop="-20dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:id="@+id/home_main_holder"
|
||||
android:orientation="vertical"
|
||||
android:layout_width="match_parent"
|
||||
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:id="@+id/home_main_poster"
|
||||
tools:src="@drawable/example_poster"
|
||||
|
@ -112,7 +179,7 @@
|
|||
android:layout_width="150dp"
|
||||
android:layout_height="212dp"
|
||||
android:contentDescription="@string/home_main_poster_img_des">
|
||||
</ImageView>
|
||||
</ImageView>-->
|
||||
<TextView
|
||||
android:id="@+id/home_main_text"
|
||||
android:layout_gravity="center"
|
||||
|
@ -123,31 +190,18 @@
|
|||
android:textSize="15sp"
|
||||
android:textColor="@color/textColor"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"/>
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:layout_height="40sp"/>
|
||||
<LinearLayout
|
||||
android:layout_gravity="center"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
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
|
||||
android:nextFocusLeft="@id/home_reroll_prev"
|
||||
android:nextFocusLeft="@id/home_main_info"
|
||||
android:nextFocusUp="@id/home_change_api"
|
||||
android:nextFocusRight="@id/home_main_info"
|
||||
android:nextFocusDown="@id/home_watch_child_more_info"
|
||||
|
@ -164,7 +218,7 @@
|
|||
<com.google.android.material.button.MaterialButton
|
||||
android:nextFocusLeft="@id/home_main_play"
|
||||
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"
|
||||
|
||||
style="@style/BlackButton"
|
||||
|
@ -178,22 +232,6 @@
|
|||
android:focusable="true"
|
||||
android:layout_width="120dp">
|
||||
</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>
|
||||
|
||||
|
|
|
@ -21,62 +21,35 @@
|
|||
android:id="@+id/result_loading_error"
|
||||
|
||||
android:visibility="gone"
|
||||
tools:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:orientation="vertical"
|
||||
android:layout_gravity="center"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:id="@+id/result_reload_connectionerror"
|
||||
|
||||
android:layout_gravity="center"
|
||||
android:layout_height="50dp"
|
||||
android:layout_margin="5dp"
|
||||
style="@style/WhiteButton"
|
||||
|
||||
android:visibility="visible"
|
||||
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"
|
||||
android:layout_margin="5dp"
|
||||
|
||||
app:icon="@drawable/ic_baseline_autorenew_24"
|
||||
app:iconSize="20dp"
|
||||
android:text="@string/reload_error"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="5dp"
|
||||
android:id="@+id/result_reload_connectionerror"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="200dp"
|
||||
>
|
||||
</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_height="50dp"
|
||||
style="@style/BlackButton"
|
||||
|
||||
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:iconSize="20dp"
|
||||
android:text="@string/result_open_in_browser"
|
||||
android:textSize="15sp"
|
||||
app:cornerRadius="5dp"
|
||||
android:id="@+id/result_reload_connection_open_in_browser"
|
||||
android:layout_width="wrap_content"
|
||||
android:minWidth="200dp"
|
||||
>
|
||||
</com.google.android.material.button.MaterialButton>
|
||||
/>
|
||||
<TextView
|
||||
android:layout_margin="5dp"
|
||||
android:gravity="center"
|
||||
|
@ -322,7 +295,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
<com.google.android.material.button.MaterialButton
|
||||
android:layout_marginBottom="5dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:nextFocusUp="@id/result_descript"
|
||||
android:nextFocusDown="@id/result_download_movie"
|
||||
|
||||
|
@ -339,6 +312,7 @@
|
|||
<com.google.android.material.button.MaterialButton
|
||||
android:nextFocusUp="@id/result_play_movie"
|
||||
android:nextFocusDown="@id/result_season_button"
|
||||
android:layout_marginBottom="10dp"
|
||||
|
||||
android:id="@+id/result_download_movie"
|
||||
style="@style/BlackButton"
|
||||
|
|
64
app/src/main/res/layout/home_result_big_grid.xml
Normal file
64
app/src/main/res/layout/home_result_big_grid.xml
Normal 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>
|
Loading…
Reference in a new issue