mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
feat(TV UI): Navigation rail redesign
This commit is contained in:
parent
b2f08847e1
commit
15843c73eb
28 changed files with 272 additions and 41 deletions
|
@ -18,6 +18,8 @@ import android.view.MenuItem
|
|||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.WindowManager
|
||||
import android.widget.ImageView
|
||||
import android.widget.LinearLayout
|
||||
import android.widget.Toast
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.activity.result.ActivityResultLauncher
|
||||
|
@ -25,6 +27,7 @@ import androidx.annotation.IdRes
|
|||
import androidx.annotation.MainThread
|
||||
import androidx.appcompat.app.AlertDialog
|
||||
import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.cardview.widget.CardView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.core.view.children
|
||||
import androidx.core.view.isGone
|
||||
|
@ -96,6 +99,8 @@ import com.lagradost.cloudstream3.syncproviders.SyncAPI
|
|||
import com.lagradost.cloudstream3.ui.APIRepository
|
||||
import com.lagradost.cloudstream3.ui.SyncWatchType
|
||||
import com.lagradost.cloudstream3.ui.WatchType
|
||||
import com.lagradost.cloudstream3.ui.account.AccountHelper.showAccountSelectLinear
|
||||
import com.lagradost.cloudstream3.ui.account.AccountViewModel
|
||||
import com.lagradost.cloudstream3.ui.download.DOWNLOAD_NAVIGATE_TO
|
||||
import com.lagradost.cloudstream3.ui.home.HomeViewModel
|
||||
import com.lagradost.cloudstream3.ui.library.LibraryViewModel
|
||||
|
@ -326,6 +331,10 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
*/
|
||||
val reloadLibraryEvent = Event<Boolean>()
|
||||
|
||||
/**
|
||||
* Used by DataStoreHelper to fully reload Navigation Rail header picture
|
||||
*/
|
||||
val reloadAccountEvent = Event<Boolean>()
|
||||
|
||||
/**
|
||||
* @return true if the str has launched an app task (be it successful or not)
|
||||
|
@ -791,6 +800,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
lateinit var viewModel: ResultViewModel2
|
||||
lateinit var syncViewModel: SyncViewModel
|
||||
private var libraryViewModel: LibraryViewModel? = null
|
||||
private var accountViewModel: AccountViewModel? = null
|
||||
|
||||
/** kinda dirty, however it signals that we should use the watch status as sync or not*/
|
||||
var isLocalList: Boolean = false
|
||||
|
@ -1210,6 +1220,7 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
)
|
||||
|
||||
newLocalBinding.root.viewTreeObserver.addOnGlobalFocusChangeListener { _, newFocus ->
|
||||
//Log.d("King", "Focus => $newFocus")
|
||||
if (exceptionButtons.contains(newFocus?.id)) return@addOnGlobalFocusChangeListener
|
||||
centerView(newFocus)
|
||||
}
|
||||
|
@ -1552,18 +1563,19 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
logError(e)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// we need to run this after we init all apis, otherwise currentSyncApi will fuck itself
|
||||
this@MainActivity.runOnUiThread {
|
||||
// Change library icon with logo of current api in sync
|
||||
libraryViewModel = ViewModelProvider(this@MainActivity)[LibraryViewModel::class.java]
|
||||
libraryViewModel =
|
||||
ViewModelProvider(this@MainActivity)[LibraryViewModel::class.java]
|
||||
libraryViewModel?.currentApiName?.observe(this@MainActivity) {
|
||||
val syncAPI = libraryViewModel?.currentSyncApi
|
||||
val syncAPI = libraryViewModel?.currentSyncApi
|
||||
Log.i("SYNC_API", "${syncAPI?.name}, ${syncAPI?.idPrefix}")
|
||||
val icon = if (syncAPI?.idPrefix == localListApi.idPrefix) {
|
||||
R.drawable.library_icon
|
||||
val icon = if (syncAPI?.idPrefix == localListApi.idPrefix) {
|
||||
R.drawable.library_icon_selector
|
||||
} else {
|
||||
syncAPI?.icon ?: R.drawable.library_icon
|
||||
syncAPI?.icon ?: R.drawable.library_icon_selector
|
||||
}
|
||||
|
||||
binding?.apply {
|
||||
|
@ -1658,7 +1670,23 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener, BiometricCa
|
|||
}
|
||||
}
|
||||
}
|
||||
noFocus(this)
|
||||
//noFocus(this)
|
||||
|
||||
val navProfileRoot = findViewById<LinearLayout>(R.id.nav_footer_root)
|
||||
val navProfilePic = findViewById<ImageView>(R.id.nav_footer_profile_pic)
|
||||
val navProfileCard = findViewById<CardView>(R.id.nav_footer_profile_card)
|
||||
|
||||
navProfileCard?.setOnClickListener {
|
||||
showAccountSelectLinear()
|
||||
}
|
||||
|
||||
val profileImage = DataStoreHelper.getCurrentAccount()?.image
|
||||
|
||||
if (navProfilePic != null) {
|
||||
navProfilePic.setImage(profileImage)
|
||||
} else {
|
||||
navProfileRoot?.isGone = true
|
||||
}
|
||||
}
|
||||
|
||||
loadCache()
|
||||
|
|
|
@ -294,6 +294,9 @@ object PluginManager {
|
|||
main {
|
||||
val uitext = txt(R.string.plugins_updated, updatedPlugins.size)
|
||||
createNotification(activity, uitext, updatedPlugins)
|
||||
/*val navBadge = (activity as MainActivity).binding?.navRailView?.getOrCreateBadge(R.id.navigation_settings)
|
||||
navBadge?.isVisible = true
|
||||
navBadge?.number = 5*/
|
||||
}
|
||||
|
||||
// ioSafe {
|
||||
|
|
|
@ -22,6 +22,7 @@ import androidx.recyclerview.widget.RecyclerView
|
|||
import com.google.android.material.bottomsheet.BottomSheetBehavior
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.lagradost.api.Log
|
||||
import com.lagradost.cloudstream3.*
|
||||
import com.lagradost.cloudstream3.APIHolder.apis
|
||||
import com.lagradost.cloudstream3.CommonActivity.showToast
|
||||
|
@ -57,6 +58,7 @@ import com.lagradost.cloudstream3.utils.SubtitleHelper.getFlagFromIso
|
|||
import com.lagradost.cloudstream3.utils.UIHelper.dismissSafe
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.getSpanCount
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.popupMenuNoIconsAndNoStringRes
|
||||
import com.lagradost.cloudstream3.utils.UIHelper.setImage
|
||||
import java.util.*
|
||||
|
||||
|
||||
|
@ -555,6 +557,13 @@ class HomeFragment : Fragment() {
|
|||
binding?.homeChangeApi?.text = apiName
|
||||
}
|
||||
|
||||
observe(homeViewModel.currentAccount) { currentAccount ->
|
||||
val navProfilePic = (activity as MainActivity).binding?.navRailView?.findViewById<ImageView>(R.id.nav_footer_profile_pic)
|
||||
navProfilePic?.setImage(
|
||||
currentAccount?.image
|
||||
)
|
||||
}
|
||||
|
||||
observe(homeViewModel.page) { data ->
|
||||
binding?.apply {
|
||||
when (data) {
|
||||
|
|
|
@ -16,6 +16,8 @@ import androidx.viewbinding.ViewBinding
|
|||
import androidx.viewpager2.widget.ViewPager2
|
||||
import com.google.android.material.chip.Chip
|
||||
import com.google.android.material.chip.ChipGroup
|
||||
import com.google.android.material.navigation.NavigationBarItemView
|
||||
import com.google.android.material.navigationrail.NavigationRailMenuView
|
||||
import com.lagradost.cloudstream3.AcraApplication.Companion.getActivity
|
||||
import com.lagradost.cloudstream3.CommonActivity.activity
|
||||
import com.lagradost.cloudstream3.HomePageList
|
||||
|
@ -476,7 +478,8 @@ class HomeParentItemAdapterPreview(
|
|||
homePreviewHiddenPrevFocus.setOnFocusChangeListener { _, hasFocus ->
|
||||
if (!hasFocus) return@setOnFocusChangeListener
|
||||
if (previewViewpager.currentItem <= 0) {
|
||||
(activity as? MainActivity)?.binding?.navRailView?.requestFocus()
|
||||
//Focus the Home item as the default focus will be the header item
|
||||
(activity as? MainActivity)?.binding?.navRailView?.findViewById<NavigationBarItemView>(R.id.navigation_home)?.requestFocus()
|
||||
} else {
|
||||
previewViewpager.setCurrentItem(previewViewpager.currentItem - 1, true)
|
||||
binding.homePreviewPlayBtt.requestFocus()
|
||||
|
|
|
@ -45,6 +45,7 @@ import com.lagradost.cloudstream3.utils.DataStoreHelper.deleteAllResumeStateIds
|
|||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getAllResumeStateIds
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getAllWatchStateIds
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getBookmarkedData
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getCurrentAccount
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getLastWatched
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getResultWatchState
|
||||
import com.lagradost.cloudstream3.utils.DataStoreHelper.getViewPos
|
||||
|
@ -108,6 +109,9 @@ class HomeViewModel : ViewModel() {
|
|||
private val _apiName = MutableLiveData<String>()
|
||||
val apiName: LiveData<String> = _apiName
|
||||
|
||||
private val _currentAccount = MutableLiveData<DataStoreHelper.Account?>()
|
||||
val currentAccount: MutableLiveData<DataStoreHelper.Account?> = _currentAccount
|
||||
|
||||
private val _randomItems = MutableLiveData<List<SearchResponse>?>(null)
|
||||
val randomItems: LiveData<List<SearchResponse>?> = _randomItems
|
||||
|
||||
|
@ -404,7 +408,6 @@ class HomeViewModel : ViewModel() {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
private val _popup = MutableLiveData<Pair<ExpandableHomepageList, (() -> Unit)?>?>(null)
|
||||
val popup: LiveData<Pair<ExpandableHomepageList, (() -> Unit)?>?> = _popup
|
||||
|
||||
|
@ -431,11 +434,18 @@ class HomeViewModel : ViewModel() {
|
|||
loadAndCancel(DataStoreHelper.currentHomePage, true)
|
||||
}
|
||||
|
||||
private fun reloadAccount(unused: Boolean = false) {
|
||||
_currentAccount.postValue(
|
||||
getCurrentAccount()
|
||||
)
|
||||
}
|
||||
|
||||
init {
|
||||
MainActivity.bookmarksUpdatedEvent += ::bookmarksUpdated
|
||||
MainActivity.afterPluginsLoadedEvent += ::afterPluginsLoaded
|
||||
MainActivity.mainPluginsLoadedEvent += ::afterMainPluginsLoaded
|
||||
MainActivity.reloadHomeEvent += ::reloadHome
|
||||
MainActivity.reloadAccountEvent += ::reloadAccount
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
|
@ -443,6 +453,7 @@ class HomeViewModel : ViewModel() {
|
|||
MainActivity.afterPluginsLoadedEvent -= ::afterPluginsLoaded
|
||||
MainActivity.mainPluginsLoadedEvent -= ::afterMainPluginsLoaded
|
||||
MainActivity.reloadHomeEvent -= ::reloadHome
|
||||
MainActivity.reloadAccountEvent -= ::reloadAccount
|
||||
super.onCleared()
|
||||
}
|
||||
|
||||
|
|
|
@ -166,6 +166,7 @@ object DataStoreHelper {
|
|||
showToast(context?.getString(R.string.logged_account, account.name) ?: account.name)
|
||||
MainActivity.bookmarksUpdatedEvent(true)
|
||||
MainActivity.reloadLibraryEvent(true)
|
||||
MainActivity.reloadAccountEvent(true)
|
||||
val oldAccount = accounts.find { it.keyIndex == account.keyIndex }
|
||||
if (oldAccount != null && currentHomePage != homepage) {
|
||||
// This is not a new account, and the homepage has changed, reload it
|
||||
|
@ -191,6 +192,18 @@ object DataStoreHelper {
|
|||
}
|
||||
}
|
||||
|
||||
fun getAccount(accountIndex: Int): Account? {
|
||||
return accounts.firstOrNull {
|
||||
it.keyIndex == accountIndex
|
||||
}
|
||||
}
|
||||
|
||||
fun getCurrentAccount(): Account? {
|
||||
return accounts.firstOrNull {
|
||||
it.keyIndex == selectedKeyIndex
|
||||
}
|
||||
}
|
||||
|
||||
data class PosDur(
|
||||
@JsonProperty("position") val position: Long,
|
||||
@JsonProperty("duration") val duration: Long
|
||||
|
|
|
@ -3,5 +3,5 @@
|
|||
<item android:color="?attr/colorPrimary" android:state_checked="true"/>
|
||||
<item android:color="?attr/colorPrimary" android:state_focused="true"/>
|
||||
<item android:color="?attr/colorPrimary" android:state_selected="true"/>
|
||||
<item android:color="?attr/grayTextColor" android:state_checked="false"/>
|
||||
<item android:color="@color/whiteSmoke" android:state_checked="false"/>
|
||||
</selector>
|
9
app/src/main/res/drawable/home_icon_filled_24.xml
Normal file
9
app/src/main/res/drawable/home_icon_filled_24.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M160,840v-480l320,-240 320,240v480L560,840v-280L400,560v280L160,840Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/home_icon_outline_24.xml
Normal file
9
app/src/main/res/drawable/home_icon_outline_24.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M240,760h120v-240h240v240h120v-360L480,220 240,400v360ZM160,840v-480l320,-240 320,240v480L520,840v-240h-80v240L160,840ZM480,490Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
6
app/src/main/res/drawable/home_icon_selector.xml
Normal file
6
app/src/main/res/drawable/home_icon_selector.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/home_icon_filled_24" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/home_icon_filled_24" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/home_icon_outline_24"/>
|
||||
</selector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M160,760v-80h80v-280q0,-83 50,-147.5T420,168v-28q0,-25 17.5,-42.5T480,80q25,0 42.5,17.5T540,140v28q80,20 130,84.5T720,400v280h80v80L160,760ZM480,880q-33,0 -56.5,-23.5T400,800h160q0,33 -23.5,56.5T480,880Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="M160,760v-80h80v-280q0,-83 50,-147.5T420,168v-28q0,-25 17.5,-42.5T480,80q25,0 42.5,17.5T540,140v28q80,20 130,84.5T720,400v280h80v80L160,760ZM480,460ZM480,880q-33,0 -56.5,-23.5T400,800h160q0,33 -23.5,56.5T480,880ZM320,680h320v-280q0,-66 -47,-113t-113,-47q-66,0 -113,47t-47,113v280Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
10
app/src/main/res/drawable/library_icon_filled.xml
Normal file
10
app/src/main/res/drawable/library_icon_filled.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960"
|
||||
android:tint="?attr/white">
|
||||
<path
|
||||
android:pathData="M160,800q-33,0 -56.5,-23.5T80,720v-480q0,-33 23.5,-56.5T160,160h240l80,80h320q33,0 56.5,23.5T880,320L160,320v400l96,-320h684L837,743q-8,26 -29.5,41.5T760,800L160,800Z"
|
||||
android:fillColor="@android:color/white"/>
|
||||
</vector>
|
6
app/src/main/res/drawable/library_icon_selector.xml
Normal file
6
app/src/main/res/drawable/library_icon_selector.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/library_icon_filled" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/library_icon_filled" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/library_icon"/>
|
||||
</selector>
|
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/ic_filled_notifications_24dp" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/ic_filled_notifications_24dp" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/ic_outline_notifications_24dp"/>
|
||||
</selector>
|
10
app/src/main/res/drawable/outline_big_20.xml
Normal file
10
app/src/main/res/drawable/outline_big_20.xml
Normal file
|
@ -0,0 +1,10 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android" >
|
||||
<stroke android:width="2dp"
|
||||
android:color="?attr/white"/>
|
||||
<corners
|
||||
android:bottomLeftRadius="20dp"
|
||||
android:bottomRightRadius="20dp"
|
||||
android:topLeftRadius="20dp"
|
||||
android:topRightRadius="20dp" />
|
||||
</shape>
|
5
app/src/main/res/drawable/outline_drawable_round_20.xml
Normal file
5
app/src/main/res/drawable/outline_drawable_round_20.xml
Normal file
|
@ -0,0 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:state_focused="true"
|
||||
android:drawable="@drawable/outline_big_20"/> <!-- focused -->
|
||||
</selector>
|
9
app/src/main/res/drawable/settings_icon_filled.xml
Normal file
9
app/src/main/res/drawable/settings_icon_filled.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="m370,880 l-16,-128q-13,-5 -24.5,-12T307,725l-119,50L78,585l103,-78q-1,-7 -1,-13.5v-27q0,-6.5 1,-13.5L78,375l110,-190 119,50q11,-8 23,-15t24,-12l16,-128h220l16,128q13,5 24.5,12t22.5,15l119,-50 110,190 -103,78q1,7 1,13.5v27q0,6.5 -2,13.5l103,78 -110,190 -118,-50q-11,8 -23,15t-24,12L590,880L370,880ZM482,620q58,0 99,-41t41,-99q0,-58 -41,-99t-99,-41q-59,0 -99.5,41T342,480q0,58 40.5,99t99.5,41Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
9
app/src/main/res/drawable/settings_icon_outline.xml
Normal file
9
app/src/main/res/drawable/settings_icon_outline.xml
Normal file
|
@ -0,0 +1,9 @@
|
|||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="960"
|
||||
android:viewportHeight="960">
|
||||
<path
|
||||
android:pathData="m370,880 l-16,-128q-13,-5 -24.5,-12T307,725l-119,50L78,585l103,-78q-1,-7 -1,-13.5v-27q0,-6.5 1,-13.5L78,375l110,-190 119,50q11,-8 23,-15t24,-12l16,-128h220l16,128q13,5 24.5,12t22.5,15l119,-50 110,190 -103,78q1,7 1,13.5v27q0,6.5 -2,13.5l103,78 -110,190 -118,-50q-11,8 -23,15t-24,12L590,880L370,880ZM440,800h79l14,-106q31,-8 57.5,-23.5T639,633l99,41 39,-68 -86,-65q5,-14 7,-29.5t2,-31.5q0,-16 -2,-31.5t-7,-29.5l86,-65 -39,-68 -99,42q-22,-23 -48.5,-38.5T533,266l-13,-106h-79l-14,106q-31,8 -57.5,23.5T321,327l-99,-41 -39,68 86,64q-5,15 -7,30t-2,32q0,16 2,31t7,30l-86,65 39,68 99,-42q22,23 48.5,38.5T427,694l13,106ZM482,620q58,0 99,-41t41,-99q0,-58 -41,-99t-99,-41q-59,0 -99.5,41T342,480q0,58 40.5,99t99.5,41ZM480,480Z"
|
||||
android:fillColor="#e8eaed"/>
|
||||
</vector>
|
6
app/src/main/res/drawable/settings_icon_selector.xml
Normal file
6
app/src/main/res/drawable/settings_icon_selector.xml
Normal file
|
@ -0,0 +1,6 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:drawable="@drawable/settings_icon_filled" android:state_checked="true"/>
|
||||
<item android:drawable="@drawable/settings_icon_filled" android:state_focused="true"/>
|
||||
<item android:drawable="@drawable/settings_icon_outline"/>
|
||||
</selector>
|
|
@ -14,20 +14,21 @@
|
|||
|
||||
<com.google.android.material.navigationrail.NavigationRailView
|
||||
android:id="@+id/nav_rail_view"
|
||||
android:layout_width="@dimen/navbar_width"
|
||||
android:layout_width="62dp"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryGrayBackground"
|
||||
app:itemIconTint="@color/item_select_color"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
|
||||
app:itemIconTint="@color/item_select_color"
|
||||
app:itemTextColor="@color/item_select_color"
|
||||
app:headerLayout="@layout/rail_header"
|
||||
app:labelVisibilityMode="unlabeled"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:menu="@menu/bottom_nav_menu"
|
||||
app:menuGravity="center">
|
||||
|
||||
<include layout="@layout/rail_footer"/>
|
||||
|
||||
</com.google.android.material.navigationrail.NavigationRailView>
|
||||
<!-- android:layout_height="65dp"
|
||||
app:labelVisibilityMode="unlabeled"
|
||||
|
|
|
@ -26,19 +26,20 @@
|
|||
<com.google.android.material.navigationrail.NavigationRailView
|
||||
android:id="@+id/nav_rail_view"
|
||||
android:layout_width="62dp"
|
||||
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/primaryGrayBackground"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
app:itemIconTint="@color/item_select_color"
|
||||
app:itemTextColor="@color/item_select_color"
|
||||
|
||||
android:background="?attr/primaryGrayBackground"
|
||||
android:descendantFocusability="afterDescendants"
|
||||
app:headerLayout="@layout/rail_header"
|
||||
app:labelVisibilityMode="unlabeled"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:menu="@menu/bottom_nav_menu"
|
||||
app:menuGravity="center">
|
||||
|
||||
<include layout="@layout/rail_footer"/>
|
||||
|
||||
</com.google.android.material.navigationrail.NavigationRailView>
|
||||
|
||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||
|
|
|
@ -44,9 +44,11 @@
|
|||
android:layout_marginEnd="0dp"
|
||||
android:background="@drawable/player_button_tv_attr_no_bg"
|
||||
android:gravity="center_vertical"
|
||||
android:nextFocusLeft="@id/nav_rail_view"
|
||||
android:nextFocusLeft="@id/home_preview_play_btt"
|
||||
android:nextFocusRight="@id/home_preview_search_button"
|
||||
android:nextFocusDown="@id/home_preview_play_btt" />
|
||||
android:nextFocusDown="@id/home_preview_play_btt" >
|
||||
<requestFocus />
|
||||
</com.google.android.material.button.MaterialButton>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_preview_search_button"
|
||||
|
@ -65,6 +67,7 @@
|
|||
app:tint="@color/player_on_button_tv_attr" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/home_preview_switch_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
|
|
@ -114,7 +114,9 @@
|
|||
android:gravity="center_vertical"
|
||||
android:nextFocusLeft="@id/nav_rail_view"
|
||||
android:nextFocusRight="@id/home_preview_search_button"
|
||||
android:nextFocusDown="@id/home_preview_play_btt" />
|
||||
android:nextFocusDown="@id/home_preview_play_btt" >
|
||||
<requestFocus />
|
||||
</com.google.android.material.button.MaterialButton>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/home_preview_search_button"
|
||||
|
@ -134,6 +136,7 @@
|
|||
app:tint="@color/player_on_button_tv_attr" />
|
||||
|
||||
<ImageView
|
||||
android:visibility="gone"
|
||||
android:id="@+id/home_switch_account"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
|
|
31
app/src/main/res/layout/rail_footer.xml
Normal file
31
app/src/main/res/layout/rail_footer.xml
Normal file
|
@ -0,0 +1,31 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/nav_footer_root"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="1dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_gravity="bottom|center_horizontal"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
android:id="@+id/nav_footer_profile_card"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:background="@color/transparent"
|
||||
app:cardCornerRadius="20dp"
|
||||
android:focusable="true"
|
||||
android:foreground="@drawable/outline_drawable_round_20">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nav_footer_profile_pic"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/profile_bg_orange"
|
||||
android:contentDescription="@string/account"/>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
|
||||
</LinearLayout>
|
21
app/src/main/res/layout/rail_header.xml
Normal file
21
app/src/main/res/layout/rail_header.xml
Normal file
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="1dp"
|
||||
android:visibility="gone"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/nav_header_notification"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
app:itemIconTint="@color/item_select_color"
|
||||
android:focusable="true"
|
||||
android:nextFocusRight="@id/home_preview_play_btt"
|
||||
android:src="@drawable/notifications_icon_selector"
|
||||
android:contentDescription="@string/account"
|
||||
app:tint="@color/item_select_color" />
|
||||
|
||||
</LinearLayout>
|
|
@ -1,23 +1,23 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/home_alt"
|
||||
android:title="@string/title_home" />
|
||||
<item
|
||||
android:id="@+id/navigation_search"
|
||||
android:icon="@drawable/search_icon"
|
||||
android:title="@string/title_search" />
|
||||
<item
|
||||
android:id="@+id/navigation_library"
|
||||
android:icon="@drawable/library_icon"
|
||||
android:title="@string/library" />
|
||||
<item
|
||||
android:id="@+id/navigation_downloads"
|
||||
android:icon="@drawable/netflix_download"
|
||||
android:title="@string/title_downloads" />
|
||||
<item
|
||||
android:id="@+id/navigation_settings"
|
||||
android:icon="@drawable/ic_outline_settings_24"
|
||||
android:title="@string/title_settings" />
|
||||
<item
|
||||
android:id="@+id/navigation_home"
|
||||
android:icon="@drawable/home_icon_selector"
|
||||
android:title="@string/title_home" />
|
||||
<item
|
||||
android:id="@+id/navigation_search"
|
||||
android:icon="@drawable/search_icon"
|
||||
android:title="@string/title_search" />
|
||||
<item
|
||||
android:id="@+id/navigation_library"
|
||||
android:icon="@drawable/library_icon_selector"
|
||||
android:title="@string/library" />
|
||||
<item
|
||||
android:id="@+id/navigation_downloads"
|
||||
android:icon="@drawable/netflix_download"
|
||||
android:title="@string/title_downloads" />
|
||||
<item
|
||||
android:id="@+id/navigation_settings"
|
||||
android:icon="@drawable/settings_icon_selector"
|
||||
android:title="@string/title_settings" />
|
||||
</menu>
|
|
@ -89,4 +89,5 @@
|
|||
<color name="colorTestPass">#48E484</color>
|
||||
<color name="colorTestFail">#ea596e</color>
|
||||
<color name="colorTestWarning">#FF9800</color>
|
||||
<color name="whiteSmoke">#F5F5F5</color>
|
||||
</resources>
|
Loading…
Reference in a new issue