Skip to content

Commit

Permalink
add mutuals follow button state
Browse files Browse the repository at this point in the history
closes #890
  • Loading branch information
sk22 committed Oct 22, 2023
1 parent 3e28eb2 commit 02983c7
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -779,8 +779,8 @@ public static void setRelationshipToActionButtonM3(Relationship relationship, Bu
button.setText(relationship.followedBy ? R.string.follow_back : R.string.button_follow);
styleRes=R.style.Widget_Mastodon_M3_Button_Filled;
}else{
button.setText(R.string.button_following);
styleRes=R.style.Widget_Mastodon_M3_Button_Tonal;
button.setText(relationship.followedBy ? R.string.sk_button_mutuals : R.string.button_following);
styleRes=relationship.followedBy ? R.style.Widget_Mastodon_M3_Button_Tonal_Outlined : R.style.Widget_Mastodon_M3_Button_Tonal;
}

TypedArray ta=button.getContext().obtainStyledAttributes(styleRes, new int[]{android.R.attr.background});
Expand Down
27 changes: 27 additions & 0 deletions mastodon/src/main/res/drawable/bg_button_m3_tonal_outlined.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/m3_primary_overlay">
<item android:gravity="center_vertical" android:height="40dp">
<selector>
<item android:state_enabled="true">
<shape>
<solid android:color="?colorM3SecondaryContainer"/>
<stroke android:color="?colorM3OnSecondaryContainer" android:width="1dp"/>
<corners android:radius="20dp"/>
</shape>
</item>
<item>
<shape>
<solid android:color="?colorM3DisabledBackground"/>
<corners android:radius="20dp"/>
</shape>
</item>
</selector>
</item>
<item android:id="@android:id/mask" android:gravity="center_vertical" android:height="40dp">
<shape>
<solid android:color="#000"/>
<corners android:radius="20dp"/>
</shape>
</item>
</ripple>
1 change: 1 addition & 0 deletions mastodon/src/main/res/values-de-rDE/strings_sk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -415,4 +415,5 @@
<string name="sk_settings_default_visibility">Standard-Sichtbarkeit für Posts</string>
<string name="sk_settings_lock_account">Neue Follower_innen manuell genehmigen</string>
<string name="sk_timeline_cache_cleared">Start-Timeline geleert</string>
<string name="sk_button_mutuals">Befreundet</string>
</resources>
1 change: 1 addition & 0 deletions mastodon/src/main/res/values/strings_sk.xml
Original file line number Diff line number Diff line change
Expand Up @@ -416,4 +416,5 @@
<string name="sk_timeline_cache_cleared">Cleared home timeline cache</string>
<string name="sk_settings_lock_account">Manually approve new followers</string>
<string name="sk_settings_default_visibility">Default posting visibility</string>
<string name="sk_button_mutuals">Mutuals</string>
</resources>
3 changes: 3 additions & 0 deletions mastodon/src/main/res/values/styles.xml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@
<style name="Widget.Mastodon.M3.Button.Tonal.Icon">
<item name="android:paddingStart">16dp</item>
</style>
<style name="Widget.Mastodon.M3.Button.Tonal.Outlined">
<item name="android:background">@drawable/bg_button_m3_tonal_outlined</item>
</style>

<style name="Widget.Mastodon.M3.Button.Tonal.Error">
<item name="android:background">@drawable/bg_button_m3_tonal_error</item>
Expand Down

0 comments on commit 02983c7

Please sign in to comment.