Skip to content

Commit

Permalink
refactor: Follow the specified guidelines for styles_new.xml
Browse files Browse the repository at this point in the history
  • Loading branch information
aikrq committed Oct 20, 2024
1 parent eaef5c9 commit 40e60ab
Show file tree
Hide file tree
Showing 7 changed files with 52 additions and 85 deletions.
1 change: 0 additions & 1 deletion app/src/main/res/layout/activity_about_app.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/toolbar">
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/design.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@

<com.google.android.material.tabs.TabLayout
android:id="@+id/tab_layout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/dialog_keystore_credentials.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_signing_mode"
style="@style/TextDropDownLayoutStyle"
style="?attr/textInputOutlinedExposedDropdownMenuStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">

Expand All @@ -26,7 +26,6 @@

</com.google.android.material.textfield.TextInputLayout>


<com.google.android.material.textfield.TextInputLayout
android:id="@+id/til_alias"
android:layout_width="match_parent"
Expand Down
1 change: 0 additions & 1 deletion app/src/main/res/layout/main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@

<com.google.android.material.tabs.TabLayout
android:id="@+id/tabLayout"
style="@style/TabLayoutStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

Expand Down
3 changes: 1 addition & 2 deletions app/src/main/res/layout/property_popup_input_text.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,14 @@

<com.google.android.material.textfield.TextInputLayout
android:id="@+id/ti_auto_complete_input"
style="@style/TextDropDownLayoutStyle"
style="?attr/textInputOutlinedExposedDropdownMenuStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:visibility="gone"
tools:visibility="visible">

<com.google.android.material.textfield.MaterialAutoCompleteTextView
android:id="@+id/ed_ti_auto_complete_input"
style="@style/TextInputEditTextStyle"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:singleLine="true"
Expand Down
116 changes: 43 additions & 73 deletions app/src/main/res/values/styles_new.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,15 @@
— 'SketchwarePro' - remains unchanged, as the name of the app speaks for itself.
— '*' - instead of using the asterisk (*), replace it with the specific name of the component whose style is being modified or created.
-->
<eat-comment />

<!-- Widgets -->
<style name="Widget.SketchwarePro.CollapsingToolbar" parent="Widget.Material3.CollapsingToolbar.Large">
<item name="collapsedTitleTextAppearance">
@style/TextAppearance.SketchwarePro.CollapsingToolbar.Collapsed
</item>
<item name="expandedTitleTextAppearance">
@style/TextAppearance.SketchwarePro.CollapsingToolbar.Expanded
</item>
<item name="collapsedTitleTextAppearance">@style/TextAppearance.SketchwarePro.CollapsingToolbar.Collapsed</item>
<item name="expandedTitleTextAppearance">@style/TextAppearance.SketchwarePro.CollapsingToolbar.Expanded</item>
<item name="titleCollapseMode">scale</item>
</style>

<style name="TextAppearance.SketchwarePro.CollapsingToolbar.Collapsed" parent="TextAppearance.Material3.TitleLarge">
<item name="fontFamily">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
</style>

<style name="TextAppearance.SketchwarePro.CollapsingToolbar.Expanded" parent="TextAppearance.Material3.HeadlineMedium">
<item name="fontFamily">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
</style>

<style name="Widget.SketchwarePro.Toolbar.SmallText" parent="Widget.Material3.Toolbar">
<item name="titleTextAppearance">?attr/textAppearanceBodyLarge</item>
<item name="subtitleTextAppearance">?attr/textAppearanceBodyMedium</item>
</style>

<style name="Widget.SketchwarePro.NavigationView.Main" parent="Widget.Material3.NavigationView">
<item name="dividerInsetEnd">@dimen/main_drawer_horizontal_padding</item>
<item name="dividerInsetStart">@dimen/main_drawer_horizontal_padding</item>
Expand All @@ -47,80 +30,67 @@
<item name="subheaderInsetStart">@dimen/main_drawer_horizontal_padding</item>
</style>

<style name="Widget.SketchwarePro.TextInputLayout" parent="Widget.Material3.TextInputLayout.OutlinedBox">
<item name="hintEnabled">true</item>
<item name="shapeAppearanceOverlay">
@style/ShapeAppearanceOverlay.SketchwarePro.TextInputLayout
</item>
<item name="android:bottomLeftRadius">14dp</item>
<item name="android:bottomRightRadius">14dp</item>
<item name="android:topLeftRadius">14dp</item>
<item name="android:topRightRadius">14dp</item>
<style name="Widget.SketchwarePro.Preference.SwitchPreferenceCompat" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_widget_layout_m3_switch</item>
</style>

<style name="ShapeAppearanceOverlay.SketchwarePro.TextInputLayout" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">14dp</item>
<style name="Widget.SketchwarePro.TabLayout" parent="Widget.Material3.TabLayout">
<item name="tabTextAppearance">@style/TextAppearance.SketchwarePro.TabLayout</item>
</style>

<style name="ThemeOverlay.SketchwarePro.ViewEditor" parent="Base.Theme.MaterialComponents.Light" />

<style name="Preference.SketchwarePro.SwitchPreferenceCompat" parent="@style/Preference.SwitchPreferenceCompat.Material">
<item name="widgetLayout">@layout/preference_widget_layout_m3_switch</item>
<style name="Widget.SketchwarePro.TextInputEditText" parent="Widget.Material3.TextInputEditText.OutlinedBox">
<item name="android:gravity">center_vertical</item>
<item name="android:imeOptions">actionNext</item>
<item name="android:padding">8dp</item>
<item name="android:textSize">14sp</item>
</style>

<!-- TabLayout style -->
<style name="TabLayoutStyle" parent="Base.Widget.Design.TabLayout">
<item name="tabTextAppearance">@style/MyTabTextAppearance</item>
<item name="tabIndicatorColor">?attr/colorPrimary</item>
<item name="tabIndicator">@drawable/view_tab_indicator</item>
<item name="tabIndicatorAnimationMode">elastic</item>
<item name="tabSelectedTextColor">?attr/colorPrimary</item>
<item name="font">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
<style name="Widget.SketchwarePro.TextInputLayout" parent="Widget.Material3.TextInputLayout.OutlinedBox">
<item name="hintEnabled">true</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.SketchwarePro.TextInputEditText</item>
<item name="shapeAppearanceOverlay">@style/ShapeAppearanceOverlay.SketchwarePro.TextInputLayout</item>
</style>

<style name="Widget.SketchwarePro.TextInputLayout.ExposedDropdownMenu">
<item name="materialThemeOverlay">@style/ThemeOverlay.Material3.AutoCompleteTextView.OutlinedBox</item>
<item name="endIconMode">dropdown_menu</item>
</style>

<style name="MyTabTextAppearance" parent="TextAppearance.AppCompat.Button">
<item name="textAllCaps">false</item>
<style name="Widget.SketchwarePro.Toolbar.SmallText" parent="Widget.Material3.Toolbar">
<item name="titleTextAppearance">?attr/textAppearanceBodyLarge</item>
<item name="subtitleTextAppearance">?attr/textAppearanceBodyMedium</item>
</style>
<!-- end TabLayout style -->

<style name="ThemeOverlay.SketchwarePro.BottomSheetDialog" parent="ThemeOverlay.Material3.BottomSheetDialog">
<item name="android:navigationBarColor">@android:color/transparent</item>
<!-- Text appearances -->
<style name="TextAppearance.SketchwarePro.CollapsingToolbar.Collapsed" parent="TextAppearance.Material3.TitleLarge">
<item name="fontFamily">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
</style>

<!-- AutoCompleteTextInputEditTextStyle -->
<style name="TextInputEditTextStyle" parent="Widget.MaterialComponents.TextInputEditText.OutlinedBox">
<item name="android:gravity">center_vertical</item>
<item name="android:imeOptions">actionNext</item>
<item name="android:padding">8dp</item>
<item name="android:textSize">14sp</item>
<style name="TextAppearance.SketchwarePro.CollapsingToolbar.Expanded" parent="TextAppearance.Material3.HeadlineMedium">
<item name="fontFamily">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
</style>

<style name="TextDropDownLayoutStyle" parent="Widget.MaterialComponents.TextInputLayout.OutlinedBox.ExposedDropdownMenu">
<item name="boxStrokeColor">@color/input_layout_selector</item>
<item name="errorTextAppearance">@style/error_appearance</item>
<item name="hintTextAppearance">@style/hint_appearance</item>
<item name="shapeAppearanceOverlay">
@style/ShapeAppearanceOverlay.SWPro.TextInputLayout.Rounded
</item>
<style name="TextAppearance.SketchwarePro.TabLayout" parent="TextAppearance.Material3.TitleSmall">
<item name="fontFamily">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
</style>

<style name="ShapeAppearanceOverlay.SWPro.TextInputLayout.Rounded" parent="">
<!-- Shapes -->
<style name="ShapeAppearanceOverlay.SketchwarePro.TextInputLayout" parent="">
<item name="cornerFamily">rounded</item>
<item name="cornerSize">14dp</item>
</style>


<style name="error_appearance" parent="@android:style/TextAppearance">
<item name="android:textSize">12sp</item>
<!-- Theme overlays -->
<style name="ThemeOverlay.SketchwarePro.BottomSheetDialog" parent="ThemeOverlay.Material3.BottomSheetDialog">
<item name="android:navigationBarColor">@android:color/transparent</item>
</style>

<style name="hint_appearance" parent="@android:style/TextAppearance">
<item name="android:textSize">12sp</item>
<item name="android:fontFamily">@font/gilroy</item>
<item name="fontFamily">@font/gilroy</item>
<style name="ThemeOverlay.SketchwarePro.TextInputEditText" parent="ThemeOverlay.Material3.TextInputEditText.OutlinedBox">
<item name="editTextStyle">@style/Widget.SketchwarePro.TextInputEditText</item>
</style>
<!-- end AutoCompleteTextInputEditTextStyle -->

<style name="ThemeOverlay.SketchwarePro.ViewEditor" parent="Base.Theme.MaterialComponents.Light" />
</resources>
12 changes: 7 additions & 5 deletions app/src/main/res/values/themes.xml
Original file line number Diff line number Diff line change
@@ -1,20 +1,22 @@
<resources>
<style name="Base.Theme.SketchwarePro" parent="Scheme.SketchwarePro.DayNight" />
<style name="Theme.SketchwarePro" parent="Platform.Theme.SketchwarePro">
<!-- Styles & themes -->
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.SketchwarePro.BottomSheetDialog</item>
<item name="chipStyle">@style/ChipStyle</item>
<item name="collapsingToolbarLayoutStyle">?attr/collapsingToolbarLayoutLargeStyle</item>
<item name="collapsingToolbarLayoutLargeSize">@dimen/collapsing_toolbar_large_size</item>
<item name="collapsingToolbarLayoutLargeStyle">@style/Widget.SketchwarePro.CollapsingToolbar</item>
<item name="homeAsUpIndicator">@drawable/abc_ic_ab_back_material</item>
<item name="switchPreferenceCompatStyle">@style/Widget.SketchwarePro.Preference.SwitchPreferenceCompat</item>
<item name="tabStyle">@style/Widget.SketchwarePro.TabLayout</item>
<item name="textInputStyle">@style/Widget.SketchwarePro.TextInputLayout</item>
<item name="textInputOutlinedStyle">@style/Widget.SketchwarePro.TextInputLayout</item>
<item name="textInputOutlinedExposedDropdownMenuStyle">@style/Widget.SketchwarePro.TextInputLayout.ExposedDropdownMenu</item>

<!-- App font -->
<item name="fontFamily">@font/gilroy</item>
<item name="android:fontFamily">@font/gilroy</item>
<item name="switchPreferenceCompatStyle">
@style/Preference.SketchwarePro.SwitchPreferenceCompat
</item>
<item name="popupMenuStyle">@style/Widget.Material3.PopupMenu</item>
<item name="bottomSheetDialogTheme">@style/ThemeOverlay.SketchwarePro.BottomSheetDialog</item>
</style>

<style name="Theme.SketchwarePro.Main">
Expand Down

0 comments on commit 40e60ab

Please sign in to comment.