mirror of
https://github.com/whyorean/AuroraStore.git
synced 2026-06-13 10:14:42 -04:00
Switch to Material3 theme
Signed-off-by: Aayush Gupta <aayushgupta219@gmail.com>
This commit is contained in:
@@ -35,11 +35,13 @@ import androidx.appcompat.app.AppCompatActivity
|
||||
import androidx.browser.customtabs.CustomTabsIntent
|
||||
import androidx.core.app.ActivityOptionsCompat
|
||||
import androidx.core.app.ShareCompat
|
||||
import androidx.core.content.ContextCompat
|
||||
import com.aurora.Constants
|
||||
import com.aurora.gplayapi.data.models.App
|
||||
import com.aurora.store.MainActivity
|
||||
import com.aurora.store.R
|
||||
import com.aurora.store.util.Log
|
||||
import com.aurora.store.util.Preferences
|
||||
import kotlin.system.exitProcess
|
||||
|
||||
val Context.inflater: LayoutInflater
|
||||
@@ -128,3 +130,24 @@ fun Context.getStyledAttributeColor(id: Int): Int {
|
||||
arr.recycle()
|
||||
return styledAttr
|
||||
}
|
||||
|
||||
fun Context.accentColor(): Int {
|
||||
val color = when (Preferences.getInteger(this, Preferences.PREFERENCE_THEME_ACCENT)) {
|
||||
0 -> R.color.colorAccent
|
||||
1 -> R.color.colorAccent01
|
||||
2 -> R.color.colorAccent02
|
||||
3 -> R.color.colorAccent03
|
||||
4 -> R.color.colorAccent04
|
||||
5 -> R.color.colorAccent05
|
||||
6 -> R.color.colorAccent06
|
||||
7 -> R.color.colorAccent07
|
||||
8 -> R.color.colorAccent08
|
||||
9 -> R.color.colorAccent09
|
||||
10 -> R.color.colorAccent10
|
||||
11 -> R.color.colorAccent11
|
||||
12 -> R.color.colorAccent12
|
||||
13 -> R.color.colorAccent13
|
||||
else -> if (isSAndAbove()) R.color.colorAccent else R.color.colorAccent01
|
||||
}
|
||||
return ContextCompat.getColor(this, color)
|
||||
}
|
||||
|
||||
@@ -22,6 +22,7 @@ package com.aurora.store
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.content.res.ColorStateList
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.os.Environment
|
||||
@@ -158,7 +159,11 @@ class MainActivity : BaseActivity() {
|
||||
bottomNavigationView.setupWithNavController(navController)
|
||||
|
||||
val backGroundColor = getStyledAttributeColor(android.R.attr.colorBackground)
|
||||
bottomNavigationView.setBackgroundColor(ColorUtils.setAlphaComponent(backGroundColor, 245))
|
||||
bottomNavigationView.apply {
|
||||
setBackgroundColor(ColorUtils.setAlphaComponent(backGroundColor, 245))
|
||||
val alphaColor = ColorUtils.setAlphaComponent(this@MainActivity.accentColor(), 100)
|
||||
itemActiveIndicatorColor = ColorStateList.valueOf(alphaColor)
|
||||
}
|
||||
|
||||
val defaultTab = Preferences.getInteger(this, Preferences.PREFERENCE_DEFAULT_SELECTED_TAB)
|
||||
val navigationList =
|
||||
|
||||
@@ -45,7 +45,7 @@ abstract class BaseBottomSheet : BottomSheetDialogFragment() {
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
val bottomSheetDialog = BottomSheetDialog(
|
||||
requireContext(),
|
||||
R.style.Aurora_BottomSheetDialog
|
||||
R.style.Theme_Material3_DayNight_BottomSheetDialog
|
||||
)
|
||||
|
||||
VM = SheetBaseBinding.inflate(layoutInflater)
|
||||
@@ -80,4 +80,4 @@ abstract class BaseBottomSheet : BottomSheetDialogFragment() {
|
||||
): View?
|
||||
|
||||
abstract fun onContentViewCreated(view: View, savedInstanceState: Bundle?)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<!--Common Colors-->
|
||||
<color name="colorAccent">@android:color/system_accent1_200</color>
|
||||
<color name="colorAccent">@android:color/system_accent1_400</color>
|
||||
</resources>
|
||||
|
||||
@@ -51,7 +51,7 @@
|
||||
<dimen name="screenshot_height_mini">120dp</dimen>
|
||||
<dimen name="screenshot_width_mini">68dp</dimen>
|
||||
|
||||
<dimen name="height_bottom_adj">64dp</dimen>
|
||||
<dimen name="height_bottom_adj">100dp</dimen>
|
||||
|
||||
<dimen name="cluster_size">128dp</dimen>
|
||||
<dimen name="elevation_small">3dp</dimen>
|
||||
@@ -63,4 +63,4 @@
|
||||
<dimen name="height_bottomsheet_button">52dp</dimen>
|
||||
<dimen name="height_peek">64dp</dimen>
|
||||
<dimen name="height_nav_header">148dp</dimen>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
@@ -19,7 +19,7 @@
|
||||
|
||||
<resources>
|
||||
|
||||
<style name="AppTheme" parent="Theme.MaterialComponents.DayNight.NoActionBar">
|
||||
<style name="AppTheme" parent="Theme.Material3.DayNight.NoActionBar">
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="colorPrimary">@color/colorAccent</item>
|
||||
<item name="colorPrimaryDark">?android:colorBackground</item>
|
||||
@@ -32,7 +32,7 @@
|
||||
<item name="chipStyle">@style/Widget.Aurora.Chip</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Light" parent="Theme.MaterialComponents.Light.NoActionBar">
|
||||
<style name="AppTheme.Light" parent="Theme.Material3.Light.NoActionBar">
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="colorPrimary">@color/colorAccent</item>
|
||||
<item name="colorPrimaryDark">@color/colorWhite</item>
|
||||
@@ -49,7 +49,7 @@
|
||||
<item name="chipStyle">@style/Widget.Aurora.Chip</item>
|
||||
</style>
|
||||
|
||||
<style name="AppTheme.Dark" parent="Theme.MaterialComponents.NoActionBar">
|
||||
<style name="AppTheme.Dark" parent="Theme.Material3.Dark.NoActionBar">
|
||||
<item name="colorAccent">@color/colorAccent</item>
|
||||
<item name="colorPrimary">@color/colorAccent</item>
|
||||
<item name="colorPrimaryDark">@color/colorDarkPrimaryDark</item>
|
||||
|
||||
@@ -64,15 +64,6 @@
|
||||
<item name="android:textAppearance">@style/TextAppearance.Aurora.Chip</item>
|
||||
</style>
|
||||
|
||||
<style name="Aurora.BottomSheetDialogStyle" parent="Widget.Design.BottomSheet.Modal">
|
||||
<item name="android:background">@android:color/transparent</item>
|
||||
<item name="android:padding">@dimen/padding_small</item>
|
||||
</style>
|
||||
|
||||
<style name="Aurora.BottomSheetDialog" parent="Theme.Design.BottomSheetDialog">
|
||||
<item name="bottomSheetStyle">@style/Aurora.BottomSheetDialogStyle</item>
|
||||
</style>
|
||||
|
||||
<style name="AuroraProgressView">
|
||||
<item name="minWidth">32dp</item>
|
||||
<item name="maxWidth">46dp</item>
|
||||
@@ -96,4 +87,4 @@
|
||||
<item name="maxHeight">24dp</item>
|
||||
<item name="indicatorName">BallPulseIndicator</item>
|
||||
</style>
|
||||
</resources>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user