Merge pull request #529 from FineFindus/fix/hashtag-timeline-follow-icon

fix(HashtagTimeline): update follow menu icon
This commit is contained in:
LucasGGamerM 2024-09-02 08:55:15 -03:00 committed by GitHub
commit 3a14fb5912
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 4 deletions

View File

@ -105,6 +105,11 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
muteMenuItem.setIcon(newMute ? R.drawable.ic_fluent_speaker_2_24_regular : R.drawable.ic_fluent_speaker_off_24_regular); muteMenuItem.setIcon(newMute ? R.drawable.ic_fluent_speaker_2_24_regular : R.drawable.ic_fluent_speaker_off_24_regular);
} }
private void updateFollowState(boolean following) {
followMenuItem.setTitle(getString(following ? R.string.unfollow_user : R.string.follow_user, "#"+hashtagName));
followMenuItem.setIcon(following ? R.drawable.ic_fluent_person_delete_24_filled : R.drawable.ic_fluent_person_add_24_regular);
}
private void showMuteDialog(boolean mute) { private void showMuteDialog(boolean mute) {
UiUtils.showConfirmationAlert(getContext(), UiUtils.showConfirmationAlert(getContext(),
mute ? R.string.mo_unmute_hashtag : R.string.mo_mute_hashtag, mute ? R.string.mo_unmute_hashtag : R.string.mo_mute_hashtag,
@ -148,8 +153,6 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
}).exec(accountID); }).exec(accountID);
} }
@Override @Override
protected TimelineDefinition makeTimelineDefinition() { protected TimelineDefinition makeTimelineDefinition() {
return TimelineDefinition.ofHashtag(hashtagName); return TimelineDefinition.ofHashtag(hashtagName);
@ -292,6 +295,7 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
followMenuItem=optionsMenu.findItem(R.id.follow_hashtag); followMenuItem=optionsMenu.findItem(R.id.follow_hashtag);
pinMenuItem=optionsMenu.findItem(R.id.pin); pinMenuItem=optionsMenu.findItem(R.id.pin);
followMenuItem.setVisible(toolbarContentVisible); followMenuItem.setVisible(toolbarContentVisible);
updateFollowState(hashtag.following);
// pinMenuItem.setShowAsAction(toolbarContentVisible ? MenuItem.SHOW_AS_ACTION_NEVER : MenuItem.SHOW_AS_ACTION_ALWAYS); // pinMenuItem.setShowAsAction(toolbarContentVisible ? MenuItem.SHOW_AS_ACTION_NEVER : MenuItem.SHOW_AS_ACTION_ALWAYS);
super.updatePinButton(pinMenuItem); super.updatePinButton(pinMenuItem);
@ -388,8 +392,7 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
followButton.setTextVisible(true); followButton.setTextVisible(true);
followProgress.setVisibility(View.GONE); followProgress.setVisibility(View.GONE);
if(followMenuItem!=null){ if(followMenuItem!=null){
followMenuItem.setTitle(getString(hashtag.following ? R.string.unfollow_user : R.string.follow_user, "#"+hashtagName)); updateFollowState(hashtag.following);
followMenuItem.setIcon(hashtag.following ? R.drawable.ic_fluent_person_delete_24_filled : R.drawable.ic_fluent_person_add_24_regular);
} }
if(muteMenuItem!=null){ if(muteMenuItem!=null){
muteMenuItem.setTitle(getString(filter.isPresent() ? R.string.unmute_user : R.string.mute_user, "#" + hashtag)); muteMenuItem.setTitle(getString(filter.isPresent() ? R.string.unmute_user : R.string.mute_user, "#" + hashtag));
@ -429,6 +432,7 @@ public class HashtagTimelineFragment extends PinnableStatusListFragment{
return; return;
hashtag=result; hashtag=result;
updateHeader(); updateHeader();
updateFollowState(result.following);
followRequestRunning=false; followRequestRunning=false;
} }