forked from PeterCxy/OpenEUICC
Rework theme to better fit with Material 3 design
Change-Id: I93f6bab814d15a3d08f2ef48fe10031aecfb0a3b
This commit is contained in:
parent
ca08043931
commit
8e31594eb7
|
@ -3,10 +3,18 @@ package im.angry.openeuicc
|
|||
import android.app.Application
|
||||
import android.telephony.SubscriptionManager
|
||||
import android.telephony.TelephonyManager
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import im.angry.openeuicc.core.EuiccChannelManager
|
||||
import im.angry.openeuicc.util.PreferenceRepository
|
||||
|
||||
open class OpenEuiccApplication : Application() {
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
// Observe dynamic colors changes
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
}
|
||||
|
||||
val telephonyManager by lazy {
|
||||
getSystemService(TelephonyManager::class.java)!!
|
||||
}
|
||||
|
|
|
@ -32,7 +32,7 @@ class ProfileDeleteFragment : DialogFragment(), EuiccFragmentMarker {
|
|||
private var deleting = false
|
||||
|
||||
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
|
||||
return AlertDialog.Builder(requireContext()).apply {
|
||||
return AlertDialog.Builder(requireContext(), R.style.AlertDialogTheme).apply {
|
||||
setMessage(getString(R.string.profile_delete_confirm, requireArguments().getString("name")))
|
||||
setPositiveButton(android.R.string.ok, null) // Set listener to null to prevent auto closing
|
||||
setNegativeButton(android.R.string.cancel, null)
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.cardview.widget.CardView
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginHorizontal="12dp"
|
||||
|
@ -103,6 +103,6 @@
|
|||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.cardview.widget.CardView>
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</FrameLayout>
|
|
@ -4,12 +4,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/Theme.OpenEUICC"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="4dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
|
|
@ -4,12 +4,11 @@
|
|||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/Theme.OpenEUICC"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="4dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
|
|
@ -5,7 +5,6 @@
|
|||
android:id="@+id/spinner"
|
||||
android:title=""
|
||||
app:actionViewClass="android.widget.Spinner"
|
||||
android:background="?android:attr/colorPrimary"
|
||||
app:showAsAction="always" />
|
||||
|
||||
<item
|
||||
|
|
|
@ -1,11 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="gray_300">#E0E0E0</color>
|
||||
<color name="pink_600">#D81B60</color>
|
||||
<color name="pink_800">#AD1457</color>
|
||||
<color name="black">#FF000000</color>
|
||||
<color name="white">#FFFFFFFF</color>
|
||||
|
||||
<color name="brand">@color/pink_600</color>
|
||||
<color name="brandSecondary">@color/pink_800</color>
|
||||
</resources>
|
|
@ -1,46 +1,38 @@
|
|||
<resources xmlns:tools="http://schemas.android.com/tools">
|
||||
<!-- Base application theme. -->
|
||||
<style name="Theme.OpenEUICC" parent="Theme.MaterialComponents.DayNight">
|
||||
<!-- Primary brand color. -->
|
||||
<item name="colorPrimary">@color/white</item>
|
||||
<item name="colorPrimaryVariant">@color/gray_300</item>
|
||||
<item name="colorOnPrimary">@color/black</item>
|
||||
<!-- Secondary brand color. -->
|
||||
<item name="colorSecondary">@color/brand</item>
|
||||
<item name="colorSecondaryVariant">@color/brandSecondary</item>
|
||||
<item name="colorOnSecondary">@color/white</item>
|
||||
<item name="colorAccent">?attr/colorSecondary</item>
|
||||
<style name="Theme.OpenEUICC" parent="Theme.Material3.DayNight">
|
||||
<!-- Status bar color. -->
|
||||
<item name="android:statusBarColor">?attr/colorPrimary</item>
|
||||
<item name="android:windowLightStatusBar">true</item>
|
||||
<item name="android:statusBarColor">?android:attr/colorBackground</item>
|
||||
<item name="android:windowLightStatusBar">?attr/isLightTheme</item>
|
||||
<!-- Customize your theme here. -->
|
||||
<item name="alertDialogTheme">@style/AlertDialogTheme</item>
|
||||
<item name="android:navigationBarColor">?attr/colorSecondary</item>
|
||||
<item name="android:navigationBarColor">@android:color/transparent</item>
|
||||
<item name="android:windowLightNavigationBar">?attr/isLightTheme</item>
|
||||
<item name="dialogCornerRadius">28dp</item>
|
||||
<item name="toolbarStyle">@style/Widget.Material3.Toolbar.Surface</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.OpenEUICC.Input.Cursor" parent="ThemeOverlay.MaterialComponents.TextInputEditText.OutlinedBox">
|
||||
<style name="Theme.OpenEUICC.Input.Cursor" parent="ThemeOverlay.Material3.TextInputEditText.OutlinedBox">
|
||||
<item name="colorControlActivated">?attr/colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="Widget.OpenEUICC.Input" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox">
|
||||
<style name="Widget.OpenEUICC.Input" parent="Widget.Material3.TextInputLayout.OutlinedBox">
|
||||
<item name="boxBackgroundColor">@android:color/transparent</item>
|
||||
<item name="boxStrokeColor">?attr/colorSecondary</item>
|
||||
<item name="hintTextColor">?attr/colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="AlertDialogTheme" parent="ThemeOverlay.MaterialComponents.Dialog.Alert">
|
||||
<style name="AlertDialogTheme" parent="ThemeOverlay.Material3.Dialog.Alert">
|
||||
<item name="buttonBarNegativeButtonStyle">@style/NegativeButtonStyle</item>
|
||||
<item name="buttonBarPositiveButtonStyle">@style/PositiveButtonStyle</item>
|
||||
<item name="dialogCornerRadius">28dp</item>
|
||||
</style>
|
||||
|
||||
<style name="NegativeButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
|
||||
<style name="NegativeButtonStyle" parent="Widget.Material3.Button.TextButton.Dialog">
|
||||
<item name="android:textColor">?attr/colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="PositiveButtonStyle" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
|
||||
<style name="PositiveButtonStyle" parent="Widget.Material3.Button.TextButton.Dialog">
|
||||
<item name="android:textColor">?attr/colorSecondary</item>
|
||||
</style>
|
||||
|
||||
|
||||
|
||||
</resources>
|
|
@ -1,8 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<color name="purple_500">#9C27B0</color>
|
||||
<color name="purple_700">#7B1FA2</color>
|
||||
|
||||
<color name="brand">@color/purple_500</color>
|
||||
<color name="brandSecondary">@color/purple_700</color>
|
||||
</resources>
|
|
@ -1,5 +1,6 @@
|
|||
package im.angry.openeuicc
|
||||
|
||||
import com.google.android.material.color.DynamicColors
|
||||
import im.angry.openeuicc.core.EuiccChannelManager
|
||||
import im.angry.openeuicc.core.PrivilegedEuiccChannelManager
|
||||
|
||||
|
@ -10,6 +11,10 @@ class PrivilegedOpenEuiccApplication: OpenEuiccApplication() {
|
|||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
|
||||
// Observe dynamic colors changes
|
||||
DynamicColors.applyToActivitiesIfAvailable(this)
|
||||
|
||||
(euiccChannelManager as PrivilegedEuiccChannelManager).closeAllStaleChannels()
|
||||
}
|
||||
}
|
|
@ -4,12 +4,11 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.Toolbar
|
||||
<com.google.android.material.appbar.MaterialToolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:theme="@style/Theme.OpenEUICC"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:elevation="4dp"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
@ -35,7 +34,6 @@
|
|||
android:layout_marginHorizontal="24dp"
|
||||
android:gravity="center"
|
||||
android:textSize="12sp"
|
||||
android:textColor="?attr/colorSecondary"
|
||||
android:textStyle="italic"
|
||||
app:layout_constraintTop_toBottomOf="@id/mapping_list"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
|
Loading…
Reference in a new issue