Consistent round shape theming by parameters from Crane

This commit is contained in:
proletarius101 2021-06-02 10:21:14 +00:00 committed by Hans-Christoph Steiner
parent a5d678b72e
commit 8ffbd0b44d
6 changed files with 82 additions and 46 deletions

View File

@ -155,7 +155,7 @@
<Button <Button
android:id="@+id/btn_send_fdroid" android:id="@+id/btn_send_fdroid"
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.App.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
swap:icon="@drawable/ic_fdroid_grey" swap:icon="@drawable/ic_fdroid_grey"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@ -163,7 +163,7 @@
<Button <Button
android:id="@+id/btn_scan_qr" android:id="@+id/btn_scan_qr"
style="@style/Widget.MaterialComponents.Button.TextButton" style="@style/Widget.App.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/swap_scan_qr" android:text="@string/swap_scan_qr"

View File

@ -2,60 +2,62 @@
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android" <androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:orientation="vertical" android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:orientation="vertical">
<TextView <TextView
android:id="@+id/name" android:id="@+id/name"
tools:text="Business"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBaseline_toBaselineOf="@+id/view_all_button"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textSize="18sp"
android:textColor="?attr/categoryName"
android:paddingLeft="18dp"
android:paddingStart="18dp"
android:paddingRight="18dp"
android:paddingEnd="18dp"
tools:layout_editor_absoluteX="0dp"
android:focusable="true" android:focusable="true"
android:focusableInTouchMode="true" /> android:focusableInTouchMode="true"
android:paddingStart="18dp"
android:paddingLeft="18dp"
android:paddingEnd="18dp"
android:paddingRight="18dp"
android:textAppearance="@style/TextAppearance.AppCompat.Headline"
android:textColor="?attr/categoryName"
android:textSize="18sp"
app:layout_constraintBaseline_toBaselineOf="@+id/view_all_button"
app:layout_constraintStart_toStartOf="parent"
tools:layout_editor_absoluteX="0dp"
tools:text="Business" />
<Button <Button
android:id="@+id/view_all_button" android:id="@+id/view_all_button"
tools:text="View all 10" style="@style/Widget.App.Button.TextButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintEnd_toEndOf="parent"
style="@style/Widget.MaterialComponents.Button.TextButton"
android:textAllCaps="true" android:textAllCaps="true"
tools:layout_editor_absoluteX="268dp" /> app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:layout_editor_absoluteX="268dp"
tools:text="View all 10" />
<FrameLayout <FrameLayout
android:id="@+id/category_background" android:id="@+id/category_background"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
app:layout_constraintTop_toTopOf="@+id/app_cards"
app:layout_constraintBottom_toBottomOf="@+id/app_cards" app:layout_constraintBottom_toBottomOf="@+id/app_cards"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="@+id/app_cards"
tools:background="#ffffbbbb" /> tools:background="#ffffbbbb" />
<org.fdroid.fdroid.views.apps.FeatureImage <org.fdroid.fdroid.views.apps.FeatureImage
android:id="@+id/category_image" android:id="@+id/category_image"
app:layout_constraintStart_toStartOf="@+id/category_background"
app:layout_constraintEnd_toEndOf="@+id/category_background"
app:layout_constraintTop_toTopOf="@+id/category_background"
app:layout_constraintBottom_toBottomOf="@+id/category_background"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="0dp" android:layout_height="0dp"
tools:src="@drawable/category_graphics"
android:scaleType="fitStart"
android:importantForAccessibility="no" android:importantForAccessibility="no"
tools:ignore="ContentDescription" tools:targetApi="jelly_bean"/> android:scaleType="fitStart"
app:layout_constraintBottom_toBottomOf="@+id/category_background"
app:layout_constraintEnd_toEndOf="@+id/category_background"
app:layout_constraintStart_toStartOf="@+id/category_background"
app:layout_constraintTop_toTopOf="@+id/category_background"
tools:ignore="ContentDescription"
tools:src="@drawable/category_graphics"
tools:targetApi="jelly_bean" />
<androidx.recyclerview.widget.RecyclerView <androidx.recyclerview.widget.RecyclerView
android:id="@+id/app_cards" android:id="@+id/app_cards"
@ -63,14 +65,14 @@
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:clipToPadding="false" android:clipToPadding="false"
android:orientation="horizontal" android:orientation="horizontal"
android:paddingBottom="@dimen/category_preview__app_list__padding__vertical"
android:paddingTop="@dimen/category_preview__app_list__padding__vertical" android:paddingTop="@dimen/category_preview__app_list__padding__vertical"
android:paddingBottom="@dimen/category_preview__app_list__padding__vertical"
app:layoutManager="LinearLayoutManager" app:layoutManager="LinearLayoutManager"
app:layout_constraintEnd_toEndOf="parent" app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent" app:layout_constraintRight_toRightOf="parent"
app:layout_constraintStart_toStartOf="parent" app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/view_all_button" app:layout_constraintTop_toBottomOf="@+id/view_all_button"
tools:listitem="@layout/app_card_normal"/> tools:listitem="@layout/app_card_normal" />
</androidx.constraintlayout.widget.ConstraintLayout> </androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -35,17 +35,32 @@
<!--Shape Appearance for small components like chips, buttons, text fields and FABs--> <!--Shape Appearance for small components like chips, buttons, text fields and FABs-->
<style name="ShapeAppearance.App.SmallComponent" parent="ShapeAppearance.MaterialComponents.SmallComponent"> <style name="ShapeAppearance.App.SmallComponent" parent="ShapeAppearance.MaterialComponents.SmallComponent">
<item name="cornerSize">32dp</item> <item name="cornerSize">4dp</item>
<item name="cornerFamily">rounded</item>
</style> </style>
<!--Shape Appearance for medium components like cards, alert dialogs--> <!--Shape Appearance for medium components like cards, alert dialogs-->
<style name="ShapeAppearance.App.MediumComponent" parent="ShapeAppearance.MaterialComponents.MediumComponent"> <style name="ShapeAppearance.App.MediumComponent" parent="ShapeAppearance.MaterialComponents.MediumComponent">
<!--Your custom shape here--> <item name="cornerSize">16dp</item>
<item name="cornerFamily">rounded</item>
</style> </style>
<!--Shape Appearance for large components like side and bottom navigation drawers--> <!--Shape Appearance for large components like side and bottom navigation drawers-->
<style name="ShapeAppearance.App.LargeComponent" parent="ShapeAppearance.MaterialComponents.LargeComponent"> <style name="ShapeAppearance.App.LargeComponent" parent="ShapeAppearance.MaterialComponents.LargeComponent">
<!--Your custom shape here--> <item name="cornerSizeTopLeft">20dp</item>
<item name="cornerSizeTopRight">20dp</item>
<item name="cornerSizeBottomRight">0dp</item>
<item name="cornerSizeBottomLeft">0dp</item>
<item name="cornerFamily">rounded</item>
</style> </style>
<style name="ShapeAppearance.App.Button" parent="ShapeAppearance.MaterialComponents.SmallComponent">
<item name="cornerSize">50%</item>
<item name="cornerFamily">rounded</item>
</style>
<style name="ShapeAppearance.App.Card" parent="ShapeAppearance.MaterialComponents.MediumComponent">
<item name="cornerSize">4dp</item>
<item name="cornerFamily">rounded</item>
</style>
</resources> </resources>

View File

@ -15,10 +15,28 @@
<item name="android:textColor">@color/fdroid_green</item> <item name="android:textColor">@color/fdroid_green</item>
</style> </style>
<style name="Widget.App.CardView" parent="Widget.MaterialComponents.CardView">
<item name="shapeAppearance">@style/ShapeAppearance.App.Card</item>
</style>
<style name="Widget.App.Button.Dialog" parent="Widget.MaterialComponents.Button.TextButton.Dialog"> <style name="Widget.App.Button.Dialog" parent="Widget.MaterialComponents.Button.TextButton.Dialog">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.Button.TextButton</item> <item name="materialThemeOverlay">@style/ThemeOverlay.App.Button.TextButton</item>
<item name="colorPrimary">@color/fdroid_green</item> <item name="colorPrimary">@color/fdroid_green</item>
<item name="android:textColor">@color/fdroid_green</item> <item name="android:textColor">@color/fdroid_green</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.Button</item>
</style>
<style name="Widget.App.Button.TextButton" parent="Widget.MaterialComponents.Button.TextButton">
<item name="shapeAppearance">@style/ShapeAppearance.App.Button</item>
</style>
<style name="Widget.App.Button.OutlinedButton" parent="Widget.MaterialComponents.Button.OutlinedButton">
<item name="shapeAppearance">@style/ShapeAppearance.App.Button</item>
</style>
<style name="Widget.App.Button" parent="Widget.MaterialComponents.Button">
<item name="shapeAppearance">@style/ShapeAppearance.App.Button</item>
</style> </style>
<style name="AlertDialogBaseThemeDark" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog" /> <style name="AlertDialogBaseThemeDark" parent="ThemeOverlay.MaterialComponents.MaterialAlertDialog" />

View File

@ -1,6 +1,7 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<resources> <resources>
<style name="DetailsButtonStyleBase" parent="Widget.MaterialComponents.Button.OutlinedButton">
<style name="DetailsButtonStyleBase" parent="Widget.App.Button.OutlinedButton">
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
<item name="android:textStyle">normal</item> <item name="android:textStyle">normal</item>
<item name="android:minHeight">32dp</item> <item name="android:minHeight">32dp</item>
@ -11,18 +12,15 @@
<item name="android:paddingRight">18dp</item> <item name="android:paddingRight">18dp</item>
<item name="textAllCaps">true</item> <item name="textAllCaps">true</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item> <item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.SmallComponent</item>
</style> </style>
<style name="DetailsButtonStyle" parent="DetailsButtonStyleBase" /> <style name="DetailsButtonStyle" parent="DetailsButtonStyleBase" />
<style name="DetailsPrimaryButtonStyle" parent="Widget.MaterialComponents.Button"> <style name="DetailsPrimaryButtonStyle" parent="Widget.App.Button">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item> <item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.SmallComponent</item>
</style> </style>
<style name="ThemeOverlay.App.DetailsButton" parent=""> <style name="ThemeOverlay.App.DetailsButton" parent="" />
</style>
<style name="DetailsPrimaryButtonStyleSmall" parent="DetailsPrimaryButtonStyle"> <style name="DetailsPrimaryButtonStyleSmall" parent="DetailsPrimaryButtonStyle">
<item name="android:textSize">12sp</item> <item name="android:textSize">12sp</item>
@ -34,7 +32,6 @@
<style name="DetailsSecondaryButtonStyle" parent="DetailsButtonStyle"> <style name="DetailsSecondaryButtonStyle" parent="DetailsButtonStyle">
<item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item> <item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.SmallComponent</item>
</style> </style>
<style name="DetailsSecondaryButtonStyleSmall" parent="DetailsSecondaryButtonStyle"> <style name="DetailsSecondaryButtonStyleSmall" parent="DetailsSecondaryButtonStyle">
@ -45,12 +42,11 @@
<item name="android:paddingRight">12dp</item> <item name="android:paddingRight">12dp</item>
</style> </style>
<style name="DetailsMoreButtonStyle" parent="Widget.MaterialComponents.Button.TextButton"> <style name="DetailsMoreButtonStyle" parent="Widget.App.Button.TextButton">
<item name="android:padding">8dp</item> <item name="android:padding">8dp</item>
<item name="android:textSize">14sp</item> <item name="android:textSize">14sp</item>
<item name="android:textStyle">normal</item> <item name="android:textStyle">normal</item>
<item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item> <item name="materialThemeOverlay">@style/ThemeOverlay.App.DetailsButton</item>
<item name="shapeAppearance">@style/ShapeAppearance.App.SmallComponent</item>
</style> </style>
<style name="DetailsAppTitleStyle" parent="TextAppearance.MaterialComponents.Headline6"> <style name="DetailsAppTitleStyle" parent="TextAppearance.MaterialComponents.Headline6">

View File

@ -24,6 +24,11 @@
</item> </item>
<item name="shapeAppearanceLargeComponent">@style/ShapeAppearance.App.LargeComponent</item> <item name="shapeAppearanceLargeComponent">@style/ShapeAppearance.App.LargeComponent</item>
<item name="borderlessButtonStyle">@style/Widget.App.Button.TextButton</item>
<item name="materialButtonOutlinedStyle">@style/Widget.App.Button.OutlinedButton</item>
<item name="materialButtonStyle">@style/Widget.App.Button</item>
<item name="materialCardViewStyle">@style/Widget.App.CardView</item>
<!-- backward-compatibility theme options go here --> <!-- backward-compatibility theme options go here -->
<!--Material color attributes (light theme) --> <!--Material color attributes (light theme) -->
<!--colorPrimary colors map to components and elements, such as app bars and buttons. --> <!--colorPrimary colors map to components and elements, such as app bars and buttons. -->