Infinite lazy loading
This commit is contained in:
@@ -8,6 +8,7 @@ import android.graphics.drawable.InsetDrawable
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
|
import android.util.Log
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
@@ -52,7 +53,6 @@ import com.woka.utils.WokaBaseActivity
|
|||||||
import com.woka.utils.hide
|
import com.woka.utils.hide
|
||||||
import com.woka.utils.isNetworkConnected
|
import com.woka.utils.isNetworkConnected
|
||||||
import com.woka.utils.lightStatusBar
|
import com.woka.utils.lightStatusBar
|
||||||
import com.woka.utils.setVisibility
|
|
||||||
import com.woka.utils.shareWokaApp
|
import com.woka.utils.shareWokaApp
|
||||||
import com.woka.utils.show
|
import com.woka.utils.show
|
||||||
import com.woka.utils.toast
|
import com.woka.utils.toast
|
||||||
@@ -80,6 +80,8 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
private var customAdLoaded = false
|
private var customAdLoaded = false
|
||||||
private var shallLoadGoogleAd = false
|
private var shallLoadGoogleAd = false
|
||||||
|
|
||||||
|
private var isLoading = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
enableEdgeToEdge()
|
enableEdgeToEdge()
|
||||||
@@ -112,6 +114,8 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
customAdLoaded = false
|
customAdLoaded = false
|
||||||
|
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
initLaunchers()
|
initLaunchers()
|
||||||
|
|
||||||
initViews()
|
initViews()
|
||||||
@@ -156,6 +160,27 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
rvContinueListen.adapter = continueAudioAdapter
|
rvContinueListen.adapter = continueAudioAdapter
|
||||||
(rvContinueListen.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
(rvContinueListen.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
||||||
|
|
||||||
|
|
||||||
|
nestedScrollView.viewTreeObserver?.addOnScrollChangedListener {
|
||||||
|
if (nestedScrollView.childCount == 0) return@addOnScrollChangedListener
|
||||||
|
|
||||||
|
nestedScrollView.getChildAt(0)?.let {child ->
|
||||||
|
val v = nestedScrollView
|
||||||
|
|
||||||
|
val scrolledHeight = v.scrollY + v.height
|
||||||
|
val totalHeight = child.measuredHeight
|
||||||
|
|
||||||
|
val percentageScrolled = (scrolledHeight.toFloat()/totalHeight.toFloat()) * 100
|
||||||
|
|
||||||
|
if (percentageScrolled >= 60) {
|
||||||
|
if (!isLoading && !viewModel.lastPage && isNetworkConnected()){
|
||||||
|
isLoading = true
|
||||||
|
viewModel.loadAudioSongs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -196,12 +221,6 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMoreBtn.setOnClickListener {
|
|
||||||
viewModel.loadAudioSongs()
|
|
||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -256,6 +275,8 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
viewModel.audioBookLiveData.observe(this) {
|
viewModel.audioBookLiveData.observe(this) {
|
||||||
when (it) {
|
when (it) {
|
||||||
is ApiResult.Error -> {
|
is ApiResult.Error -> {
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
binding.shimmer.hide()
|
binding.shimmer.hide()
|
||||||
if (audioBookAdapter.currentList.size == 0) {
|
if (audioBookAdapter.currentList.size == 0) {
|
||||||
// none of the data is yet loaded
|
// none of the data is yet loaded
|
||||||
@@ -267,12 +288,12 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
// error in loading more
|
// error in loading more
|
||||||
binding.loadMoreProgress.hide()
|
binding.loadMoreProgress.hide()
|
||||||
binding.loadMoreBtn.text = getString(R.string.retry)
|
|
||||||
binding.loadMoreBtn.show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Loading -> {
|
is ApiResult.Loading -> {
|
||||||
|
isLoading = true
|
||||||
|
|
||||||
if (audioBookAdapter.currentList.size == 0) {
|
if (audioBookAdapter.currentList.size == 0) {
|
||||||
// loading first data
|
// loading first data
|
||||||
binding.shimmer.show()
|
binding.shimmer.show()
|
||||||
@@ -280,13 +301,14 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
// loading more data
|
// loading more data
|
||||||
binding.loadMoreProgress.show()
|
binding.loadMoreProgress.show()
|
||||||
binding.loadMoreBtn.hide()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
it.data?.let { newList ->
|
it.data?.let { newList ->
|
||||||
if (newList.isNotEmpty()) {
|
if (newList.isNotEmpty()) {
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
binding.rvAudioBooks.show()
|
binding.rvAudioBooks.show()
|
||||||
binding.listenTxt.show()
|
binding.listenTxt.show()
|
||||||
binding.trailerView.show()
|
binding.trailerView.show()
|
||||||
@@ -295,8 +317,9 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
binding.shimmer.hide()
|
binding.shimmer.hide()
|
||||||
|
|
||||||
binding.loadMoreProgress.hide()
|
binding.loadMoreProgress.hide()
|
||||||
binding.loadMoreBtn.text = getString(R.string.load_more)
|
//
|
||||||
binding.loadMoreBtn.setVisibility(!viewModel.lastPage)
|
// binding.loadMoreBtn.text = getString(R.string.load_more)
|
||||||
|
// binding.loadMoreBtn.setVisibility(!viewModel.lastPage)
|
||||||
|
|
||||||
if (audioBookAdapter.currentList.isEmpty()) {
|
if (audioBookAdapter.currentList.isEmpty()) {
|
||||||
// first data load
|
// first data load
|
||||||
@@ -306,6 +329,10 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
loadTrailerData(newList[0])
|
loadTrailerData(newList[0])
|
||||||
audioBookAdapter.submitList(newList)
|
audioBookAdapter.submitList(newList)
|
||||||
|
|
||||||
|
if (!customAdLoaded && shallLoadGoogleAd){
|
||||||
|
loadGoogleAds()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// loaded more data
|
// loaded more data
|
||||||
audioBookAdapter.notifyItemRangeInserted(
|
audioBookAdapter.notifyItemRangeInserted(
|
||||||
@@ -313,10 +340,6 @@ class AudioBooksActivity : WokaBaseActivity() {
|
|||||||
newList.size
|
newList.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!customAdLoaded && shallLoadGoogleAd){
|
|
||||||
loadGoogleAds()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.graphics.drawable.InsetDrawable
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
|
import android.util.Log
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.activity.result.ActivityResultLauncher
|
import androidx.activity.result.ActivityResultLauncher
|
||||||
@@ -51,7 +52,6 @@ import com.woka.utils.WokaBaseActivity
|
|||||||
import com.woka.utils.hide
|
import com.woka.utils.hide
|
||||||
import com.woka.utils.isNetworkConnected
|
import com.woka.utils.isNetworkConnected
|
||||||
import com.woka.utils.lightStatusBar
|
import com.woka.utils.lightStatusBar
|
||||||
import com.woka.utils.setVisibility
|
|
||||||
import com.woka.utils.shareWokaApp
|
import com.woka.utils.shareWokaApp
|
||||||
import com.woka.utils.show
|
import com.woka.utils.show
|
||||||
import com.woka.utils.toast
|
import com.woka.utils.toast
|
||||||
@@ -80,6 +80,8 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
private var customAdLoaded = false
|
private var customAdLoaded = false
|
||||||
private var shallLoadGoogleAd = false
|
private var shallLoadGoogleAd = false
|
||||||
|
|
||||||
|
private var isLoading = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityKaraokeBinding.inflate(layoutInflater)
|
binding = ActivityKaraokeBinding.inflate(layoutInflater)
|
||||||
@@ -114,6 +116,8 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
customAdLoaded = false
|
customAdLoaded = false
|
||||||
|
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
initLaunchers()
|
initLaunchers()
|
||||||
|
|
||||||
initViews()
|
initViews()
|
||||||
@@ -158,6 +162,27 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
rvContinueSing.adapter = continueKaraokeAdapter
|
rvContinueSing.adapter = continueKaraokeAdapter
|
||||||
(rvContinueSing.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
(rvContinueSing.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
||||||
|
|
||||||
|
nestedScrollView.viewTreeObserver?.addOnScrollChangedListener {
|
||||||
|
if (nestedScrollView.childCount == 0) return@addOnScrollChangedListener
|
||||||
|
|
||||||
|
nestedScrollView.getChildAt(0)?.let {child ->
|
||||||
|
val v = nestedScrollView
|
||||||
|
|
||||||
|
val scrolledHeight = v.scrollY + v.height
|
||||||
|
val totalHeight = child.measuredHeight
|
||||||
|
|
||||||
|
val percentageScrolled = (scrolledHeight.toFloat()/totalHeight.toFloat()) * 100
|
||||||
|
|
||||||
|
if (percentageScrolled >= 60) {
|
||||||
|
if (!isLoading && !viewModel.lastPage && isNetworkConnected()){
|
||||||
|
Log.d("infinite_scroll", "LOAD MORE")
|
||||||
|
isLoading = true
|
||||||
|
viewModel.loadKaraokeSongs()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -205,12 +230,6 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMoreBtn.setOnClickListener {
|
|
||||||
viewModel.loadKaraokeSongs()
|
|
||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -483,6 +502,8 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
viewModel.karaokeLiveData.observe(this) {
|
viewModel.karaokeLiveData.observe(this) {
|
||||||
when (it) {
|
when (it) {
|
||||||
is ApiResult.Error -> {
|
is ApiResult.Error -> {
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
binding.shimmer.hide()
|
binding.shimmer.hide()
|
||||||
if (karaokeAdapter.currentList.size == 0) {
|
if (karaokeAdapter.currentList.size == 0) {
|
||||||
// none of the data is yet loaded
|
// none of the data is yet loaded
|
||||||
@@ -494,12 +515,12 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
// error in loading more
|
// error in loading more
|
||||||
binding.loadMoreProgress.hide()
|
binding.loadMoreProgress.hide()
|
||||||
binding.loadMoreBtn.text = getString(R.string.retry)
|
|
||||||
binding.loadMoreBtn.show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Loading -> {
|
is ApiResult.Loading -> {
|
||||||
|
isLoading = true
|
||||||
|
|
||||||
if (karaokeAdapter.currentList.size == 0) {
|
if (karaokeAdapter.currentList.size == 0) {
|
||||||
// loading first data
|
// loading first data
|
||||||
binding.shimmer.show()
|
binding.shimmer.show()
|
||||||
@@ -507,13 +528,14 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
// loading more data
|
// loading more data
|
||||||
binding.loadMoreProgress.show()
|
binding.loadMoreProgress.show()
|
||||||
binding.loadMoreBtn.hide()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
it.data?.let { newList ->
|
it.data?.let { newList ->
|
||||||
if (newList.isNotEmpty()) {
|
if (newList.isNotEmpty()) {
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
binding.rvKaraoke.show()
|
binding.rvKaraoke.show()
|
||||||
binding.singTxt.show()
|
binding.singTxt.show()
|
||||||
binding.trailerView.show()
|
binding.trailerView.show()
|
||||||
@@ -522,8 +544,6 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
binding.shimmer.hide()
|
binding.shimmer.hide()
|
||||||
|
|
||||||
binding.loadMoreProgress.hide()
|
binding.loadMoreProgress.hide()
|
||||||
binding.loadMoreBtn.text = getString(R.string.load_more)
|
|
||||||
binding.loadMoreBtn.setVisibility(!viewModel.lastPage)
|
|
||||||
|
|
||||||
if (karaokeAdapter.currentList.isEmpty()) {
|
if (karaokeAdapter.currentList.isEmpty()) {
|
||||||
// first data load
|
// first data load
|
||||||
@@ -533,6 +553,10 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
loadTrailerData(newList[0])
|
loadTrailerData(newList[0])
|
||||||
karaokeAdapter.submitList(newList)
|
karaokeAdapter.submitList(newList)
|
||||||
|
|
||||||
|
if (!customAdLoaded && shallLoadGoogleAd){
|
||||||
|
loadGoogleAds()
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
// loaded more data
|
// loaded more data
|
||||||
karaokeAdapter.notifyItemRangeInserted(
|
karaokeAdapter.notifyItemRangeInserted(
|
||||||
@@ -540,10 +564,6 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
newList.size
|
newList.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!customAdLoaded && shallLoadGoogleAd){
|
|
||||||
loadGoogleAds()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -654,7 +674,10 @@ class KaraokeActivity : WokaBaseActivity() {
|
|||||||
AdSize.LARGE_BANNER
|
AdSize.LARGE_BANNER
|
||||||
)
|
)
|
||||||
adView.adUnitId = KARAOKE_BANNER_AD
|
adView.adUnitId = KARAOKE_BANNER_AD
|
||||||
|
|
||||||
|
binding.toolbarAdsContainer.removeAllViews()
|
||||||
binding.toolbarAdsContainer.addView(adView)
|
binding.toolbarAdsContainer.addView(adView)
|
||||||
|
|
||||||
adView.loadAd(AdRequest.Builder().build())
|
adView.loadAd(AdRequest.Builder().build())
|
||||||
|
|
||||||
// full ad at masila image
|
// full ad at masila image
|
||||||
|
|||||||
@@ -80,13 +80,15 @@ class ShopFragment1 : Fragment() {
|
|||||||
adapter.onCategoryClickListener = { id, _ ->
|
adapter.onCategoryClickListener = { id, _ ->
|
||||||
if (id == -1){
|
if (id == -1){
|
||||||
// ad clicked
|
// ad clicked
|
||||||
AdClicksHelper.addClick(adId)
|
adLink?.let {link ->
|
||||||
startActivity(
|
AdClicksHelper.addClick(adId)
|
||||||
Intent(
|
startActivity(
|
||||||
Intent.ACTION_VIEW,
|
Intent(
|
||||||
Uri.parse(adLink)
|
Intent.ACTION_VIEW,
|
||||||
|
Uri.parse(link)
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
}
|
||||||
}else{
|
}else{
|
||||||
// normal click
|
// normal click
|
||||||
findNavController().navigate(
|
findNavController().navigate(
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.woka.shop.views.fragments.shop
|
package com.woka.shop.views.fragments.shop
|
||||||
|
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -8,8 +9,10 @@ import androidx.fragment.app.Fragment
|
|||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
|
import androidx.recyclerview.widget.RecyclerView.OnScrollListener
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.woka.R
|
|
||||||
import com.woka.database.helpers.ClicksHelper
|
import com.woka.database.helpers.ClicksHelper
|
||||||
import com.woka.database.models.ContentType
|
import com.woka.database.models.ContentType
|
||||||
import com.woka.databinding.FragmentShop3Binding
|
import com.woka.databinding.FragmentShop3Binding
|
||||||
@@ -17,6 +20,7 @@ import com.woka.networking.ApiResult
|
|||||||
import com.woka.shop.adapters.ShopProductAdapter
|
import com.woka.shop.adapters.ShopProductAdapter
|
||||||
import com.woka.shop.viewmodels.ShopViewModel
|
import com.woka.shop.viewmodels.ShopViewModel
|
||||||
import com.woka.utils.hide
|
import com.woka.utils.hide
|
||||||
|
import com.woka.utils.isNetworkConnected
|
||||||
import com.woka.utils.setVisibility
|
import com.woka.utils.setVisibility
|
||||||
import com.woka.utils.show
|
import com.woka.utils.show
|
||||||
|
|
||||||
@@ -41,6 +45,7 @@ class ShopFragment3 : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
binding = FragmentShop3Binding.inflate(inflater, container, false)
|
binding = FragmentShop3Binding.inflate(inflater, container, false)
|
||||||
viewModel = ViewModelProvider(requireActivity())[ShopViewModel::class.java]
|
viewModel = ViewModelProvider(requireActivity())[ShopViewModel::class.java]
|
||||||
productAdapter = ShopProductAdapter()
|
productAdapter = ShopProductAdapter()
|
||||||
|
loadMoreProducts = false
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -70,6 +75,40 @@ class ShopFragment3 : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
rvProducts.itemAnimator = null
|
rvProducts.itemAnimator = null
|
||||||
|
|
||||||
viewModel.onTitleChange?.invoke(categoryName)
|
viewModel.onTitleChange?.invoke(categoryName)
|
||||||
|
|
||||||
|
|
||||||
|
// pagination
|
||||||
|
rvProducts.addOnScrollListener(object : OnScrollListener() {
|
||||||
|
override fun onScrolled(recyclerView: RecyclerView, dx: Int, dy: Int) {
|
||||||
|
super.onScrolled(recyclerView, dx, dy)
|
||||||
|
|
||||||
|
(recyclerView.layoutManager as GridLayoutManager?)?.let {layoutManager ->
|
||||||
|
|
||||||
|
val visibleItemCount = layoutManager.childCount
|
||||||
|
val totalItemCount = layoutManager.itemCount
|
||||||
|
val firstVisibleItemPosition = layoutManager.findFirstVisibleItemPosition()
|
||||||
|
|
||||||
|
val subCategoryId = categoryTabs.getTabAt(categoryTabs.selectedTabPosition)?.tag
|
||||||
|
|
||||||
|
if ((viewModel.productPagingData["${superCategoryId}_${categoryId}_$subCategoryId"]?.nextPageToLoad?:0) > 0
|
||||||
|
&& !loadMoreProducts
|
||||||
|
&& viewModel.productPagingData["${superCategoryId}_${categoryId}_$subCategoryId"]?.lastPage == false
|
||||||
|
&& context?.isNetworkConnected() == true) {
|
||||||
|
if (visibleItemCount + firstVisibleItemPosition >= totalItemCount
|
||||||
|
&& firstVisibleItemPosition >= 0
|
||||||
|
) {
|
||||||
|
Log.d("infinite_scroll", "LOAD MORE ${!loadMoreProducts}")
|
||||||
|
loadMoreProducts = true
|
||||||
|
viewModel.loadMoreProducts(
|
||||||
|
superCategoryId,
|
||||||
|
categoryId,
|
||||||
|
"$subCategoryId"
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -81,14 +120,6 @@ class ShopFragment3 : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
prodLoadMoreBtn.setOnClickListener {
|
|
||||||
loadMoreProducts = true
|
|
||||||
val subCategoryId = categoryTabs.getTabAt(categoryTabs.selectedTabPosition)?.tag?.toString()
|
|
||||||
viewModel.loadMoreProducts(superCategoryId, categoryId, subCategoryId)
|
|
||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
|
||||||
}
|
|
||||||
|
|
||||||
productAdapter.onProductClicked = {
|
productAdapter.onProductClicked = {
|
||||||
findNavController().navigate(ShopFragment3Directions.actionShopFragment3ToProductFragment(it))
|
findNavController().navigate(ShopFragment3Directions.actionShopFragment3ToProductFragment(it))
|
||||||
|
|
||||||
@@ -149,33 +180,19 @@ class ShopFragment3 : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
viewModel.productListingLiveData.observe(viewLifecycleOwner){
|
viewModel.productListingLiveData.observe(viewLifecycleOwner){
|
||||||
when (it) {
|
when (it) {
|
||||||
is ApiResult.Error -> {
|
is ApiResult.Error -> {
|
||||||
binding.productShimmer.hide()
|
if (!loadMoreProducts){
|
||||||
if (loadMoreProducts) {
|
rvProducts.hide()
|
||||||
// load more
|
|
||||||
binding.prodLoadMoreBtn.text = getString(R.string.retry)
|
|
||||||
binding.prodLoadMoreBtn.show()
|
|
||||||
} else {
|
|
||||||
// first time load
|
|
||||||
binding.rvProducts.hide()
|
|
||||||
binding.productShimmer.hide()
|
|
||||||
binding.prodLoadMoreBtn.hide()
|
|
||||||
}
|
}
|
||||||
|
loadMoreProducts = false
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Loading -> {
|
is ApiResult.Loading -> {
|
||||||
binding.productShimmer.show()
|
|
||||||
binding.prodLoadMoreBtn.hide()
|
|
||||||
binding.rvProducts.setVisibility(loadMoreProducts)
|
binding.rvProducts.setVisibility(loadMoreProducts)
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
it.data?.let { productList ->
|
it.data?.let { productList ->
|
||||||
binding.rvProducts.show()
|
binding.rvProducts.show()
|
||||||
binding.productShimmer.hide()
|
|
||||||
|
|
||||||
binding.prodLoadMoreBtn.text = getString(R.string.load_more)
|
|
||||||
val subCategoryId = categoryTabs.getTabAt(categoryTabs.selectedTabPosition)?.tag
|
|
||||||
binding.prodLoadMoreBtn.setVisibility(viewModel.productPagingData["${superCategoryId}_${categoryId}_$subCategoryId"]?.lastPage == false)
|
|
||||||
|
|
||||||
if (loadMoreProducts) {
|
if (loadMoreProducts) {
|
||||||
// loaded more data
|
// loaded more data
|
||||||
@@ -196,6 +213,8 @@ class ShopFragment3 : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadMoreProducts = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -183,44 +183,37 @@ class WebSeriesViewModel : ViewModel() {
|
|||||||
val episodeListingLiveData: LiveData<ApiResult<MutableList<EpisodeData>>>
|
val episodeListingLiveData: LiveData<ApiResult<MutableList<EpisodeData>>>
|
||||||
get() = _episodeListingLiveData
|
get() = _episodeListingLiveData
|
||||||
|
|
||||||
var episodePagingData = HashMap<String, PagingData>()
|
|
||||||
|
|
||||||
// episode data for every season. where {key -> "showId_seasonId"}
|
|
||||||
private var episodeDataMap = HashMap<String, MutableList<EpisodeData>>()
|
|
||||||
|
|
||||||
// episodes playlist, where {key -> "showId_seasonId_categoryId"}
|
// episodes playlist, where {key -> "showId_seasonId_categoryId"}
|
||||||
val episodesPlaylistMap = HashMap<String, VideoPlayList>()
|
val episodesPlaylistMap = HashMap<String, VideoPlayList>()
|
||||||
|
|
||||||
fun loadEpisodes(showId: String, seasonId: Int) {
|
private var episodesList = ArrayList<EpisodeData>()
|
||||||
val key = "${showId}_$seasonId"
|
var episodesNextPageToLoad = 0
|
||||||
if (episodeDataMap.containsKey(key) && episodeDataMap[key]?.isNotEmpty() == true) {
|
var episodesLastPage = false
|
||||||
_episodeListingLiveData.postValue(ApiResult.Success(episodeDataMap[key]))
|
|
||||||
} else {
|
fun resetEpisodesPagingData(){
|
||||||
loadMoreEpisodes(showId, seasonId)
|
episodesList = ArrayList()
|
||||||
}
|
episodesNextPageToLoad = 0
|
||||||
|
episodesLastPage = false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun loadMoreEpisodes(showId: String, seasonId: Int) {
|
fun loadEpisodes(showId: String, seasonId: Int) {
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
_episodeListingLiveData.postValue(ApiResult.Loading())
|
_episodeListingLiveData.postValue(ApiResult.Loading())
|
||||||
|
|
||||||
val key = "${showId}_$seasonId"
|
val key = "${showId}_$seasonId"
|
||||||
|
|
||||||
val pagingData = if (episodePagingData.containsKey(key)) {
|
|
||||||
episodePagingData[key]!!
|
|
||||||
} else {
|
|
||||||
val pagingData = PagingData()
|
|
||||||
episodePagingData[key] = pagingData
|
|
||||||
pagingData
|
|
||||||
}
|
|
||||||
|
|
||||||
when (val response = repository.episodeListing(
|
when (val response = repository.episodeListing(
|
||||||
showId,
|
showId,
|
||||||
seasonId,
|
seasonId,
|
||||||
pagingData.nextPageToLoad,
|
episodesNextPageToLoad,
|
||||||
pagingData.quantityPerPage
|
10
|
||||||
)) {
|
)) {
|
||||||
is ApiResult.Error -> {
|
is ApiResult.Error -> {
|
||||||
|
if (episodesNextPageToLoad == 0){
|
||||||
|
// error while loading the first page
|
||||||
|
// which means no data available
|
||||||
|
episodesLastPage = true
|
||||||
|
}
|
||||||
_episodeListingLiveData.postValue(
|
_episodeListingLiveData.postValue(
|
||||||
ApiResult.Error(
|
ApiResult.Error(
|
||||||
response.errorMessage,
|
response.errorMessage,
|
||||||
@@ -236,13 +229,11 @@ class WebSeriesViewModel : ViewModel() {
|
|||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
response.data?.let { data ->
|
response.data?.let { data ->
|
||||||
data.result?.filterNotNull()?.let { newList ->
|
data.result?.filterNotNull()?.let { newList ->
|
||||||
val currentList = episodeDataMap.getOrDefault(key, ArrayList())
|
episodesList.addAll(newList)
|
||||||
currentList.addAll(newList)
|
|
||||||
episodeDataMap[key] = currentList
|
|
||||||
|
|
||||||
pagingData.lastPage = episodeDataMap[key]?.size == data.total_records
|
episodesLastPage = episodesList.size == data.total_records
|
||||||
pagingData.nextPageToLoad++
|
episodesNextPageToLoad++
|
||||||
_episodeListingLiveData.postValue(ApiResult.Success(episodeDataMap[key]))
|
_episodeListingLiveData.postValue(ApiResult.Success(episodesList))
|
||||||
|
|
||||||
val currentPlayListEng =
|
val currentPlayListEng =
|
||||||
episodesPlaylistMap["${key}_1"] ?: VideoPlayList(
|
episodesPlaylistMap["${key}_1"] ?: VideoPlayList(
|
||||||
|
|||||||
@@ -8,6 +8,7 @@ import android.graphics.drawable.InsetDrawable
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -50,6 +51,7 @@ import com.woka.players.views.PlayerActivity.Companion.EXTRA_PLAY_LIST
|
|||||||
import com.woka.userPreference.UserType
|
import com.woka.userPreference.UserType
|
||||||
import com.woka.utils.NoSignInDialog
|
import com.woka.utils.NoSignInDialog
|
||||||
import com.woka.utils.hide
|
import com.woka.utils.hide
|
||||||
|
import com.woka.utils.isNetworkConnected
|
||||||
import com.woka.utils.lightStatusBar
|
import com.woka.utils.lightStatusBar
|
||||||
import com.woka.utils.setVisibility
|
import com.woka.utils.setVisibility
|
||||||
import com.woka.utils.show
|
import com.woka.utils.show
|
||||||
@@ -157,15 +159,6 @@ class WebSeriesFragment : Fragment() {
|
|||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMoreBtn.setOnClickListener {
|
|
||||||
catSpinnerAdapter.selectedCategoryType?.let {
|
|
||||||
loadingMore = true
|
|
||||||
viewModel.loadMoreWebSeries(it)
|
|
||||||
}
|
|
||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
|
||||||
}
|
|
||||||
|
|
||||||
trailerBtn.setOnClickListener {
|
trailerBtn.setOnClickListener {
|
||||||
activity.let {
|
activity.let {
|
||||||
it?.startActivity(Intent(it, PlayerActivity::class.java).apply {
|
it?.startActivity(Intent(it, PlayerActivity::class.java).apply {
|
||||||
@@ -216,6 +209,34 @@ class WebSeriesFragment : Fragment() {
|
|||||||
|
|
||||||
((rvWebSeries.itemAnimator) as SimpleItemAnimator).supportsChangeAnimations = false
|
((rvWebSeries.itemAnimator) as SimpleItemAnimator).supportsChangeAnimations = false
|
||||||
((rvContinueWatch.itemAnimator) as SimpleItemAnimator).supportsChangeAnimations = false
|
((rvContinueWatch.itemAnimator) as SimpleItemAnimator).supportsChangeAnimations = false
|
||||||
|
|
||||||
|
nestedScrollView.viewTreeObserver?.addOnScrollChangedListener {
|
||||||
|
if (nestedScrollView.childCount == 0) return@addOnScrollChangedListener
|
||||||
|
|
||||||
|
nestedScrollView.getChildAt(0)?.let {child ->
|
||||||
|
val v = nestedScrollView
|
||||||
|
|
||||||
|
val scrolledHeight = v.scrollY + v.height
|
||||||
|
val totalHeight = child.measuredHeight
|
||||||
|
|
||||||
|
val percentageScrolled = (scrolledHeight.toFloat()/totalHeight.toFloat()) * 100
|
||||||
|
|
||||||
|
if (percentageScrolled >= 80) {
|
||||||
|
catSpinnerAdapter.selectedCategoryType?.let { categoryType ->
|
||||||
|
if ((viewModel.categoryPagingData[categoryType]?.nextPageToLoad?:0) > 0
|
||||||
|
&& !loadingMore
|
||||||
|
&& viewModel.categoryPagingData[categoryType]?.lastPage == false
|
||||||
|
&& context?.isNetworkConnected() == true){
|
||||||
|
Log.d("infinite_scroll", "LOAD MORE")
|
||||||
|
catSpinnerAdapter.selectedCategoryType?.let {
|
||||||
|
loadingMore = true
|
||||||
|
viewModel.loadMoreWebSeries(it)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
@@ -335,19 +356,17 @@ class WebSeriesFragment : Fragment() {
|
|||||||
binding.shimmerShowData.hide()
|
binding.shimmerShowData.hide()
|
||||||
if (loadingMore) {
|
if (loadingMore) {
|
||||||
// load more
|
// load more
|
||||||
binding.loadMoreBtn.text = getString(R.string.retry)
|
|
||||||
binding.loadMoreBtn.show()
|
|
||||||
} else {
|
} else {
|
||||||
// first time load
|
// first time load
|
||||||
binding.rvWebSeries.hide()
|
binding.rvWebSeries.hide()
|
||||||
binding.shimmerShowData.hide()
|
binding.shimmerShowData.hide()
|
||||||
binding.loadMoreBtn.hide()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadingMore = false
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Loading -> {
|
is ApiResult.Loading -> {
|
||||||
binding.shimmerShowData.show()
|
binding.shimmerShowData.show()
|
||||||
binding.loadMoreBtn.hide()
|
|
||||||
binding.rvWebSeries.setVisibility(loadingMore)
|
binding.rvWebSeries.setVisibility(loadingMore)
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -358,11 +377,6 @@ class WebSeriesFragment : Fragment() {
|
|||||||
binding.rvWebSeries.show()
|
binding.rvWebSeries.show()
|
||||||
binding.shimmerShowData.hide()
|
binding.shimmerShowData.hide()
|
||||||
|
|
||||||
binding.loadMoreBtn.text = getString(R.string.load_more)
|
|
||||||
binding.loadMoreBtn.setVisibility(
|
|
||||||
viewModel.categoryPagingData[categoryType]?.lastPage == false
|
|
||||||
)
|
|
||||||
|
|
||||||
if (loadingMore) {
|
if (loadingMore) {
|
||||||
// loaded more data
|
// loaded more data
|
||||||
showAdapter.notifyItemRangeInserted(
|
showAdapter.notifyItemRangeInserted(
|
||||||
@@ -373,6 +387,8 @@ class WebSeriesFragment : Fragment() {
|
|||||||
// new category data load
|
// new category data load
|
||||||
showAdapter.submitListShowList(showList, categoryType)
|
showAdapter.submitListShowList(showList, categoryType)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
loadingMore = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.graphics.drawable.ColorDrawable
|
|||||||
import android.graphics.drawable.InsetDrawable
|
import android.graphics.drawable.InsetDrawable
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
|
import android.util.Log
|
||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
@@ -17,6 +18,7 @@ import androidx.appcompat.content.res.AppCompatResources
|
|||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.fragment.navArgs
|
import androidx.navigation.fragment.navArgs
|
||||||
|
import androidx.recyclerview.widget.SimpleItemAnimator
|
||||||
import com.google.android.material.tabs.TabLayout
|
import com.google.android.material.tabs.TabLayout
|
||||||
import com.jwplayer.pub.api.media.playlists.PlaylistItem
|
import com.jwplayer.pub.api.media.playlists.PlaylistItem
|
||||||
import com.woka.R
|
import com.woka.R
|
||||||
@@ -34,7 +36,6 @@ import com.woka.utils.NoSignInDialog
|
|||||||
import com.woka.utils.hide
|
import com.woka.utils.hide
|
||||||
import com.woka.utils.isNetworkConnected
|
import com.woka.utils.isNetworkConnected
|
||||||
import com.woka.utils.lightStatusBar
|
import com.woka.utils.lightStatusBar
|
||||||
import com.woka.utils.setVisibility
|
|
||||||
import com.woka.utils.shareWokaApp
|
import com.woka.utils.shareWokaApp
|
||||||
import com.woka.utils.show
|
import com.woka.utils.show
|
||||||
import com.woka.utils.toast
|
import com.woka.utils.toast
|
||||||
@@ -70,11 +71,13 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
private lateinit var episodeDialogBinding: DialogEpisodeBinding
|
private lateinit var episodeDialogBinding: DialogEpisodeBinding
|
||||||
private lateinit var episodeDialog: Dialog
|
private lateinit var episodeDialog: Dialog
|
||||||
|
|
||||||
private var loadMoreEpisodes = false
|
|
||||||
private var showDataChanged: Boolean = false
|
private var showDataChanged: Boolean = false
|
||||||
|
|
||||||
private lateinit var noSignInDialog: NoSignInDialog
|
private lateinit var noSignInDialog: NoSignInDialog
|
||||||
|
|
||||||
|
private var isLoadingMoreEpisodes = false
|
||||||
|
private var showEpisodesShimmer = true
|
||||||
|
|
||||||
override fun onAttach(context: Context) {
|
override fun onAttach(context: Context) {
|
||||||
super.onAttach(context)
|
super.onAttach(context)
|
||||||
episodeAdapter = EpisodeAdapter(context)
|
episodeAdapter = EpisodeAdapter(context)
|
||||||
@@ -93,6 +96,11 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
it.window.setBackgroundDrawableResource(R.color.web_show_bg)
|
it.window.setBackgroundDrawableResource(R.color.web_show_bg)
|
||||||
it.window.lightStatusBar(true)
|
it.window.lightStatusBar(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
showDataChanged = false
|
||||||
|
isLoadingMoreEpisodes = false
|
||||||
|
showEpisodesShimmer = true
|
||||||
|
|
||||||
return binding.root
|
return binding.root
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -151,10 +159,35 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
rvEpisodes.adapter = episodeAdapter
|
rvEpisodes.adapter = episodeAdapter
|
||||||
episodeAdapter.onEpisodeClicked = ::onEpisodeClicked
|
episodeAdapter.onEpisodeClicked = ::onEpisodeClicked
|
||||||
episodeAdapter.onEpisodePlayClicked = ::onEpisodePlayClicked
|
episodeAdapter.onEpisodePlayClicked = ::onEpisodePlayClicked
|
||||||
|
((rvEpisodes.itemAnimator) as SimpleItemAnimator).supportsChangeAnimations = false
|
||||||
|
|
||||||
rvTeaser.adapter = teaserAdapter
|
rvTeaser.adapter = teaserAdapter
|
||||||
teaserAdapter.onEpisodeClicked = ::onTeaserClicked
|
teaserAdapter.onEpisodeClicked = ::onTeaserClicked
|
||||||
teaserAdapter.onEpisodePlayClicked = ::onTeaserPlayClicked
|
teaserAdapter.onEpisodePlayClicked = ::onTeaserPlayClicked
|
||||||
|
|
||||||
|
nestedScrollView.viewTreeObserver?.addOnScrollChangedListener {
|
||||||
|
if (nestedScrollView.childCount == 0) return@addOnScrollChangedListener
|
||||||
|
|
||||||
|
nestedScrollView.getChildAt(0)?.let {child ->
|
||||||
|
val v = nestedScrollView
|
||||||
|
|
||||||
|
val scrolledHeight = v.scrollY + v.height
|
||||||
|
val totalHeight = child.measuredHeight
|
||||||
|
|
||||||
|
val percentageScrolled = (scrolledHeight.toFloat()/totalHeight.toFloat()) * 100
|
||||||
|
|
||||||
|
if (percentageScrolled >= 80) {
|
||||||
|
if (viewModel.episodesNextPageToLoad > 0
|
||||||
|
&& !isLoadingMoreEpisodes
|
||||||
|
&& !viewModel.episodesLastPage
|
||||||
|
&& context?.isNetworkConnected() == true){
|
||||||
|
Log.d("infinite_scroll", "LOAD MORE")
|
||||||
|
isLoadingMoreEpisodes = true
|
||||||
|
viewModel.loadEpisodes("${showData.id}", selectedSeasonId)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -177,13 +210,6 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
ClicksHelper.upsertClickEvent(ContentType.SERIES, showData.id, categoryId)
|
ClicksHelper.upsertClickEvent(ContentType.SERIES, showData.id, categoryId)
|
||||||
}
|
}
|
||||||
|
|
||||||
epLoadMoreBtn.setOnClickListener {
|
|
||||||
loadMoreEpisodes = true
|
|
||||||
viewModel.loadMoreEpisodes("${showData.id}", selectedSeasonId)
|
|
||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
|
||||||
}
|
|
||||||
|
|
||||||
likeSeason.setOnClickListener {
|
likeSeason.setOnClickListener {
|
||||||
if (activity?.isNetworkConnected() == false) {
|
if (activity?.isNetworkConnected() == false) {
|
||||||
toast(getString(R.string.no_internet))
|
toast(getString(R.string.no_internet))
|
||||||
@@ -377,45 +403,58 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
when (it) {
|
when (it) {
|
||||||
is ApiResult.Error -> {
|
is ApiResult.Error -> {
|
||||||
binding.epShimmer.hide()
|
binding.epShimmer.hide()
|
||||||
if (loadMoreEpisodes) {
|
binding.loadMoreProgress.hide()
|
||||||
// load more
|
|
||||||
binding.epLoadMoreBtn.text = getString(R.string.retry)
|
if (!isLoadingMoreEpisodes){
|
||||||
binding.epLoadMoreBtn.show()
|
// loading new data
|
||||||
} else {
|
|
||||||
// first time load
|
|
||||||
binding.rvEpisodes.hide()
|
binding.rvEpisodes.hide()
|
||||||
binding.seasonMediaType.hide()
|
binding.seasonMediaType.hide()
|
||||||
binding.epShimmer.hide()
|
binding.epShimmer.hide()
|
||||||
binding.epLoadMoreBtn.hide()
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isLoadingMoreEpisodes = false
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Loading -> {
|
is ApiResult.Loading -> {
|
||||||
binding.epShimmer.show()
|
|
||||||
binding.epLoadMoreBtn.hide()
|
if (!isLoadingMoreEpisodes){
|
||||||
binding.rvEpisodes.setVisibility(loadMoreEpisodes)
|
// loading new data
|
||||||
binding.seasonMediaType.setVisibility(loadMoreEpisodes)
|
if (showEpisodesShimmer){
|
||||||
|
binding.epShimmer.show()
|
||||||
|
showEpisodesShimmer = false
|
||||||
|
}
|
||||||
|
}else {
|
||||||
|
// loading more data
|
||||||
|
binding.loadMoreProgress.show()
|
||||||
|
binding.rvEpisodes.show()
|
||||||
|
binding.seasonMediaType.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
it.data?.let { episodeList ->
|
it.data?.let { episodeList ->
|
||||||
|
|
||||||
binding.rvEpisodes.show()
|
binding.rvEpisodes.show()
|
||||||
binding.seasonMediaType.show()
|
binding.seasonMediaType.show()
|
||||||
binding.epShimmer.hide()
|
binding.epShimmer.hide()
|
||||||
|
binding.loadMoreProgress.hide()
|
||||||
|
|
||||||
binding.epLoadMoreBtn.text = getString(R.string.load_more)
|
if (!isLoadingMoreEpisodes){
|
||||||
binding.epLoadMoreBtn.setVisibility(viewModel.episodePagingData["${showData.id}_$selectedSeasonId"]?.lastPage == false)
|
// loading new data
|
||||||
|
|
||||||
if (loadMoreEpisodes) {
|
|
||||||
// loaded more data
|
|
||||||
episodeAdapter.notifyItemRangeInserted(
|
|
||||||
episodeAdapter.currentList.size,
|
|
||||||
episodeList.size
|
|
||||||
)
|
|
||||||
} else {
|
|
||||||
// new category data load
|
|
||||||
episodeAdapter.submitList(episodeList)
|
episodeAdapter.submitList(episodeList)
|
||||||
|
}else{
|
||||||
|
// loading more data
|
||||||
|
try {
|
||||||
|
episodeAdapter.notifyItemRangeInserted(
|
||||||
|
episodeAdapter.currentList.size,
|
||||||
|
episodeList.size
|
||||||
|
)
|
||||||
|
} catch (e: Exception) {
|
||||||
|
// do nothing
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
isLoadingMoreEpisodes = false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -617,7 +656,7 @@ class WebShowFragment : Fragment(), TabLayout.OnTabSelectedListener {
|
|||||||
seasonData.id?.let {
|
seasonData.id?.let {
|
||||||
selectedSeasonId = it
|
selectedSeasonId = it
|
||||||
|
|
||||||
loadMoreEpisodes = false
|
viewModel.resetEpisodesPagingData()
|
||||||
viewModel.loadEpisodes("${showData.id}", it)
|
viewModel.loadEpisodes("${showData.id}", it)
|
||||||
viewModel.loadTeasers("${showData.id}", it)
|
viewModel.loadTeasers("${showData.id}", it)
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ import android.graphics.drawable.InsetDrawable
|
|||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.text.Html
|
import android.text.Html
|
||||||
|
import android.util.Log
|
||||||
import android.view.WindowManager
|
import android.view.WindowManager
|
||||||
import androidx.activity.enableEdgeToEdge
|
import androidx.activity.enableEdgeToEdge
|
||||||
import androidx.core.view.ViewCompat
|
import androidx.core.view.ViewCompat
|
||||||
@@ -42,7 +43,6 @@ import com.woka.utils.WokaBaseActivity
|
|||||||
import com.woka.utils.hide
|
import com.woka.utils.hide
|
||||||
import com.woka.utils.isNetworkConnected
|
import com.woka.utils.isNetworkConnected
|
||||||
import com.woka.utils.lightStatusBar
|
import com.woka.utils.lightStatusBar
|
||||||
import com.woka.utils.setVisibility
|
|
||||||
import com.woka.utils.shareWokaApp
|
import com.woka.utils.shareWokaApp
|
||||||
import com.woka.utils.show
|
import com.woka.utils.show
|
||||||
import com.woka.utils.toast
|
import com.woka.utils.toast
|
||||||
@@ -73,6 +73,8 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
private var customAdLoaded = false
|
private var customAdLoaded = false
|
||||||
private var shallLoadGoogleAd = false
|
private var shallLoadGoogleAd = false
|
||||||
|
|
||||||
|
private var isLoading = false
|
||||||
|
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
binding = ActivityGamesBinding.inflate(layoutInflater)
|
binding = ActivityGamesBinding.inflate(layoutInflater)
|
||||||
@@ -103,6 +105,8 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
customAdLoaded = false
|
customAdLoaded = false
|
||||||
|
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
initViews()
|
initViews()
|
||||||
|
|
||||||
initGameDialog()
|
initGameDialog()
|
||||||
@@ -133,6 +137,27 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
rvGames.adapter = gameAdapter
|
rvGames.adapter = gameAdapter
|
||||||
(rvGames.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
(rvGames.itemAnimator as SimpleItemAnimator).supportsChangeAnimations = false
|
||||||
|
|
||||||
|
nestedScrollView.viewTreeObserver?.addOnScrollChangedListener {
|
||||||
|
if (nestedScrollView.childCount == 0) return@addOnScrollChangedListener
|
||||||
|
|
||||||
|
nestedScrollView.getChildAt(0)?.let {child ->
|
||||||
|
val v = nestedScrollView
|
||||||
|
|
||||||
|
val scrolledHeight = v.scrollY + v.height
|
||||||
|
val totalHeight = child.measuredHeight
|
||||||
|
|
||||||
|
val percentageScrolled = (scrolledHeight.toFloat()/totalHeight.toFloat()) * 100
|
||||||
|
|
||||||
|
if (percentageScrolled >= 80) {
|
||||||
|
if (!isLoading && !viewModel.lastPage && isNetworkConnected()){
|
||||||
|
Log.d("infinite_scroll", "LOAD MORE")
|
||||||
|
isLoading = true
|
||||||
|
viewModel.loadGames()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -176,12 +201,6 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
||||||
}
|
}
|
||||||
|
|
||||||
loadMoreBtn.setOnClickListener {
|
|
||||||
viewModel.loadGames()
|
|
||||||
|
|
||||||
ClicksHelper.upsertClickEvent(ContentType.OTHERS)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -420,6 +439,8 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
viewModel.gamesLiveData.observe(this){
|
viewModel.gamesLiveData.observe(this){
|
||||||
when(it){
|
when(it){
|
||||||
is ApiResult.Error -> {
|
is ApiResult.Error -> {
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
binding.shimmer.hide()
|
binding.shimmer.hide()
|
||||||
if (gameAdapter.currentList.size == 0) {
|
if (gameAdapter.currentList.size == 0) {
|
||||||
// none of the data is yet loaded
|
// none of the data is yet loaded
|
||||||
@@ -431,11 +452,11 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
// error in loading more
|
// error in loading more
|
||||||
binding.loadMoreProgress.hide()
|
binding.loadMoreProgress.hide()
|
||||||
binding.loadMoreBtn.text = getString(R.string.retry)
|
|
||||||
binding.loadMoreBtn.show()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ApiResult.Loading -> {
|
is ApiResult.Loading -> {
|
||||||
|
isLoading = true
|
||||||
|
|
||||||
if (gameAdapter.currentList.size == 0) {
|
if (gameAdapter.currentList.size == 0) {
|
||||||
// loading first data
|
// loading first data
|
||||||
binding.shimmer.show()
|
binding.shimmer.show()
|
||||||
@@ -443,12 +464,13 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
} else {
|
} else {
|
||||||
// loading more data
|
// loading more data
|
||||||
binding.loadMoreProgress.show()
|
binding.loadMoreProgress.show()
|
||||||
binding.loadMoreBtn.hide()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
is ApiResult.Success -> {
|
is ApiResult.Success -> {
|
||||||
it.data?.let {newList ->
|
it.data?.let {newList ->
|
||||||
if (newList.isNotEmpty()){
|
if (newList.isNotEmpty()){
|
||||||
|
isLoading = false
|
||||||
|
|
||||||
binding.rvGames.show()
|
binding.rvGames.show()
|
||||||
binding.listenTxt.show()
|
binding.listenTxt.show()
|
||||||
binding.trailerView.show()
|
binding.trailerView.show()
|
||||||
@@ -457,13 +479,18 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
binding.shimmer.hide()
|
binding.shimmer.hide()
|
||||||
|
|
||||||
binding.loadMoreProgress.hide()
|
binding.loadMoreProgress.hide()
|
||||||
binding.loadMoreBtn.text = getString(R.string.load_more)
|
//
|
||||||
binding.loadMoreBtn.setVisibility(!viewModel.lastPage)
|
// binding.loadMoreBtn.text = getString(R.string.load_more)
|
||||||
|
// binding.loadMoreBtn.setVisibility(!viewModel.lastPage)
|
||||||
|
|
||||||
if (gameAdapter.currentList.isEmpty()){
|
if (gameAdapter.currentList.isEmpty()){
|
||||||
// first data load
|
// first data load
|
||||||
loadTrailerData(newList[0])
|
loadTrailerData(newList[0])
|
||||||
gameAdapter.submitList(newList)
|
gameAdapter.submitList(newList)
|
||||||
|
|
||||||
|
if (!customAdLoaded && shallLoadGoogleAd){
|
||||||
|
loadGoogleAds()
|
||||||
|
}
|
||||||
}else{
|
}else{
|
||||||
// loaded more data
|
// loaded more data
|
||||||
gameAdapter.notifyItemRangeInserted(
|
gameAdapter.notifyItemRangeInserted(
|
||||||
@@ -471,10 +498,6 @@ class GamesActivity : WokaBaseActivity() {
|
|||||||
newList.size
|
newList.size
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!customAdLoaded && shallLoadGoogleAd){
|
|
||||||
loadGoogleAds()
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -261,6 +261,7 @@
|
|||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:id="@+id/nested_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/color_primary_dark"
|
android:background="@color/color_primary_dark"
|
||||||
@@ -340,27 +341,6 @@
|
|||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/load_more_btn"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
android:text="@string/load_more"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
android:paddingHorizontal="25dp"
|
|
||||||
android:layout_marginVertical="15dp"
|
|
||||||
|
|
||||||
android:background="@drawable/round_25"
|
|
||||||
android:backgroundTint="@color/night_status"
|
|
||||||
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|||||||
@@ -261,6 +261,7 @@
|
|||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:id="@+id/nested_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/color_primary_dark"
|
android:background="@color/color_primary_dark"
|
||||||
@@ -312,27 +313,6 @@
|
|||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/load_more_btn"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
android:text="@string/load_more"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
android:paddingHorizontal="25dp"
|
|
||||||
android:layout_marginVertical="15dp"
|
|
||||||
|
|
||||||
android:background="@drawable/round_25"
|
|
||||||
android:backgroundTint="@color/night_status"
|
|
||||||
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|||||||
@@ -250,6 +250,7 @@
|
|||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
<androidx.core.widget.NestedScrollView
|
<androidx.core.widget.NestedScrollView
|
||||||
|
android:id="@+id/nested_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/color_primary_dark"
|
android:background="@color/color_primary_dark"
|
||||||
@@ -327,27 +328,6 @@
|
|||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/load_more_btn"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
|
|
||||||
android:layout_marginVertical="15dp"
|
|
||||||
android:background="@drawable/round_25"
|
|
||||||
android:backgroundTint="@color/night_status"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
|
|
||||||
android:paddingHorizontal="25dp"
|
|
||||||
android:text="@string/load_more"
|
|
||||||
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
android:visibility="gone"
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
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"
|
||||||
@@ -7,232 +7,112 @@
|
|||||||
android:background="@color/orders_bg"
|
android:background="@color/orders_bg"
|
||||||
tools:context=".shop.views.fragments.shop.ShopFragment3">
|
tools:context=".shop.views.fragments.shop.ShopFragment3">
|
||||||
|
|
||||||
<RelativeLayout
|
<com.facebook.shimmer.ShimmerFrameLayout
|
||||||
|
android:id="@+id/category_shimmer"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
<com.facebook.shimmer.ShimmerFrameLayout
|
android:visibility="gone"
|
||||||
android:id="@+id/category_shimmer"
|
app:shimmer_auto_start="true"
|
||||||
android:layout_width="match_parent"
|
app:shimmer_base_alpha="0.6"
|
||||||
android:layout_height="wrap_content"
|
app:shimmer_highlight_alpha="0.5">
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:shimmer_auto_start="true"
|
|
||||||
app:shimmer_base_alpha="0.6"
|
|
||||||
app:shimmer_highlight_alpha="0.5">
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:orientation="horizontal">
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:background="@drawable/round_bg_25"
|
|
||||||
|
|
||||||
android:alpha="0.7"
|
|
||||||
android:backgroundTint="@android:color/darker_gray" />
|
|
||||||
|
|
||||||
<View
|
|
||||||
android:layout_width="100dp"
|
|
||||||
android:layout_height="40dp"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
android:background="@drawable/round_bg_25"
|
|
||||||
|
|
||||||
android:alpha="0.7"
|
|
||||||
android:backgroundTint="@android:color/darker_gray" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
|
||||||
|
|
||||||
<com.google.android.material.tabs.TabLayout
|
|
||||||
android:id="@+id/category_tabs"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="45dp"
|
|
||||||
android:layout_marginStart="5dp"
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
app:tabBackground="@drawable/sub_category_tab_bg"
|
|
||||||
app:tabGravity="start"
|
|
||||||
app:tabIndicatorHeight="0dp"
|
|
||||||
app:tabMode="scrollable"
|
|
||||||
app:tabPaddingEnd="25dp"
|
|
||||||
app:tabPaddingStart="25dp"
|
|
||||||
app:tabRippleColor="@android:color/transparent"
|
|
||||||
app:tabSelectedTextColor="@color/white"
|
|
||||||
app:tabTextColor="@color/color_primary" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/error_view"
|
android:layout_width="match_parent"
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_centerInParent="true"
|
android:orientation="horizontal">
|
||||||
android:gravity="center_horizontal"
|
|
||||||
android:orientation="vertical">
|
|
||||||
|
|
||||||
<TextView
|
<View
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="100dp"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
android:text="@string/something_went_wrong"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:textColor="@color/color_primary"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/retry_button"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="40dp"
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
android:text="@string/retry"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
android:background="@drawable/round_bg_25"
|
android:background="@drawable/round_bg_25"
|
||||||
android:backgroundTint="@color/game_grad_one"
|
|
||||||
|
|
||||||
android:layout_marginTop="5dp"
|
android:alpha="0.7"
|
||||||
android:paddingHorizontal="30dp"
|
android:backgroundTint="@android:color/darker_gray" />
|
||||||
|
|
||||||
/>
|
<View
|
||||||
|
android:layout_width="100dp"
|
||||||
|
android:layout_height="40dp"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
android:background="@drawable/round_bg_25"
|
||||||
|
|
||||||
|
android:alpha="0.7"
|
||||||
|
android:backgroundTint="@android:color/darker_gray" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<com.facebook.shimmer.ShimmerFrameLayout
|
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||||
android:id="@+id/product_shimmer"
|
|
||||||
android:layout_width="match_parent"
|
<com.google.android.material.tabs.TabLayout
|
||||||
|
android:id="@+id/category_tabs"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="45dp"
|
||||||
|
android:layout_marginStart="5dp"
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
app:tabBackground="@drawable/sub_category_tab_bg"
|
||||||
|
app:tabGravity="start"
|
||||||
|
app:tabIndicatorHeight="0dp"
|
||||||
|
app:tabMode="scrollable"
|
||||||
|
app:tabPaddingEnd="25dp"
|
||||||
|
app:tabPaddingStart="25dp"
|
||||||
|
app:tabRippleColor="@android:color/transparent"
|
||||||
|
app:tabSelectedTextColor="@color/white"
|
||||||
|
app:tabTextColor="@color/color_primary" />
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
|
android:id="@+id/error_view"
|
||||||
|
android:visibility="gone"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_centerInParent="true"
|
||||||
|
android:gravity="center_horizontal"
|
||||||
|
android:orientation="vertical">
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_below="@id/rv_products"
|
|
||||||
android:layout_marginTop="5dp"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:shimmer_auto_start="true"
|
|
||||||
app:shimmer_base_alpha="0.6"
|
|
||||||
app:shimmer_highlight_alpha="0.5">
|
|
||||||
|
|
||||||
<LinearLayout
|
android:text="@string/something_went_wrong"
|
||||||
android:layout_width="match_parent"
|
android:fontFamily="@font/exo_2_bold"
|
||||||
android:layout_height="wrap_content"
|
android:textColor="@color/color_primary"
|
||||||
android:orientation="vertical">
|
android:textSize="@dimen/_12ssp"
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:layout_marginVertical="5dp"
|
|
||||||
layout="@layout/product_view_holder"/>
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:layout_marginVertical="5dp"
|
|
||||||
layout="@layout/product_view_holder"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:layout_marginVertical="5dp"
|
|
||||||
layout="@layout/product_view_holder"/>
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:layout_marginVertical="5dp"
|
|
||||||
layout="@layout/product_view_holder"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:weightSum="2">
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:layout_marginVertical="5dp"
|
|
||||||
layout="@layout/product_view_holder"/>
|
|
||||||
|
|
||||||
<include
|
|
||||||
android:layout_width="0dp"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_weight="1"
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:layout_marginVertical="5dp"
|
|
||||||
layout="@layout/product_view_holder"/>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</LinearLayout>
|
|
||||||
|
|
||||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rv_products"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_below="@id/category_tabs"
|
|
||||||
android:visibility="gone"
|
|
||||||
|
|
||||||
tools:listitem="@layout/product_view_holder"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
|
||||||
app:spanCount="2"
|
|
||||||
|
|
||||||
android:layout_marginHorizontal="5dp"
|
|
||||||
android:overScrollMode="never"
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
<Button
|
||||||
android:id="@+id/prod_load_more_btn"
|
android:id="@+id/retry_button"
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="40dp"
|
||||||
android:layout_below="@id/rv_products"
|
|
||||||
|
|
||||||
android:text="@string/load_more"
|
android:text="@string/retry"
|
||||||
android:fontFamily="@font/exo_2_bold"
|
android:fontFamily="@font/exo_2_bold"
|
||||||
android:textColor="@color/white"
|
android:textColor="@color/white"
|
||||||
android:textSize="@dimen/_12ssp"
|
android:textSize="@dimen/_12ssp"
|
||||||
|
|
||||||
android:paddingHorizontal="25dp"
|
android:background="@drawable/round_bg_25"
|
||||||
android:layout_marginVertical="15dp"
|
android:backgroundTint="@color/game_grad_one"
|
||||||
|
|
||||||
android:background="@drawable/round_25"
|
android:layout_marginTop="5dp"
|
||||||
android:backgroundTint="@color/night_status"
|
android:paddingHorizontal="30dp"
|
||||||
|
|
||||||
android:layout_centerHorizontal="true"
|
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
</RelativeLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_products"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/category_tabs"
|
||||||
|
android:visibility="gone"
|
||||||
|
|
||||||
|
tools:listitem="@layout/product_view_holder"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
|
||||||
|
app:spanCount="2"
|
||||||
|
|
||||||
|
android:layout_marginHorizontal="5dp"
|
||||||
|
android:overScrollMode="never"
|
||||||
|
/>
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
@@ -347,27 +347,6 @@
|
|||||||
android:layout_marginTop="15dp"
|
android:layout_marginTop="15dp"
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<Button
|
|
||||||
android:id="@+id/load_more_btn"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
android:text="@string/load_more"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
android:paddingHorizontal="25dp"
|
|
||||||
android:layout_marginVertical="15dp"
|
|
||||||
|
|
||||||
android:background="@drawable/round_25"
|
|
||||||
android:backgroundTint="@color/night_status"
|
|
||||||
|
|
||||||
android:layout_gravity="center_horizontal"
|
|
||||||
|
|
||||||
/>
|
|
||||||
|
|
||||||
<com.facebook.shimmer.ShimmerFrameLayout
|
<com.facebook.shimmer.ShimmerFrameLayout
|
||||||
android:id="@+id/shimmer_show_data"
|
android:id="@+id/shimmer_show_data"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
|||||||
@@ -2,7 +2,7 @@
|
|||||||
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.core.widget.NestedScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:id="@+id/main"
|
android:id="@+id/nested_scroll_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="@color/color_primary"
|
android:background="@color/color_primary"
|
||||||
@@ -457,6 +457,30 @@
|
|||||||
app:tabSelectedTextColor="@color/white"
|
app:tabSelectedTextColor="@color/white"
|
||||||
app:tabTextColor="@color/color_primary" />
|
app:tabTextColor="@color/color_primary" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/teaser_txt"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginStart="15dp"
|
||||||
|
|
||||||
|
android:layout_marginTop="10dp"
|
||||||
|
android:fontFamily="@font/exo_2_bold"
|
||||||
|
android:text="@string/teasers"
|
||||||
|
android:textColor="@color/white"
|
||||||
|
|
||||||
|
android:textSize="@dimen/_14ssp"
|
||||||
|
android:visibility="gone" />
|
||||||
|
|
||||||
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
|
android:id="@+id/rv_teaser"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:orientation="vertical"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
|
tools:listitem="@layout/episode_view_holder" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/season_media_type"
|
android:id="@+id/season_media_type"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
@@ -481,25 +505,19 @@
|
|||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
||||||
tools:listitem="@layout/episode_view_holder" />
|
tools:listitem="@layout/episode_view_holder" />
|
||||||
|
|
||||||
<Button
|
<ProgressBar
|
||||||
android:id="@+id/ep_load_more_btn"
|
android:id="@+id/load_more_progress"
|
||||||
android:visibility="gone"
|
android:layout_width="25dp"
|
||||||
android:layout_width="wrap_content"
|
android:layout_height="25dp"
|
||||||
android:layout_height="wrap_content"
|
|
||||||
|
|
||||||
android:text="@string/load_more"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
android:textSize="@dimen/_12ssp"
|
|
||||||
|
|
||||||
android:paddingHorizontal="25dp"
|
|
||||||
android:layout_marginVertical="15dp"
|
|
||||||
|
|
||||||
android:background="@drawable/round_25"
|
|
||||||
android:backgroundTint="@color/night_status"
|
|
||||||
|
|
||||||
android:layout_gravity="center_horizontal"
|
android:layout_gravity="center_horizontal"
|
||||||
|
|
||||||
|
android:layout_marginVertical="15dp"
|
||||||
|
android:indeterminate="true"
|
||||||
|
|
||||||
|
android:indeterminateTint="@color/white"
|
||||||
|
|
||||||
|
android:visibility="gone"
|
||||||
|
|
||||||
/>
|
/>
|
||||||
|
|
||||||
<com.facebook.shimmer.ShimmerFrameLayout
|
<com.facebook.shimmer.ShimmerFrameLayout
|
||||||
@@ -523,11 +541,6 @@
|
|||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<include layout="@layout/episode_view_holder" />
|
<include layout="@layout/episode_view_holder" />
|
||||||
|
|
||||||
<include layout="@layout/episode_view_holder" />
|
|
||||||
|
|
||||||
<include layout="@layout/episode_view_holder" />
|
|
||||||
|
|
||||||
<include layout="@layout/episode_view_holder" />
|
<include layout="@layout/episode_view_holder" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
@@ -536,30 +549,6 @@
|
|||||||
|
|
||||||
</com.facebook.shimmer.ShimmerFrameLayout>
|
</com.facebook.shimmer.ShimmerFrameLayout>
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/teaser_txt"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginStart="15dp"
|
|
||||||
|
|
||||||
android:layout_marginTop="10dp"
|
|
||||||
android:fontFamily="@font/exo_2_bold"
|
|
||||||
android:text="@string/teasers"
|
|
||||||
android:textColor="@color/white"
|
|
||||||
|
|
||||||
android:textSize="@dimen/_14ssp"
|
|
||||||
android:visibility="gone" />
|
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
|
||||||
android:id="@+id/rv_teaser"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="15dp"
|
|
||||||
android:orientation="vertical"
|
|
||||||
android:visibility="gone"
|
|
||||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
|
|
||||||
tools:listitem="@layout/episode_view_holder" />
|
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
</androidx.core.widget.NestedScrollView>
|
</androidx.core.widget.NestedScrollView>
|
||||||
Reference in New Issue
Block a user