diff options
author | cyBerta <cyberta@riseup.net> | 2019-07-11 11:14:20 +0200 |
---|---|---|
committer | cyBerta <cyberta@riseup.net> | 2019-07-11 11:14:20 +0200 |
commit | cc024ad84e29b9dac837ef9ee2fc45125f47c463 (patch) | |
tree | 21c90b154c967ab5a868b00056094c07a6751eb9 | |
parent | dbef6cf67f3b4b31a806564a04a18a77ab636eb1 (diff) |
add little elevation to custom buttons, change general button shape to custom button shape
-rw-r--r-- | app/src/main/res/drawable/cust_button_primary.xml | 26 | ||||
-rw-r--r-- | app/src/main/res/drawable/cust_button_primary_disabled.xml | 19 | ||||
-rw-r--r-- | app/src/main/res/drawable/cust_button_primary_pressed.xml | 10 | ||||
-rw-r--r-- | app/src/main/res/drawable/cust_button_primary_rect.xml | 24 | ||||
-rw-r--r-- | app/src/main/res/drawable/cust_button_primary_released.xml | 19 | ||||
-rw-r--r-- | app/src/main/res/values/colors.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/values/dimens.xml | 1 | ||||
-rw-r--r-- | app/src/main/res/values/styles.xml | 2 | ||||
-rw-r--r-- | app/src/main/res/values/themes.xml | 1 |
9 files changed, 83 insertions, 21 deletions
diff --git a/app/src/main/res/drawable/cust_button_primary.xml b/app/src/main/res/drawable/cust_button_primary.xml index 3b0f7e26..31f9fbdd 100644 --- a/app/src/main/res/drawable/cust_button_primary.xml +++ b/app/src/main/res/drawable/cust_button_primary.xml @@ -1,24 +1,8 @@ <?xml version="1.0" encoding="utf-8"?> <selector xmlns:android="http://schemas.android.com/apk/res/android" > - <item android:state_pressed="true" > - <shape android:shape="rectangle" > - <corners android:radius="50dp" /> - <padding android:left="8dp" android:right="8dp"/> - <solid android:color="@color/colorPrimaryDark"/> - </shape> - </item> - <item android:state_focused="true"> - <shape android:shape="rectangle" > - <corners android:radius="50dp" /> - <padding android:left="8dp" android:right="8dp"/> - <solid android:color="@color/colorPrimaryDark"/> - </shape> - </item> - <item > - <shape android:shape="rectangle" > - <corners android:radius="50dp" /> - <padding android:left="8dp" android:right="8dp"/> - <solid android:color="@color/colorPrimary"/> - </shape> - </item> + + <item android:state_enabled="false" android:drawable="@drawable/cust_button_primary_disabled"/> + <item android:state_pressed="true" android:drawable="@drawable/cust_button_primary_pressed"/> + <item android:state_focused="true" android:drawable="@drawable/cust_button_primary_pressed"/> + <item android:drawable="@drawable/cust_button_primary_released"/> </selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/cust_button_primary_disabled.xml b/app/src/main/res/drawable/cust_button_primary_disabled.xml new file mode 100644 index 00000000..f62ecce3 --- /dev/null +++ b/app/src/main/res/drawable/cust_button_primary_disabled.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > + <item> + <shape android:shape="rectangle" > + <corners android:radius="50dp" /> + <solid android:color="@color/colorPrimary_transparent"/> + </shape> + </item> + <item + android:bottom="@dimen/button_bevel" + > + <shape android:shape="rectangle"> + <corners android:radius="50dp" /> + <padding android:right="2dp"/> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorDisabled"/> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/cust_button_primary_pressed.xml b/app/src/main/res/drawable/cust_button_primary_pressed.xml new file mode 100644 index 00000000..012631e7 --- /dev/null +++ b/app/src/main/res/drawable/cust_button_primary_pressed.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > + <item> + <shape android:shape="rectangle" > + <corners android:radius="50dp" /> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorPrimaryDark"/> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/drawable/cust_button_primary_rect.xml b/app/src/main/res/drawable/cust_button_primary_rect.xml new file mode 100644 index 00000000..c83d4e62 --- /dev/null +++ b/app/src/main/res/drawable/cust_button_primary_rect.xml @@ -0,0 +1,24 @@ +<?xml version="1.0" encoding="utf-8"?> +<selector xmlns:android="http://schemas.android.com/apk/res/android" > + <item android:state_pressed="true" > + <shape android:shape="rectangle" > + <corners android:radius="8dp" /> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorPrimaryDark"/> + </shape> + </item> + <item android:state_focused="true"> + <shape android:shape="rectangle" > + <corners android:radius="8dp" /> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorPrimaryDark"/> + </shape> + </item> + <item > + <shape android:shape="rectangle" > + <corners android:radius="8dp" /> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorPrimary"/> + </shape> + </item> +</selector>
\ No newline at end of file diff --git a/app/src/main/res/drawable/cust_button_primary_released.xml b/app/src/main/res/drawable/cust_button_primary_released.xml new file mode 100644 index 00000000..b9c2020f --- /dev/null +++ b/app/src/main/res/drawable/cust_button_primary_released.xml @@ -0,0 +1,19 @@ +<?xml version="1.0" encoding="utf-8"?> +<layer-list xmlns:android="http://schemas.android.com/apk/res/android" > + <item> + <shape android:shape="rectangle" > + <corners android:radius="50dp" /> + <solid android:color="@color/colorPrimary_transparent"/> + </shape> + </item> + <item + android:bottom="@dimen/button_bevel" + > + <shape android:shape="rectangle" > + <corners android:radius="50dp" /> + <padding android:right="2dp"/> + <padding android:left="8dp" android:right="8dp"/> + <solid android:color="@color/colorPrimary"/> + </shape> + </item> +</layer-list>
\ No newline at end of file diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 02a3a437..21c24663 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -2,9 +2,11 @@ <resources> <color name="colorPrimary">#b39ddb</color> <color name="colorPrimaryDark">#ac97d2</color> + <color name="colorPrimary_transparent">#20000000</color> <color name="colorBackground">#fffafafa</color> <color name="colorError">#ef9a9a</color> <color name="colorSuccess">#a5d6a7</color> + <color name="colorDisabled">#AAAAAA</color> <color name="black800">#424242</color> <color name="black800_secondary">#3b3b3b</color> diff --git a/app/src/main/res/values/dimens.xml b/app/src/main/res/values/dimens.xml index 338ad4d5..1595ff9b 100644 --- a/app/src/main/res/values/dimens.xml +++ b/app/src/main/res/values/dimens.xml @@ -41,4 +41,5 @@ <dimen name="constraint_bottom_compact">0.9</dimen> <dimen name="toast_bottom_padding">20dp</dimen> + <dimen name="button_bevel">3dp</dimen> </resources>
\ No newline at end of file diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index 485a7497..89f55b4c 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -62,6 +62,8 @@ <style name="BitmaskButton" parent="android:Widget.Button"> <item name="android:textAllCaps">true</item> + <item name="android:background">@drawable/cust_button_primary</item> + <item name="android:height">36dp</item> </style> <style name="BitmaskActivity"> diff --git a/app/src/main/res/values/themes.xml b/app/src/main/res/values/themes.xml index b287b1f8..51a8ea0e 100644 --- a/app/src/main/res/values/themes.xml +++ b/app/src/main/res/values/themes.xml @@ -11,6 +11,7 @@ <!-- button and controls --> <item name="android:buttonStyle">@style/BitmaskButton</item> + <item name="buttonStyle">@style/BitmaskButton</item> </style> <style name="SplashTheme" parent="Theme.AppCompat.NoActionBar"> |