MainActivity: Add view binding type hint for navigation bar
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -41,7 +41,6 @@ import com.aurora.store.util.AppUtil
|
|||||||
import com.aurora.store.util.Preferences
|
import com.aurora.store.util.Preferences
|
||||||
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
import com.aurora.store.util.Preferences.PREFERENCE_DEFAULT_SELECTED_TAB
|
||||||
import com.aurora.store.view.ui.sheets.NetworkDialogSheet
|
import com.aurora.store.view.ui.sheets.NetworkDialogSheet
|
||||||
import com.google.android.material.navigation.NavigationBarView
|
|
||||||
import dagger.hilt.android.AndroidEntryPoint
|
import dagger.hilt.android.AndroidEntryPoint
|
||||||
import kotlinx.coroutines.flow.collectLatest
|
import kotlinx.coroutines.flow.collectLatest
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
@@ -100,7 +99,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
(B.navView as NavigationBarView).apply {
|
B.navView.apply {
|
||||||
val alphaColor = ColorUtils.setAlphaComponent(this@MainActivity.accentColor(), 100)
|
val alphaColor = ColorUtils.setAlphaComponent(this@MainActivity.accentColor(), 100)
|
||||||
setupWithNavController(navController)
|
setupWithNavController(navController)
|
||||||
itemActiveIndicatorColor = ColorStateList.valueOf(alphaColor)
|
itemActiveIndicatorColor = ColorStateList.valueOf(alphaColor)
|
||||||
@@ -150,7 +149,7 @@ class MainActivity : AppCompatActivity() {
|
|||||||
|
|
||||||
lifecycleScope.launch {
|
lifecycleScope.launch {
|
||||||
appUtil.updates.collectLatest { list ->
|
appUtil.updates.collectLatest { list ->
|
||||||
(B.navView as NavigationBarView).getOrCreateBadge(R.id.updatesFragment).apply {
|
B.navView.getOrCreateBadge(R.id.updatesFragment).apply {
|
||||||
isVisible = !list.isNullOrEmpty()
|
isVisible = !list.isNullOrEmpty()
|
||||||
number = list?.size ?: 0
|
number = list?.size ?: 0
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,7 +2,8 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
@@ -26,5 +27,6 @@
|
|||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"
|
||||||
app:menu="@menu/menu_bottom_nav"
|
app:menu="@menu/menu_bottom_nav"
|
||||||
app:menuGravity="center" />
|
app:menuGravity="center"
|
||||||
|
tools:viewBindingType="com.google.android.material.navigation.NavigationBarView" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
@@ -21,7 +21,8 @@
|
|||||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<androidx.constraintlayout.widget.ConstraintLayout 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"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent">
|
android:layout_height="match_parent"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools">
|
||||||
|
|
||||||
<androidx.fragment.app.FragmentContainerView
|
<androidx.fragment.app.FragmentContainerView
|
||||||
android:id="@+id/nav_host_fragment"
|
android:id="@+id/nav_host_fragment"
|
||||||
@@ -43,5 +44,6 @@
|
|||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:menu="@menu/menu_bottom_nav" />
|
app:menu="@menu/menu_bottom_nav"
|
||||||
|
tools:viewBindingType="com.google.android.material.navigation.NavigationBarView" />
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|||||||
Reference in New Issue
Block a user