mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
feat(ui): show currently syncing api logo on navigation bar and rail (#1146)
This commit is contained in:
parent
6b93af5803
commit
ad27eb3b0e
2 changed files with 28 additions and 22 deletions
|
@ -165,10 +165,10 @@ dependencies {
|
||||||
|
|
||||||
// Android Core & Lifecycle
|
// Android Core & Lifecycle
|
||||||
implementation("androidx.core:core-ktx:1.13.1")
|
implementation("androidx.core:core-ktx:1.13.1")
|
||||||
implementation("androidx.appcompat:appcompat:1.6.1")
|
implementation("androidx.appcompat:appcompat:1.7.0")
|
||||||
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
implementation("androidx.navigation:navigation-ui-ktx:2.7.7")
|
||||||
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.7.0")
|
implementation("androidx.lifecycle:lifecycle-livedata-ktx:2.8.2")
|
||||||
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.7.0")
|
implementation("androidx.lifecycle:lifecycle-viewmodel-ktx:2.8.2")
|
||||||
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
|
implementation("androidx.navigation:navigation-fragment-ktx:2.7.7")
|
||||||
|
|
||||||
// Design & UI
|
// Design & UI
|
||||||
|
|
|
@ -44,9 +44,6 @@ import androidx.preference.PreferenceManager
|
||||||
import androidx.recyclerview.widget.LinearLayoutManager
|
import androidx.recyclerview.widget.LinearLayoutManager
|
||||||
import androidx.recyclerview.widget.LinearSnapHelper
|
import androidx.recyclerview.widget.LinearSnapHelper
|
||||||
import androidx.recyclerview.widget.RecyclerView
|
import androidx.recyclerview.widget.RecyclerView
|
||||||
import com.fasterxml.jackson.databind.DeserializationFeature
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper
|
|
||||||
import com.fasterxml.jackson.module.kotlin.jacksonObjectMapper
|
|
||||||
import com.google.android.gms.cast.framework.CastContext
|
import com.google.android.gms.cast.framework.CastContext
|
||||||
import com.google.android.gms.cast.framework.Session
|
import com.google.android.gms.cast.framework.Session
|
||||||
import com.google.android.gms.cast.framework.SessionManager
|
import com.google.android.gms.cast.framework.SessionManager
|
||||||
|
@ -95,12 +92,14 @@ import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.appStri
|
||||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.appStringResumeWatching
|
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.appStringResumeWatching
|
||||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.appStringSearch
|
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.appStringSearch
|
||||||
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.inAppAuths
|
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.inAppAuths
|
||||||
|
import com.lagradost.cloudstream3.syncproviders.AccountManager.Companion.localListApi
|
||||||
import com.lagradost.cloudstream3.syncproviders.SyncAPI
|
import com.lagradost.cloudstream3.syncproviders.SyncAPI
|
||||||
import com.lagradost.cloudstream3.ui.APIRepository
|
import com.lagradost.cloudstream3.ui.APIRepository
|
||||||
import com.lagradost.cloudstream3.ui.SyncWatchType
|
import com.lagradost.cloudstream3.ui.SyncWatchType
|
||||||
import com.lagradost.cloudstream3.ui.WatchType
|
import com.lagradost.cloudstream3.ui.WatchType
|
||||||
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_NAVIGATE_TO
|
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_NAVIGATE_TO
|
||||||
import com.lagradost.cloudstream3.ui.home.HomeViewModel
|
import com.lagradost.cloudstream3.ui.home.HomeViewModel
|
||||||
|
import com.lagradost.cloudstream3.ui.library.LibraryViewModel
|
||||||
import com.lagradost.cloudstream3.ui.player.BasicLink
|
import com.lagradost.cloudstream3.ui.player.BasicLink
|
||||||
import com.lagradost.cloudstream3.ui.player.GeneratorPlayer
|
import com.lagradost.cloudstream3.ui.player.GeneratorPlayer
|
||||||
import com.lagradost.cloudstream3.ui.player.LinkGenerator
|
import com.lagradost.cloudstream3.ui.player.LinkGenerator
|
||||||
|
@ -162,8 +161,6 @@ import com.lagradost.cloudstream3.utils.UIHelper.toPx
|
||||||
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
|
import com.lagradost.cloudstream3.utils.USER_PROVIDER_API
|
||||||
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
|
import com.lagradost.cloudstream3.utils.USER_SELECTED_HOMEPAGE_API
|
||||||
import com.lagradost.cloudstream3.utils.fcast.FcastManager
|
import com.lagradost.cloudstream3.utils.fcast.FcastManager
|
||||||
import com.lagradost.nicehttp.Requests
|
|
||||||
import com.lagradost.nicehttp.ResponseParser
|
|
||||||
import com.lagradost.safefile.SafeFile
|
import com.lagradost.safefile.SafeFile
|
||||||
import kotlinx.coroutines.sync.Mutex
|
import kotlinx.coroutines.sync.Mutex
|
||||||
import kotlinx.coroutines.sync.withLock
|
import kotlinx.coroutines.sync.withLock
|
||||||
|
@ -570,18 +567,10 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
||||||
false
|
false
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
binding?.apply {
|
binding?.apply {
|
||||||
navView.isVisible = isNavVisible && !landscape
|
|
||||||
navRailView.isVisible = isNavVisible && landscape
|
navRailView.isVisible = isNavVisible && landscape
|
||||||
|
navView.isVisible = isNavVisible && !landscape
|
||||||
// Hide library on TV since it is not supported yet :(
|
|
||||||
//val isTrueTv = isTrueTvSettings()
|
|
||||||
//navView.menu.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
|
||||||
//navRailView.menu.findItem(R.id.navigation_library)?.isVisible = !isTrueTv
|
|
||||||
|
|
||||||
// Hide downloads on TV
|
|
||||||
//navView.menu.findItem(R.id.navigation_downloads)?.isVisible = !isTrueTv
|
|
||||||
//navRailView.menu.findItem(R.id.navigation_downloads)?.isVisible = !isTrueTv
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -770,14 +759,14 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
||||||
|
|
||||||
lateinit var viewModel: ResultViewModel2
|
lateinit var viewModel: ResultViewModel2
|
||||||
lateinit var syncViewModel: SyncViewModel
|
lateinit var syncViewModel: SyncViewModel
|
||||||
|
private var libraryViewModel: LibraryViewModel? = null
|
||||||
|
|
||||||
/** kinda dirty, however it signals that we should use the watch status as sync or not*/
|
/** kinda dirty, however it signals that we should use the watch status as sync or not*/
|
||||||
var isLocalList: Boolean = false
|
var isLocalList: Boolean = false
|
||||||
override fun onCreateView(name: String, context: Context, attrs: AttributeSet): View? {
|
override fun onCreateView(name: String, context: Context, attrs: AttributeSet): View? {
|
||||||
viewModel =
|
|
||||||
ViewModelProvider(this)[ResultViewModel2::class.java]
|
viewModel = ViewModelProvider(this)[ResultViewModel2::class.java]
|
||||||
syncViewModel =
|
syncViewModel = ViewModelProvider(this)[SyncViewModel::class.java]
|
||||||
ViewModelProvider(this)[SyncViewModel::class.java]
|
|
||||||
|
|
||||||
return super.onCreateView(name, context, attrs)
|
return super.onCreateView(name, context, attrs)
|
||||||
}
|
}
|
||||||
|
@ -1123,6 +1112,23 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
||||||
|
|
||||||
MainAPI.settingsForProvider = settingsForProvider
|
MainAPI.settingsForProvider = settingsForProvider
|
||||||
|
|
||||||
|
// Change library icon with logo of current api in sync
|
||||||
|
libraryViewModel = ViewModelProvider(this)[LibraryViewModel::class.java]
|
||||||
|
libraryViewModel?.currentApiName?.observe(this) {
|
||||||
|
val syncAPI = libraryViewModel?.currentSyncApi
|
||||||
|
Log.i("SYNC_API", "${syncAPI?.name}, ${syncAPI?.idPrefix}")
|
||||||
|
val icon = if (syncAPI?.idPrefix == localListApi.idPrefix) {
|
||||||
|
R.drawable.library_icon
|
||||||
|
} else {
|
||||||
|
syncAPI?.icon ?: R.drawable.library_icon
|
||||||
|
}
|
||||||
|
|
||||||
|
binding?.apply {
|
||||||
|
navRailView.menu.findItem(R.id.navigation_library)?.setIcon(icon)
|
||||||
|
navView.menu.findItem(R.id.navigation_library)?.setIcon(icon)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
loadThemes(this)
|
loadThemes(this)
|
||||||
updateLocale()
|
updateLocale()
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
|
|
Loading…
Reference in a new issue