Skip to content

Commit

Permalink
[Refactor] Tint spinners in primary container color to match Android …
Browse files Browse the repository at this point in the history
…12+ style

Signed-off-by: Muntashir Al-Islam <[email protected]>
  • Loading branch information
MuntashirAkon committed Mar 31, 2024
1 parent 89ddad7 commit 3e042d0
Show file tree
Hide file tree
Showing 9 changed files with 58 additions and 21 deletions.
11 changes: 7 additions & 4 deletions app/src/main/res/layout/activity_sys_config.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@
app:layout_behavior="com.google.android.material.appbar.AppBarLayout$ScrollingViewBehavior">

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined.Small"
style="@style/Widget.AppTheme.MaterialSpinner.Spinner.Small"
android:id="@+id/spinner"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/padding_large"
android:nextFocusDown="@id/recycler_view" />
android:minWidth="100dp"
android:layout_gravity="start|center_vertical"
android:layout_marginVertical="@dimen/padding_small"
android:layout_marginHorizontal="@dimen/padding_large"
android:nextFocusDown="@id/recycler_view"
tools:hint="permissions" />

<FrameLayout
android:layout_width="match_parent"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_certificate_generator.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
android:paddingEnd="@dimen/padding_medium">

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined"
style="@style/Widget.AppTheme.MaterialSpinner"
android:id="@+id/key_size_selector_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_edit_filter_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,14 @@
android:paddingVertical="@dimen/padding_small">

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined"
style="@style/Widget.AppTheme.MaterialSpinner"
android:id="@+id/filter_selector_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="@string/select_filter" />

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined"
style="@style/Widget.AppTheme.MaterialSpinner"
android:id="@+id/type_selector_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_edit_pref_item.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:paddingVertical="@dimen/padding_small">

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined"
style="@style/Widget.AppTheme.MaterialSpinner"
android:id="@+id/type_selector_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/dialog_installer_options.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@

<io.github.muntashirakon.widget.MaterialSpinner
android:id="@+id/user"
style="@style/Widget.AppTheme.MaterialSpinner.Outlined.Small"
style="@style/Widget.AppTheme.MaterialSpinner.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
android:hint="@string/select_user" />

<io.github.muntashirakon.widget.MaterialSpinner
android:id="@+id/install_location"
style="@style/Widget.AppTheme.MaterialSpinner.Outlined.Small"
style="@style/Widget.AppTheme.MaterialSpinner.Small"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="8dp"
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/res/layout/dialog_key_pair_importer.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
android:paddingEnd="@dimen/padding_medium">

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined"
style="@style/Widget.AppTheme.MaterialSpinner"
android:id="@+id/key_type_selector_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content"
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/layout/dialog_new_file.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:paddingTop="@dimen/padding_small"
android:paddingBottom="@dimen/padding_small"
android:paddingStart="@dimen/padding_medium"
Expand All @@ -27,6 +28,7 @@
style="@style/Widget.AppTheme.MaterialSpinner"
android:id="@+id/type_selector_spinner"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
android:layout_height="wrap_content"
app:boxStrokeWidth="0dp" />

</androidx.appcompat.widget.LinearLayoutCompat>
12 changes: 7 additions & 5 deletions app/src/main/res/layout/item_app_usage_header.xml
Original file line number Diff line number Diff line change
@@ -1,18 +1,20 @@
<!-- SPDX-License-Identifier: GPL-3.0-or-later -->
<androidx.appcompat.widget.LinearLayoutCompat xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical">

<io.github.muntashirakon.widget.MaterialSpinner
style="@style/Widget.AppTheme.MaterialSpinner.Outlined.Small"
style="@style/Widget.AppTheme.MaterialSpinner.Spinner.Small"
android:id="@+id/spinner"
android:layout_width="130dp"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_margin="@dimen/padding_large"
android:nextFocusDown="@id/recycler_view" />
android:layout_gravity="center_vertical|start"
android:layout_marginVertical="@dimen/padding_small"
android:layout_marginHorizontal="@dimen/padding_large"
android:nextFocusDown="@id/recycler_view"
tools:hint="Interval" />

<com.google.android.material.textview.MaterialTextView
android:id="@+id/screen_time"
Expand Down
38 changes: 34 additions & 4 deletions libcore/ui/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -115,17 +115,43 @@
</style>

<!-- MaterialSpinner -->
<style name="Widget.AppTheme.MaterialSpinner" parent="Widget.AppTheme.TextInputLayout.ExposedDropdownMenu">
<style name="Widget.AppTheme.MaterialSpinner" parent="Widget.AppTheme.TextInputLayout.ExposedDropdownMenu" />

<style name="Widget.AppTheme.MaterialSpinner.Small" parent="Widget.AppTheme.TextInputLayout.ExposedDropdownMenu.Small" />

<style name="Widget.AppTheme.MaterialSpinner.Spinner" parent="Widget.AppTheme.MaterialSpinner">
<item name="boxStrokeWidth">0dp</item>
<item name="boxBackgroundColor">?attr/colorPrimaryContainer</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.AppTheme.MaterialSpinner</item>
</style>

<style name="Widget.AppTheme.MaterialSpinner.Small" parent="Widget.AppTheme.TextInputLayout.ExposedDropdownMenu.Small">
<style name="Widget.AppTheme.MaterialSpinner.Spinner.Small" parent="Widget.AppTheme.MaterialSpinner.Small">
<item name="boxStrokeWidth">0dp</item>
<item name="boxBackgroundColor">?attr/colorPrimaryContainer</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.AppTheme.MaterialSpinner.Small</item>
</style>

<style name="ThemeOverlay.AppTheme.MaterialSpinner" parent="">
<item name="autoCompleteTextViewStyle">@style/Widget.AppTheme.MaterialSpinner.AutoCompleteTextView</item>
</style>

<style name="Widget.AppTheme.MaterialSpinner.Outlined" parent="Widget.AppTheme.TextInputLayout.ExposedDropdownMenu" />
<style name="ThemeOverlay.AppTheme.MaterialSpinner.Small" parent="">
<item name="autoCompleteTextViewStyle">@style/Widget.AppTheme.MaterialSpinner.AutoCompleteTextView.Small</item>
<item name="endIconMinSize">18dp</item> <!-- 34 - 8*2 -->
</style>

<style name="Widget.AppTheme.MaterialSpinner.AutoCompleteTextView" parent="Widget.Material3.AutoCompleteTextView.OutlinedBox.Dense">
<item name="simpleItemLayout">@layout/auto_complete_dropdown_item</item>
<item name="android:dropDownSelector">?attr/listChoiceBackgroundIndicator</item>
</style>

<style name="Widget.AppTheme.MaterialSpinner.Outlined.Small" parent="Widget.AppTheme.TextInputLayout.ExposedDropdownMenu.Small" />
<style name="Widget.AppTheme.MaterialSpinner.AutoCompleteTextView.Small" parent="Widget.AppTheme.AutoCompleteTextView">
<item name="android:paddingStart">12dp</item>
<item name="android:paddingEnd">12dp</item>
<item name="android:paddingTop">8dp</item>
<item name="android:paddingBottom">8dp</item>
<item name="android:minHeight">34dp</item>
</style>

<!-- MaterialAlertDialog -->
<style name="MaterialAlertDialog.Material3.Body.Text.Large" parent="MaterialAlertDialog.Material3.Body.Text">
Expand Down Expand Up @@ -322,9 +348,13 @@

<!-- ProgressIndicator -->
<style name="Widget.AppTheme.LinearProgressIndicator" parent="Widget.Material3.LinearProgressIndicator" />

<style name="Widget.AppTheme.CircularProgressIndicator" parent="Widget.Material3.CircularProgressIndicator" />

<style name="Widget.AppTheme.CircularProgressIndicator.Medium" parent="Widget.Material3.CircularProgressIndicator.Medium" />

<style name="Widget.AppTheme.CircularProgressIndicator.Small" parent="Widget.Material3.CircularProgressIndicator.Small" />

<style name="Widget.AppTheme.CircularProgressIndicator.ExtraSmall" parent="Widget.Material3.CircularProgressIndicator.ExtraSmall" />

<!-- SwipeRefreshLayout -->
Expand Down

0 comments on commit 3e042d0

Please sign in to comment.