From e3cc7ca489acc62de5e15810e19c630e18ac7e2f Mon Sep 17 00:00:00 2001 From: LagradOst <11805592+LagradOst@users.noreply.github.com> Date: Fri, 22 Apr 2022 20:53:58 +0200 Subject: [PATCH] minor change --- .../lagradost/cloudstream3/MainActivity.kt | 14 ++++---- .../ui/download/DownloadFragment.kt | 6 ++-- .../cloudstream3/ui/result/ResultFragment.kt | 2 +- app/src/main/res/layout/activity_main.xml | 2 +- app/src/main/res/layout/activity_main_tv.xml | 33 ++++++++++--------- app/src/main/res/layout/result_mini_image.xml | 1 + 6 files changed, 31 insertions(+), 27 deletions(-) diff --git a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt index 80b207a4..5d82e1a4 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/MainActivity.kt @@ -18,7 +18,7 @@ import androidx.navigation.NavDestination import androidx.navigation.NavDestination.Companion.hierarchy import androidx.navigation.NavGraph.Companion.findStartDestination import androidx.navigation.NavOptions -import androidx.navigation.findNavController +import androidx.navigation.fragment.NavHostFragment import androidx.navigation.ui.setupWithNavController import androidx.preference.PreferenceManager import com.google.android.gms.cast.framework.* @@ -34,6 +34,7 @@ import com.lagradost.cloudstream3.CommonActivity.onDialogDismissedEvent import com.lagradost.cloudstream3.CommonActivity.onUserLeaveHint import com.lagradost.cloudstream3.CommonActivity.showToast import com.lagradost.cloudstream3.CommonActivity.updateLocale +import com.lagradost.cloudstream3.movieproviders.NginxProvider import com.lagradost.cloudstream3.mvvm.logError import com.lagradost.cloudstream3.network.Requests import com.lagradost.cloudstream3.receivers.VideoDownloadRestartReceiver @@ -64,14 +65,12 @@ import com.lagradost.cloudstream3.utils.UIHelper.getResourceColor import com.lagradost.cloudstream3.utils.UIHelper.hideKeyboard import com.lagradost.cloudstream3.utils.UIHelper.navigate import com.lagradost.cloudstream3.utils.UIHelper.requestRW -import com.lagradost.cloudstream3.movieproviders.NginxProvider import kotlinx.android.synthetic.main.activity_main.* import kotlinx.android.synthetic.main.fragment_result_swipe.* import kotlinx.coroutines.Dispatchers import kotlinx.coroutines.runBlocking import kotlinx.coroutines.withContext import java.io.File -import kotlin.collections.HashMap import kotlin.concurrent.thread @@ -107,7 +106,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { override fun onConfigurationChanged(newConfig: Configuration) { super.onConfigurationChanged(newConfig) updateLocale() // android fucks me by chaining lang when rotating the phone - findNavController(R.id.nav_host_fragment).currentDestination?.let { updateNavBar(it) } + + val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment + navHostFragment.navController.currentDestination?.let { updateNavBar(it) } } private fun updateNavBar(destination: NavDestination) { @@ -521,8 +522,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener { setUpBackup() CommonActivity.init(this) - - val navController = findNavController(R.id.nav_host_fragment) + val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment + val navController = navHostFragment.navController + //val navController = findNavController(R.id.nav_host_fragment) /*navOptions = NavOptions.Builder() .setLaunchSingleTop(true) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt index b2f3d444..1a1b96fa 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/download/DownloadFragment.kt @@ -9,7 +9,7 @@ import androidx.appcompat.app.AppCompatActivity import androidx.core.view.isVisible import androidx.fragment.app.Fragment import androidx.lifecycle.ViewModelProvider -import androidx.navigation.findNavController +import androidx.navigation.fragment.NavHostFragment import androidx.recyclerview.widget.GridLayoutManager import androidx.recyclerview.widget.RecyclerView import com.lagradost.cloudstream3.R @@ -113,8 +113,8 @@ class DownloadFragment : Fragment() { //wont be called } else { val folder = DataStore.getFolderName(DOWNLOAD_EPISODE_CACHE, click.data.id.toString()) - val navController = activity?.findNavController(R.id.nav_host_fragment) - navController?.navigate( + val navHostFragment = activity?.supportFragmentManager?.findFragmentById(R.id.nav_host_fragment) as? NavHostFragment? + navHostFragment?.navController?.navigate( R.id.navigation_download_child, DownloadChildFragment.newInstance(click.data.name, folder) ) diff --git a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt index 18050f3f..86d5a865 100644 --- a/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt +++ b/app/src/main/java/com/lagradost/cloudstream3/ui/result/ResultFragment.kt @@ -1321,7 +1321,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio result_sync_names?.text = list.filter { it.isSynced && it.hasAccount }.joinToString { it.name } - val newList = list.filter { it.isSynced } + val newList = list.filter { it.isSynced && it.hasAccount } result_mini_sync?.isVisible = newList.isNotEmpty() (result_mini_sync?.adapter as? ImageAdapter?)?.updateList(newList.map { it.icon }) diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index a5ec2921..f8ca8cbd 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -44,7 +44,7 @@ app:menu="@menu/bottom_nav_menu" app:layout_constraintBottom_toBottomOf="parent" /> - - - - - - + + + + \ No newline at end of file