diff --git a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java index 866995ab..3831e147 100644 --- a/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java +++ b/mastodon/src/main/java/org/joinmastodon/android/ui/utils/UiUtils.java @@ -448,26 +448,25 @@ public class UiUtils{ } public static void setRelationshipToActionButtonM3(Relationship relationship, Button button){ - boolean secondaryStyle; + int styleRes; if(relationship.blocking){ button.setText(R.string.button_blocked); - secondaryStyle=true; + styleRes=R.style.Widget_Mastodon_M3_Button_Tonal_Error; }else if(relationship.blockedBy){ button.setText(R.string.button_follow); - secondaryStyle=false; + styleRes=R.style.Widget_Mastodon_M3_Button_Filled; }else if(relationship.requested){ button.setText(R.string.button_follow_pending); - secondaryStyle=true; + styleRes=R.style.Widget_Mastodon_M3_Button_Tonal; }else if(!relationship.following){ button.setText(relationship.followedBy ? R.string.follow_back : R.string.button_follow); - secondaryStyle=false; + styleRes=R.style.Widget_Mastodon_M3_Button_Filled; }else{ button.setText(R.string.button_following); - secondaryStyle=true; + styleRes=R.style.Widget_Mastodon_M3_Button_Tonal; } button.setEnabled(!relationship.blockedBy); - int styleRes=secondaryStyle ? R.style.Widget_Mastodon_M3_Button_Tonal : R.style.Widget_Mastodon_M3_Button_Filled; TypedArray ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.background}); button.setBackground(ta.getDrawable(0)); ta.recycle(); diff --git a/mastodon/src/main/res/color/button_text_m3_tonal_error.xml b/mastodon/src/main/res/color/button_text_m3_tonal_error.xml new file mode 100644 index 00000000..98647f2d --- /dev/null +++ b/mastodon/src/main/res/color/button_text_m3_tonal_error.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mastodon/src/main/res/drawable/bg_button_m3_tonal_error.xml b/mastodon/src/main/res/drawable/bg_button_m3_tonal_error.xml new file mode 100644 index 00000000..f68223dd --- /dev/null +++ b/mastodon/src/main/res/drawable/bg_button_m3_tonal_error.xml @@ -0,0 +1,19 @@ + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/mastodon/src/main/res/values/styles.xml b/mastodon/src/main/res/values/styles.xml index c110344c..6f7efd93 100644 --- a/mastodon/src/main/res/values/styles.xml +++ b/mastodon/src/main/res/values/styles.xml @@ -316,11 +316,16 @@ + +