forked from recloudstream/cloudstream
minor change
This commit is contained in:
parent
3cd335aaa0
commit
e3cc7ca489
6 changed files with 31 additions and 27 deletions
|
@ -18,7 +18,7 @@ import androidx.navigation.NavDestination
|
||||||
import androidx.navigation.NavDestination.Companion.hierarchy
|
import androidx.navigation.NavDestination.Companion.hierarchy
|
||||||
import androidx.navigation.NavGraph.Companion.findStartDestination
|
import androidx.navigation.NavGraph.Companion.findStartDestination
|
||||||
import androidx.navigation.NavOptions
|
import androidx.navigation.NavOptions
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
import androidx.navigation.ui.setupWithNavController
|
import androidx.navigation.ui.setupWithNavController
|
||||||
import androidx.preference.PreferenceManager
|
import androidx.preference.PreferenceManager
|
||||||
import com.google.android.gms.cast.framework.*
|
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.onUserLeaveHint
|
||||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||||
import com.lagradost.cloudstream3.CommonActivity.updateLocale
|
import com.lagradost.cloudstream3.CommonActivity.updateLocale
|
||||||
|
import com.lagradost.cloudstream3.movieproviders.NginxProvider
|
||||||
import com.lagradost.cloudstream3.mvvm.logError
|
import com.lagradost.cloudstream3.mvvm.logError
|
||||||
import com.lagradost.cloudstream3.network.Requests
|
import com.lagradost.cloudstream3.network.Requests
|
||||||
import com.lagradost.cloudstream3.receivers.VideoDownloadRestartReceiver
|
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.hideKeyboard
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
import com.lagradost.cloudstream3.utils.UIHelper.navigate
|
||||||
import com.lagradost.cloudstream3.utils.UIHelper.requestRW
|
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.activity_main.*
|
||||||
import kotlinx.android.synthetic.main.fragment_result_swipe.*
|
import kotlinx.android.synthetic.main.fragment_result_swipe.*
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.runBlocking
|
import kotlinx.coroutines.runBlocking
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
import kotlin.collections.HashMap
|
|
||||||
import kotlin.concurrent.thread
|
import kotlin.concurrent.thread
|
||||||
|
|
||||||
|
|
||||||
|
@ -107,7 +106,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
override fun onConfigurationChanged(newConfig: Configuration) {
|
override fun onConfigurationChanged(newConfig: Configuration) {
|
||||||
super.onConfigurationChanged(newConfig)
|
super.onConfigurationChanged(newConfig)
|
||||||
updateLocale() // android fucks me by chaining lang when rotating the phone
|
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) {
|
private fun updateNavBar(destination: NavDestination) {
|
||||||
|
@ -521,8 +522,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
|
||||||
setUpBackup()
|
setUpBackup()
|
||||||
|
|
||||||
CommonActivity.init(this)
|
CommonActivity.init(this)
|
||||||
|
val navHostFragment = supportFragmentManager.findFragmentById(R.id.nav_host_fragment) as NavHostFragment
|
||||||
val navController = findNavController(R.id.nav_host_fragment)
|
val navController = navHostFragment.navController
|
||||||
|
//val navController = findNavController(R.id.nav_host_fragment)
|
||||||
|
|
||||||
/*navOptions = NavOptions.Builder()
|
/*navOptions = NavOptions.Builder()
|
||||||
.setLaunchSingleTop(true)
|
.setLaunchSingleTop(true)
|
||||||
|
|
|
@ -9,7 +9,7 @@ import androidx.appcompat.app.AppCompatActivity
|
||||||
import androidx.core.view.isVisible
|
import androidx.core.view.isVisible
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
import androidx.lifecycle.ViewModelProvider
|
import androidx.lifecycle.ViewModelProvider
|
||||||
import androidx.navigation.findNavController
|
import androidx.navigation.fragment.NavHostFragment
|
||||||
import androidx.recyclerview.widget.GridLayoutManager
|
import androidx.recyclerview.widget.GridLayoutManager
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.lagradost.cloudstream3.R
|
import com.lagradost.cloudstream3.R
|
||||||
|
@ -113,8 +113,8 @@ class DownloadFragment : Fragment() {
|
||||||
//wont be called
|
//wont be called
|
||||||
} else {
|
} else {
|
||||||
val folder = DataStore.getFolderName(DOWNLOAD_EPISODE_CACHE, click.data.id.toString())
|
val folder = DataStore.getFolderName(DOWNLOAD_EPISODE_CACHE, click.data.id.toString())
|
||||||
val navController = activity?.findNavController(R.id.nav_host_fragment)
|
val navHostFragment = activity?.supportFragmentManager?.findFragmentById(R.id.nav_host_fragment) as? NavHostFragment?
|
||||||
navController?.navigate(
|
navHostFragment?.navController?.navigate(
|
||||||
R.id.navigation_download_child,
|
R.id.navigation_download_child,
|
||||||
DownloadChildFragment.newInstance(click.data.name, folder)
|
DownloadChildFragment.newInstance(click.data.name, folder)
|
||||||
)
|
)
|
||||||
|
|
|
@ -1321,7 +1321,7 @@ class ResultFragment : Fragment(), PanelsChildGestureRegionObserver.GestureRegio
|
||||||
result_sync_names?.text =
|
result_sync_names?.text =
|
||||||
list.filter { it.isSynced && it.hasAccount }.joinToString { it.name }
|
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?.isVisible = newList.isNotEmpty()
|
||||||
(result_mini_sync?.adapter as? ImageAdapter?)?.updateList(newList.map { it.icon })
|
(result_mini_sync?.adapter as? ImageAdapter?)?.updateList(newList.map { it.icon })
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
app:menu="@menu/bottom_nav_menu"
|
app:menu="@menu/bottom_nav_menu"
|
||||||
app:layout_constraintBottom_toBottomOf="parent" />
|
app:layout_constraintBottom_toBottomOf="parent" />
|
||||||
|
|
||||||
<fragment
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
|
|
@ -12,22 +12,7 @@
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:layout_width="match_parent">
|
android:layout_width="match_parent">
|
||||||
|
|
||||||
<com.google.android.material.navigationrail.NavigationRailView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:layout_width="62dp"
|
|
||||||
android:layout_height="match_parent"
|
|
||||||
android:id="@+id/nav_rail_view"
|
|
||||||
android:background="?attr/primaryGrayBackground"
|
|
||||||
app:itemTextColor="@color/item_select_color"
|
|
||||||
app:itemIconTint="@color/item_select_color"
|
|
||||||
app:menuGravity="center"
|
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
app:labelVisibilityMode="unlabeled"
|
|
||||||
app:menu="@menu/bottom_nav_menu">
|
|
||||||
|
|
||||||
</com.google.android.material.navigationrail.NavigationRailView>
|
|
||||||
|
|
||||||
<fragment
|
|
||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
android:name="androidx.navigation.fragment.NavHostFragment"
|
android:name="androidx.navigation.fragment.NavHostFragment"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
|
@ -40,6 +25,22 @@
|
||||||
app:layout_constraintStart_toEndOf="@id/nav_rail_view"
|
app:layout_constraintStart_toEndOf="@id/nav_rail_view"
|
||||||
app:layout_constraintEnd_toEndOf="parent" />
|
app:layout_constraintEnd_toEndOf="parent" />
|
||||||
|
|
||||||
|
<com.google.android.material.navigationrail.NavigationRailView
|
||||||
|
android:layout_width="62dp"
|
||||||
|
android:layout_height="match_parent"
|
||||||
|
android:id="@+id/nav_rail_view"
|
||||||
|
android:background="?attr/primaryGrayBackground"
|
||||||
|
app:itemTextColor="@color/item_select_color"
|
||||||
|
app:itemIconTint="@color/item_select_color"
|
||||||
|
|
||||||
|
app:menuGravity="center"
|
||||||
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
|
app:labelVisibilityMode="unlabeled"
|
||||||
|
app:menu="@menu/bottom_nav_menu">
|
||||||
|
|
||||||
|
</com.google.android.material.navigationrail.NavigationRailView>
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
app:layout_constraintStart_toEndOf="@+id/nav_rail_view"
|
app:layout_constraintStart_toEndOf="@+id/nav_rail_view"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
|
|
@ -6,5 +6,6 @@
|
||||||
android:layout_height="35dp"
|
android:layout_height="35dp"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
tools:src="@drawable/ic_anilist_icon"
|
tools:src="@drawable/ic_anilist_icon"
|
||||||
|
android:background="?android:attr/selectableItemBackgroundBorderless"
|
||||||
app:tint="?attr/white">
|
app:tint="?attr/white">
|
||||||
</ImageView>
|
</ImageView>
|
Loading…
Reference in a new issue