Separate loading view from homepage

This commit is contained in:
lakor 2022-12-24 22:23:52 +08:00
parent 4f4061961a
commit c4cf0d9bab
9 changed files with 276 additions and 350 deletions

View file

@ -4,9 +4,7 @@ import android.annotation.SuppressLint
import android.app.Activity import android.app.Activity
import android.content.Context import android.content.Context
import android.content.DialogInterface import android.content.DialogInterface
import android.content.Intent
import android.content.res.Configuration import android.content.res.Configuration
import android.net.Uri
import android.os.Build import android.os.Build
import android.os.Bundle import android.os.Bundle
import android.view.LayoutInflater import android.view.LayoutInflater
@ -33,7 +31,6 @@ import com.google.android.material.button.MaterialButton
import com.google.android.material.chip.Chip import com.google.android.material.chip.Chip
import com.google.android.material.chip.ChipGroup import com.google.android.material.chip.ChipGroup
import com.lagradost.cloudstream3.* import com.lagradost.cloudstream3.*
import com.lagradost.cloudstream3.APIHolder.apis
import com.lagradost.cloudstream3.APIHolder.filterProviderByPreferredMedia import com.lagradost.cloudstream3.APIHolder.filterProviderByPreferredMedia
import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull import com.lagradost.cloudstream3.APIHolder.getApiFromNameNull
import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings import com.lagradost.cloudstream3.APIHolder.getApiProviderLangSettings
@ -79,7 +76,6 @@ import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbarView import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbarView
import com.lagradost.cloudstream3.utils.UIHelper.getResourceColor import com.lagradost.cloudstream3.utils.UIHelper.getResourceColor
import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
import com.lagradost.cloudstream3.utils.UIHelper.setImage import com.lagradost.cloudstream3.utils.UIHelper.setImage
import com.lagradost.cloudstream3.utils.UIHelper.setImageBlur import com.lagradost.cloudstream3.utils.UIHelper.setImageBlur
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
@ -88,18 +84,11 @@ import kotlinx.android.synthetic.main.fragment_home.*
import kotlinx.android.synthetic.main.fragment_home.home_api_fab import kotlinx.android.synthetic.main.fragment_home.home_api_fab
import kotlinx.android.synthetic.main.fragment_home.home_bookmarked_child_recyclerview import kotlinx.android.synthetic.main.fragment_home.home_bookmarked_child_recyclerview
import kotlinx.android.synthetic.main.fragment_home.home_bookmarked_holder import kotlinx.android.synthetic.main.fragment_home.home_bookmarked_holder
import kotlinx.android.synthetic.main.fragment_home.home_change_api_loading
import kotlinx.android.synthetic.main.fragment_home.home_loaded import kotlinx.android.synthetic.main.fragment_home.home_loaded
import kotlinx.android.synthetic.main.fragment_home.home_loading
import kotlinx.android.synthetic.main.fragment_home.home_loading_error
import kotlinx.android.synthetic.main.fragment_home.home_loading_shimmer
import kotlinx.android.synthetic.main.fragment_home.home_loading_statusbar
import kotlinx.android.synthetic.main.fragment_home.home_master_recycler import kotlinx.android.synthetic.main.fragment_home.home_master_recycler
import kotlinx.android.synthetic.main.fragment_home.home_plan_to_watch_btt import kotlinx.android.synthetic.main.fragment_home.home_plan_to_watch_btt
import kotlinx.android.synthetic.main.fragment_home.home_provider_meta_info import kotlinx.android.synthetic.main.fragment_home.home_provider_meta_info
import kotlinx.android.synthetic.main.fragment_home.home_provider_name import kotlinx.android.synthetic.main.fragment_home.home_provider_name
import kotlinx.android.synthetic.main.fragment_home.home_reload_connection_open_in_browser
import kotlinx.android.synthetic.main.fragment_home.home_reload_connectionerror
import kotlinx.android.synthetic.main.fragment_home.home_type_completed_btt import kotlinx.android.synthetic.main.fragment_home.home_type_completed_btt
import kotlinx.android.synthetic.main.fragment_home.home_type_dropped_btt import kotlinx.android.synthetic.main.fragment_home.home_type_dropped_btt
import kotlinx.android.synthetic.main.fragment_home.home_type_on_hold_btt import kotlinx.android.synthetic.main.fragment_home.home_type_on_hold_btt
@ -107,7 +96,6 @@ import kotlinx.android.synthetic.main.fragment_home.home_type_watching_btt
import kotlinx.android.synthetic.main.fragment_home.home_watch_child_recyclerview import kotlinx.android.synthetic.main.fragment_home.home_watch_child_recyclerview
import kotlinx.android.synthetic.main.fragment_home.home_watch_holder import kotlinx.android.synthetic.main.fragment_home.home_watch_holder
import kotlinx.android.synthetic.main.fragment_home.home_watch_parent_item_title import kotlinx.android.synthetic.main.fragment_home.home_watch_parent_item_title
import kotlinx.android.synthetic.main.fragment_home.result_error_text
import kotlinx.android.synthetic.main.fragment_home_tv.* import kotlinx.android.synthetic.main.fragment_home_tv.*
import kotlinx.android.synthetic.main.fragment_search.* import kotlinx.android.synthetic.main.fragment_search.*
import kotlinx.android.synthetic.main.home_episodes_expanded.* import kotlinx.android.synthetic.main.home_episodes_expanded.*
@ -538,7 +526,6 @@ class HomeFragment : Fragment() {
fixGrid() fixGrid()
home_change_api?.setOnClickListener(apiChangeClickListener) home_change_api?.setOnClickListener(apiChangeClickListener)
home_change_api_loading?.setOnClickListener(apiChangeClickListener)
home_api_fab?.setOnClickListener(apiChangeClickListener) home_api_fab?.setOnClickListener(apiChangeClickListener)
home_random?.setOnClickListener { home_random?.setOnClickListener {
if (listHomepageItems.isNotEmpty()) { if (listHomepageItems.isNotEmpty()) {
@ -763,7 +750,7 @@ class HomeFragment : Fragment() {
observe(homeViewModel.page) { data -> observe(homeViewModel.page) { data ->
when (data) { when (data) {
is Resource.Success -> { is Resource.Success -> {
home_loading_shimmer?.stopShimmer() removeLoadingStatusFragment()
val d = data.value val d = data.value
val mutableListOfResponse = mutableListOf<SearchResponse>() val mutableListOfResponse = mutableListOf<SearchResponse>()
@ -775,8 +762,6 @@ class HomeFragment : Fragment() {
home_master_recycler home_master_recycler
) )
home_loading?.isVisible = false
home_loading_error?.isVisible = false
home_loaded?.isVisible = true home_loaded?.isVisible = true
if (toggleRandomButton) { if (toggleRandomButton) {
//Flatten list //Flatten list
@ -790,40 +775,12 @@ class HomeFragment : Fragment() {
} }
} }
is Resource.Failure -> { is Resource.Failure -> {
home_loading_shimmer?.stopShimmer() showLoadFailedFragment()
result_error_text.text = data.errorString
home_reload_connectionerror.setOnClickListener(apiChangeClickListener)
home_reload_connection_open_in_browser.setOnClickListener { view ->
val validAPIs = apis//.filter { api -> api.hasMainPage }
view.popupMenuNoIconsAndNoStringRes(validAPIs.mapIndexed { index, api ->
Pair(
index,
api.name
)
}) {
try {
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(validAPIs[itemId].mainUrl)
startActivity(i)
} catch (e: Exception) {
logError(e)
}
}
}
home_loading?.isVisible = false
home_loading_error?.isVisible = true
home_loaded?.isVisible = false home_loaded?.isVisible = false
} }
is Resource.Loading -> { is Resource.Loading -> {
showLoadingFragment()
(home_master_recycler?.adapter as? ParentItemAdapter?)?.updateList(listOf()) (home_master_recycler?.adapter as? ParentItemAdapter?)?.updateList(listOf())
home_loading_shimmer?.startShimmer()
home_loading?.isVisible = true
home_loading_error?.isVisible = false
home_loaded?.isVisible = false home_loaded?.isVisible = false
} }
} }
@ -1101,7 +1058,6 @@ class HomeFragment : Fragment() {
//context?.fixPaddingStatusbarView(home_statusbar) //context?.fixPaddingStatusbarView(home_statusbar)
context?.fixPaddingStatusbar(home_padding) context?.fixPaddingStatusbar(home_padding)
context?.fixPaddingStatusbar(home_loading_statusbar)
home_master_recycler.adapter = home_master_recycler.adapter =
ParentItemAdapter(mutableListOf(), { callback -> ParentItemAdapter(mutableListOf(), { callback ->
@ -1144,9 +1100,6 @@ class HomeFragment : Fragment() {
home_api_fab?.isVisible = false home_api_fab?.isVisible = false
home_change_api?.isVisible = true home_change_api?.isVisible = true
if (isTrueTvSettings()) { if (isTrueTvSettings()) {
home_change_api_loading?.isVisible = true
home_change_api_loading?.isFocusable = true
home_change_api_loading?.isFocusableInTouchMode = true
home_change_api?.isFocusable = true home_change_api?.isFocusable = true
home_change_api?.isFocusableInTouchMode = true home_change_api?.isFocusableInTouchMode = true
} }
@ -1155,7 +1108,6 @@ class HomeFragment : Fragment() {
} else { } else {
home_api_fab?.isVisible = true home_api_fab?.isVisible = true
home_change_api?.isVisible = false home_change_api?.isVisible = false
home_change_api_loading?.isVisible = false
} }
for (syncApi in OAuth2Apis) { for (syncApi in OAuth2Apis) {
@ -1171,4 +1123,26 @@ class HomeFragment : Fragment() {
} }
} }
} }
private fun showLoadingFragment() {
showFragment(HomeLoadingFragment::class.java)
}
private fun showLoadFailedFragment() {
showFragment(HomeLoadFailedFragment::class.java)
}
private fun removeLoadingStatusFragment() {
childFragmentManager.findFragmentById(R.id.home_load_status_holder)?.let {
childFragmentManager.beginTransaction()
.remove(it)
.commitNow()
}
}
private fun showFragment(fragmentClass: Class<out Fragment>) {
childFragmentManager.beginTransaction()
.replace(R.id.home_load_status_holder, fragmentClass, null, null)
.commit()
}
} }

View file

@ -0,0 +1,57 @@
package com.lagradost.cloudstream3.ui.home
import android.content.Intent
import android.net.Uri
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import com.lagradost.cloudstream3.APIHolder
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.mvvm.Resource
import com.lagradost.cloudstream3.mvvm.logError
import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.selectHomepage
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
import kotlinx.android.synthetic.main.fragment_home_load_failed.*
class HomeLoadFailedFragment : Fragment() {
private val homeViewModel: HomeViewModel by activityViewModels()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_home_load_failed, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
home_reload_connectionerror.setOnClickListener {
requireContext().selectHomepage(homeViewModel.apiNameString) { api ->
homeViewModel.loadAndCancel(api)
}
}
home_reload_connection_open_in_browser.setOnClickListener { button ->
val validAPIs = APIHolder.apis//.filter { api -> api.hasMainPage }
button.popupMenuNoIconsAndNoStringRes(validAPIs.mapIndexed { index, api ->
Pair(
index,
api.name
)
}) {
try {
val i = Intent(Intent.ACTION_VIEW)
i.data = Uri.parse(validAPIs[itemId].mainUrl)
startActivity(i)
} catch (e: Exception) {
logError(e)
}
}
}
result_error_text.text = (homeViewModel.page.value as? Resource.Failure)?.errorString
}
}

View file

@ -0,0 +1,44 @@
package com.lagradost.cloudstream3.ui.home
import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import androidx.core.view.isVisible
import androidx.fragment.app.Fragment
import androidx.fragment.app.activityViewModels
import com.lagradost.cloudstream3.R
import com.lagradost.cloudstream3.ui.home.HomeFragment.Companion.selectHomepage
import com.lagradost.cloudstream3.ui.settings.SettingsFragment
import com.lagradost.cloudstream3.utils.UIHelper.fixPaddingStatusbar
import kotlinx.android.synthetic.main.fragment_home_loading.*
class HomeLoadingFragment : Fragment() {
private val homeViewModel: HomeViewModel by activityViewModels()
override fun onCreateView(
inflater: LayoutInflater,
container: ViewGroup?,
savedInstanceState: Bundle?
): View? {
return inflater.inflate(R.layout.fragment_home_loading, container, false)
}
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
home_loading_shimmer?.startShimmer()
requireContext().fixPaddingStatusbar(home_loading_statusbar)
home_change_api_loading.setOnClickListener {
requireContext().selectHomepage(homeViewModel.apiNameString) { api ->
homeViewModel.loadAndCancel(api)
}
}
if (SettingsFragment.isTrueTvSettings()) {
home_change_api_loading?.isVisible = true
home_change_api_loading?.isFocusable = true
home_change_api_loading?.isFocusableInTouchMode = true
} else {
home_change_api_loading?.isVisible = false
}
}
}

View file

@ -77,6 +77,8 @@ class HomeViewModel : ViewModel() {
private val _apiName = MutableLiveData<String>() private val _apiName = MutableLiveData<String>()
val apiName: LiveData<String> = _apiName val apiName: LiveData<String> = _apiName
val apiNameString: String? get() = apiName.value
private val _randomItems = MutableLiveData<List<SearchResponse>?>(null) private val _randomItems = MutableLiveData<List<SearchResponse>?>(null)
val randomItems: LiveData<List<SearchResponse>?> = _randomItems val randomItems: LiveData<List<SearchResponse>?> = _randomItems

View file

@ -4,155 +4,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/home_root" android:id="@+id/home_root"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
tools:context=".ui.home.HomeFragment"> tools:context=".ui.home.HomeFragment">
<FrameLayout
android:id="@+id/home_loading"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:visibility="gone"
tools:visibility="gone">
<ProgressBar
android:layout_width="50dp"
android:layout_height="50dp"
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="gone" />
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/home_loading_shimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:orientation="vertical"
android:paddingTop="40dp"
app:shimmer_auto_start="true"
app:shimmer_base_alpha="0.2"
app:shimmer_duration="@integer/loading_time"
app:shimmer_highlight_alpha="0.3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:layout_margin="@dimen/loading_margin"
android:background="@color/grayShimmer"
android:translationX="-164dp"
app:cardCornerRadius="@dimen/loading_radius" />
<androidx.cardview.widget.CardView
android:layout_width="148dp"
android:layout_height="234dp"
android:layout_gravity="center"
android:layout_margin="@dimen/loading_margin"
android:background="@color/grayShimmer"
app:cardCornerRadius="@dimen/loading_radius" />
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:layout_margin="@dimen/loading_margin"
android:background="@color/grayShimmer"
android:translationX="164dp"
app:cardCornerRadius="@dimen/loading_radius" />
</FrameLayout>
<include layout="@layout/loading_line_short_center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/result_padding"
android:layout_marginTop="@dimen/result_padding"
android:layout_marginEnd="@dimen/result_padding"
android:orientation="vertical">
<include layout="@layout/loading_list" />
<include layout="@layout/loading_list" />
<include layout="@layout/loading_list" />
</LinearLayout>
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<FrameLayout
android:id="@+id/home_loading_statusbar"
android:layout_width="match_parent"
android:layout_height="70dp">
<ImageView
android:id="@+id/home_change_api_loading"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical|end"
android:layout_margin="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/home_change_provider_img_des"
android:src="@drawable/ic_baseline_keyboard_arrow_down_24" />
</FrameLayout>
</FrameLayout>
<LinearLayout
android:id="@+id/home_loading_error"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:orientation="vertical"
android:visibility="gone"
tools:visibility="gone">
<com.google.android.material.button.MaterialButton
android:id="@+id/home_reload_connectionerror"
style="@style/WhiteButton"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:minWidth="200dp"
android:text="@string/reload_error"
app:icon="@drawable/ic_baseline_autorenew_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/home_reload_connection_open_in_browser"
style="@style/BlackButton"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:minWidth="200dp"
android:text="@string/result_open_in_browser"
app:icon="@drawable/ic_baseline_public_24" />
<TextView
android:id="@+id/result_error_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
android:textColor="?attr/textColor" />
</LinearLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:id="@+id/home_loaded" android:id="@+id/home_loaded"
android:layout_width="match_parent" android:layout_width="match_parent"
@ -583,6 +437,11 @@
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<FrameLayout
android:id="@+id/home_load_status_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:id="@+id/home_api_fab" android:id="@+id/home_api_fab"
style="@style/ExtendedFloatingActionButton" style="@style/ExtendedFloatingActionButton"

View file

@ -0,0 +1,38 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/home_loading_error"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical">
<com.google.android.material.button.MaterialButton
android:id="@+id/home_reload_connectionerror"
style="@style/WhiteButton"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:minWidth="200dp"
android:text="@string/reload_error"
app:icon="@drawable/ic_baseline_autorenew_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/home_reload_connection_open_in_browser"
style="@style/BlackButton"
android:layout_width="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:minWidth="200dp"
android:text="@string/result_open_in_browser"
app:icon="@drawable/ic_baseline_public_24" />
<TextView
android:id="@+id/result_error_text"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="5dp"
android:gravity="center"
android:textColor="?attr/textColor" />
</LinearLayout>

View file

@ -0,0 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/home_loading"
android:layout_width="match_parent"
android:layout_height="match_parent">
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/home_loading_shimmer"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:orientation="vertical"
android:paddingTop="40dp"
app:shimmer_auto_start="true"
app:shimmer_base_alpha="0.2"
app:shimmer_duration="@integer/loading_time"
app:shimmer_highlight_alpha="0.3">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:layout_margin="@dimen/loading_margin"
android:background="@color/grayShimmer"
android:translationX="-164dp"
app:cardCornerRadius="@dimen/loading_radius" />
<androidx.cardview.widget.CardView
android:layout_width="148dp"
android:layout_height="234dp"
android:layout_gravity="center"
android:layout_margin="@dimen/loading_margin"
android:background="@color/grayShimmer"
app:cardCornerRadius="@dimen/loading_radius" />
<androidx.cardview.widget.CardView
android:layout_width="125dp"
android:layout_height="200dp"
android:layout_gravity="center"
android:layout_margin="@dimen/loading_margin"
android:background="@color/grayShimmer"
android:translationX="164dp"
app:cardCornerRadius="@dimen/loading_radius" />
</FrameLayout>
<include layout="@layout/loading_line_short_center" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/result_padding"
android:layout_marginTop="@dimen/result_padding"
android:layout_marginEnd="@dimen/result_padding"
android:orientation="vertical">
<include layout="@layout/loading_list" />
<include layout="@layout/loading_list" />
<include layout="@layout/loading_list" />
</LinearLayout>
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<FrameLayout
android:id="@+id/home_loading_statusbar"
android:layout_width="match_parent"
android:layout_height="70dp">
<ImageView
android:id="@+id/home_change_api_loading"
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center_vertical|end"
android:layout_margin="10dp"
android:background="?android:attr/selectableItemBackgroundBorderless"
android:contentDescription="@string/home_change_provider_img_des"
android:src="@drawable/ic_baseline_keyboard_arrow_down_24" />
</FrameLayout>
</FrameLayout>

View file

@ -4,155 +4,9 @@
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:id="@+id/home_root" android:id="@+id/home_root"
tools:context=".ui.home.HomeFragment"> tools:context=".ui.home.HomeFragment">
<FrameLayout
android:visibility="gone"
tools:visibility="gone"
android:id="@+id/home_loading"
android:layout_width="match_parent"
android:layout_height="match_parent">
<ProgressBar
android:layout_gravity="center"
android:visibility="gone"
tools:visibility="gone"
android:layout_width="50dp"
android:layout_height="50dp" />
<com.facebook.shimmer.ShimmerFrameLayout
android:id="@+id/home_loading_shimmer"
app:shimmer_base_alpha="0.2"
app:shimmer_highlight_alpha="0.3"
app:shimmer_duration="@integer/loading_time"
app:shimmer_auto_start="true"
android:paddingTop="40dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center"
android:layout_marginTop="15dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<FrameLayout
android:orientation="horizontal"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<androidx.cardview.widget.CardView
android:layout_margin="@dimen/loading_margin"
android:layout_gravity="center"
app:cardCornerRadius="@dimen/loading_radius"
android:background="@color/grayShimmer"
android:translationX="-164dp"
android:layout_width="125dp"
android:layout_height="200dp" />
<androidx.cardview.widget.CardView
android:layout_margin="@dimen/loading_margin"
android:layout_gravity="center"
app:cardCornerRadius="@dimen/loading_radius"
android:background="@color/grayShimmer"
android:layout_width="148dp"
android:layout_height="234dp" />
<androidx.cardview.widget.CardView
android:layout_margin="@dimen/loading_margin"
android:layout_gravity="center"
app:cardCornerRadius="@dimen/loading_radius"
android:background="@color/grayShimmer"
android:translationX="164dp"
android:layout_width="125dp"
android:layout_height="200dp" />
</FrameLayout>
<include layout="@layout/loading_line_short_center" />
<LinearLayout
android:orientation="vertical"
android:layout_marginTop="@dimen/result_padding"
android:layout_marginStart="@dimen/result_padding"
android:layout_marginEnd="@dimen/result_padding"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<include layout="@layout/loading_list" />
<include layout="@layout/loading_list" />
<include layout="@layout/loading_list" />
</LinearLayout>
</LinearLayout>
</com.facebook.shimmer.ShimmerFrameLayout>
<FrameLayout
android:id="@+id/home_loading_statusbar"
android:layout_width="match_parent"
android:layout_height="70dp">
<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_baseline_keyboard_arrow_down_24"
android:layout_width="30dp"
android:layout_height="30dp"
android:contentDescription="@string/home_change_provider_img_des" />
</FrameLayout>
</FrameLayout>
<LinearLayout
android:visibility="gone"
tools:visibility="gone"
android:id="@+id/home_loading_error"
android:orientation="vertical"
android:layout_gravity="center"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<com.google.android.material.button.MaterialButton
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"
android:layout_width="wrap_content"
android:minWidth="200dp" />
<com.google.android.material.button.MaterialButton
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"
android:layout_width="wrap_content"
android:minWidth="200dp" />
<TextView
android:layout_margin="5dp"
android:gravity="center"
android:layout_gravity="center"
android:id="@+id/result_error_text"
android:textColor="?attr/textColor"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
</LinearLayout>
<androidx.core.widget.NestedScrollView <androidx.core.widget.NestedScrollView
android:background="?attr/primaryBlackBackground" android:background="?attr/primaryBlackBackground"
tools:visibility="visible" tools:visibility="visible"
@ -437,6 +291,11 @@
</LinearLayout> </LinearLayout>
</androidx.core.widget.NestedScrollView> </androidx.core.widget.NestedScrollView>
<FrameLayout
android:id="@+id/home_load_status_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
<com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton <com.google.android.material.floatingactionbutton.ExtendedFloatingActionButton
android:visibility="gone" android:visibility="gone"
tools:visibility="visible" tools:visibility="visible"

View file

@ -15,43 +15,43 @@
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="match_parent" android:layout_height="match_parent"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />
<include layout="@layout/loading_poster" /> <include layout="@layout/loading_poster" />
<View <Space
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_width="@dimen/loading_margin" /> android:layout_width="@dimen/loading_margin" />