bit of material3

This commit is contained in:
LagradOst 2022-04-18 20:24:29 +02:00
parent 9fb4b74b79
commit 96c074e87b
6 changed files with 30 additions and 15 deletions

View file

@ -533,10 +533,10 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
.setPopUpTo(navController.graph.startDestination, false) .setPopUpTo(navController.graph.startDestination, false)
.build()*/ .build()*/
nav_view?.setupWithNavController(navController) nav_view?.setupWithNavController(navController)
val navRail = findViewById<NavigationRailView?>(R.id.nav_rail_view) val nav_rail = findViewById<NavigationRailView?>(R.id.nav_rail_view)
navRail?.setupWithNavController(navController) nav_rail?.setupWithNavController(navController)
navRail?.setOnItemSelectedListener { item -> nav_rail?.setOnItemSelectedListener { item ->
onNavDestinationSelected( onNavDestinationSelected(
item, item,
navController navController
@ -574,7 +574,9 @@ class MainActivity : AppCompatActivity(), ColorPickerDialogListener {
val rippleColor = ColorStateList.valueOf(getResourceColor(R.attr.colorPrimary, 0.1f)) val rippleColor = ColorStateList.valueOf(getResourceColor(R.attr.colorPrimary, 0.1f))
nav_view?.itemRippleColor = rippleColor nav_view?.itemRippleColor = rippleColor
navRail?.itemRippleColor = rippleColor nav_rail?.itemRippleColor = rippleColor
nav_rail?.itemActiveIndicatorColor = rippleColor
nav_view?.itemActiveIndicatorColor = rippleColor
if (!checkWrite()) { if (!checkWrite()) {
requestRW() requestRW()

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import android.content.Context import android.content.Context
import android.util.AttributeSet import android.util.AttributeSet
import android.view.ViewGroup import android.view.ViewGroup
import androidx.core.view.marginEnd
import com.lagradost.cloudstream3.R import com.lagradost.cloudstream3.R
import kotlin.math.max import kotlin.math.max
@ -36,7 +37,7 @@ class FlowLayout : ViewGroup {
val childHeight = child.measuredHeight val childHeight = child.measuredHeight
//check if child can be placed in the current row, else go to next line //check if child can be placed in the current row, else go to next line
if (currentChildHookPointx + childWidth > realWidth && i + 1 < childCount) { if (currentChildHookPointx + childWidth - child.marginEnd - child.paddingEnd - itemSpacing > realWidth) {
//new line //new line
currentWidth = max(currentWidth, currentChildHookPointx) currentWidth = max(currentWidth, currentChildHookPointx)

View file

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportHeight="24" android:viewportWidth="24" android:height="24dp"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:tint="?attr/white"
<path android:fillColor="?white" android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8,9h8v10L8,19L8,9zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z"/> android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="?white"
android:pathData="M6,19c0,1.1 0.9,2 2,2h8c1.1,0 2,-0.9 2,-2L18,7L6,7v12zM8,9h8v10L8,19L8,9zM15.5,4l-1,-1h-5l-1,1L5,4v2h14L19,4z" />
</vector> </vector>

View file

@ -1,5 +1,10 @@
<vector android:height="24dp" android:tint="#FFFFFF" <vector xmlns:android="http://schemas.android.com/apk/res/android"
android:viewportHeight="24" android:viewportWidth="24" android:height="24dp"
android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android"> android:tint="?attr/white"
<path android:fillColor="@android:color/white" android:pathData="M2,20h20v-4L2,16v4zM4,17h2v2L4,19v-2zM2,4v4h20L22,4L2,4zM6,7L4,7L4,5h2v2zM2,14h20v-4L2,10v4zM4,11h2v2L4,13v-2z"/> android:viewportHeight="24"
android:viewportWidth="24"
android:width="24dp">
<path
android:fillColor="@android:color/white"
android:pathData="M2,20h20v-4L2,16v4zM4,17h2v2L4,19v-2zM2,4v4h20L22,4L2,4zM6,7L4,7L4,5h2v2zM2,14h20v-4L2,10v4zM4,11h2v2L4,13v-2z" />
</vector> </vector>

View file

@ -18,6 +18,7 @@
android:id="@+id/nav_rail_view" android:id="@+id/nav_rail_view"
android:background="?attr/primaryGrayBackground" android:background="?attr/primaryGrayBackground"
app:itemTextColor="@color/item_select_color" app:itemTextColor="@color/item_select_color"
app:itemIconTint="@color/item_select_color" app:itemIconTint="@color/item_select_color"
app:menuGravity="center" app:menuGravity="center"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"

View file

@ -1,6 +1,6 @@
<resources> <resources>
<!-- Base application theme. --> <!-- Base application theme. Material3 -->
<style name="AppTheme" parent="Theme.MaterialComponents.NoActionBar"> <style name="AppTheme" parent="Theme.Material3.Dark.NoActionBar">
<item name="android:windowBackground">@drawable/splash_background</item> <item name="android:windowBackground">@drawable/splash_background</item>
<item name="android:navigationBarColor">?attr/primaryBlackBackground</item> <item name="android:navigationBarColor">?attr/primaryBlackBackground</item>
<item name="android:colorEdgeEffect">?attr/textColor</item> <item name="android:colorEdgeEffect">?attr/textColor</item>
@ -404,6 +404,7 @@
<item name="android:paddingBottom">5dp</item> <item name="android:paddingBottom">5dp</item>
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
<item name="textColor">@color/textColor</item> <item name="textColor">@color/textColor</item>
<item name="android:textColor">@color/textColor</item>
<item name="android:layout_margin">2dp</item> <item name="android:layout_margin">2dp</item>
</style> </style>