use short usernames in popup menus
improves upon mastodon#148
This commit is contained in:
@@ -554,24 +554,24 @@ public class ProfileFragment extends LoaderFragment implements OnBackPressedList
|
|||||||
return;
|
return;
|
||||||
inflater.inflate(isOwnProfile ? R.menu.profile_own : R.menu.profile, menu);
|
inflater.inflate(isOwnProfile ? R.menu.profile_own : R.menu.profile, menu);
|
||||||
UiUtils.enableOptionsMenuIcons(getActivity(), menu, R.id.bookmarks, R.id.followed_hashtags);
|
UiUtils.enableOptionsMenuIcons(getActivity(), menu, R.id.bookmarks, R.id.followed_hashtags);
|
||||||
menu.findItem(R.id.share).setTitle(getString(R.string.share_user, account.getDisplayUsername()));
|
menu.findItem(R.id.share).setTitle(getString(R.string.share_user, account.getShortUsername()));
|
||||||
if(isOwnProfile)
|
if(isOwnProfile)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
MenuItem mute = menu.findItem(R.id.mute);
|
MenuItem mute = menu.findItem(R.id.mute);
|
||||||
mute.setTitle(getString(relationship.muting ? R.string.unmute_user : R.string.mute_user, account.getDisplayUsername()));
|
mute.setTitle(getString(relationship.muting ? R.string.unmute_user : R.string.mute_user, account.getShortUsername()));
|
||||||
mute.setIcon(relationship.muting ? R.drawable.ic_fluent_speaker_2_24_regular : R.drawable.ic_fluent_speaker_mute_24_regular);
|
mute.setIcon(relationship.muting ? R.drawable.ic_fluent_speaker_2_24_regular : R.drawable.ic_fluent_speaker_mute_24_regular);
|
||||||
UiUtils.insetPopupMenuIcon(getContext(), mute);
|
UiUtils.insetPopupMenuIcon(getContext(), mute);
|
||||||
|
|
||||||
menu.findItem(R.id.block).setTitle(getString(relationship.blocking ? R.string.unblock_user : R.string.block_user, account.getDisplayUsername()));
|
menu.findItem(R.id.block).setTitle(getString(relationship.blocking ? R.string.unblock_user : R.string.block_user, account.getShortUsername()));
|
||||||
menu.findItem(R.id.report).setTitle(getString(R.string.report_user, account.getDisplayUsername()));
|
menu.findItem(R.id.report).setTitle(getString(R.string.report_user, account.getShortUsername()));
|
||||||
MenuItem manageUserLists=menu.findItem(R.id.manage_user_lists);
|
MenuItem manageUserLists=menu.findItem(R.id.manage_user_lists);
|
||||||
if(relationship.following) {
|
if(relationship.following) {
|
||||||
MenuItem hideBoosts = menu.findItem(R.id.hide_boosts);
|
MenuItem hideBoosts = menu.findItem(R.id.hide_boosts);
|
||||||
hideBoosts.setTitle(getString(relationship.showingReblogs ? R.string.hide_boosts_from_user : R.string.show_boosts_from_user, account.getDisplayUsername()));
|
hideBoosts.setTitle(getString(relationship.showingReblogs ? R.string.hide_boosts_from_user : R.string.show_boosts_from_user, account.getShortUsername()));
|
||||||
hideBoosts.setIcon(relationship.showingReblogs ? R.drawable.ic_fluent_arrow_repeat_all_off_24_regular : R.drawable.ic_fluent_arrow_repeat_all_24_regular);
|
hideBoosts.setIcon(relationship.showingReblogs ? R.drawable.ic_fluent_arrow_repeat_all_off_24_regular : R.drawable.ic_fluent_arrow_repeat_all_24_regular);
|
||||||
UiUtils.insetPopupMenuIcon(getContext(), hideBoosts);
|
UiUtils.insetPopupMenuIcon(getContext(), hideBoosts);
|
||||||
manageUserLists.setTitle(getString(R.string.sk_lists_with_user, account.getDisplayUsername()));
|
manageUserLists.setTitle(getString(R.string.sk_lists_with_user, account.getShortUsername()));
|
||||||
manageUserLists.setVisible(true);
|
manageUserLists.setVisible(true);
|
||||||
}else {
|
}else {
|
||||||
menu.findItem(R.id.hide_boosts).setVisible(false);
|
menu.findItem(R.id.hide_boosts).setVisible(false);
|
||||||
|
|||||||
@@ -164,6 +164,10 @@ public class Account extends BaseModel{
|
|||||||
return '@'+acct;
|
return '@'+acct;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getShortUsername() {
|
||||||
|
return '@'+acct.split("@")[0];
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String toString(){
|
public String toString(){
|
||||||
return "Account{"+
|
return "Account{"+
|
||||||
|
|||||||
@@ -222,7 +222,7 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
progress.dismiss();
|
progress.dismiss();
|
||||||
}, rel->{
|
}, rel->{
|
||||||
relationship=rel;
|
relationship=rel;
|
||||||
Toast.makeText(activity, activity.getString(rel.following ? R.string.followed_user : R.string.unfollowed_user, account.getDisplayUsername()), Toast.LENGTH_SHORT).show();
|
Toast.makeText(activity, activity.getString(rel.following ? R.string.followed_user : R.string.unfollowed_user, account.getShortUsername()), Toast.LENGTH_SHORT).show();
|
||||||
});
|
});
|
||||||
}else if(id==R.id.block_domain){
|
}else if(id==R.id.block_domain){
|
||||||
UiUtils.confirmToggleBlockDomain(activity, item.parentFragment.getAccountID(), account.getDomain(), relationship!=null && relationship.domainBlocking, ()->{});
|
UiUtils.confirmToggleBlockDomain(activity, item.parentFragment.getAccountID(), account.getDomain(), relationship!=null && relationship.domainBlocking, ()->{});
|
||||||
@@ -378,11 +378,11 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
block.setVisible(true);
|
block.setVisible(true);
|
||||||
report.setVisible(true);
|
report.setVisible(true);
|
||||||
follow.setVisible(relationship==null || relationship.following || (!relationship.blocking && !relationship.blockedBy && !relationship.domainBlocking && !relationship.muting));
|
follow.setVisible(relationship==null || relationship.following || (!relationship.blocking && !relationship.blockedBy && !relationship.domainBlocking && !relationship.muting));
|
||||||
mute.setTitle(item.parentFragment.getString(relationship!=null && relationship.muting ? R.string.unmute_user : R.string.mute_user, account.getDisplayUsername()));
|
mute.setTitle(item.parentFragment.getString(relationship!=null && relationship.muting ? R.string.unmute_user : R.string.mute_user, account.getShortUsername()));
|
||||||
mute.setIcon(relationship!=null && relationship.muting ? R.drawable.ic_fluent_speaker_2_24_regular : R.drawable.ic_fluent_speaker_mute_24_regular);
|
mute.setIcon(relationship!=null && relationship.muting ? R.drawable.ic_fluent_speaker_2_24_regular : R.drawable.ic_fluent_speaker_mute_24_regular);
|
||||||
UiUtils.insetPopupMenuIcon(item.parentFragment.getContext(), mute);
|
UiUtils.insetPopupMenuIcon(item.parentFragment.getContext(), mute);
|
||||||
block.setTitle(item.parentFragment.getString(relationship!=null && relationship.blocking ? R.string.unblock_user : R.string.block_user, account.getDisplayUsername()));
|
block.setTitle(item.parentFragment.getString(relationship!=null && relationship.blocking ? R.string.unblock_user : R.string.block_user, account.getShortUsername()));
|
||||||
report.setTitle(item.parentFragment.getString(R.string.report_user, account.getDisplayUsername()));
|
report.setTitle(item.parentFragment.getString(R.string.report_user, account.getShortUsername()));
|
||||||
// disabled in megalodon. domain blocks from a post clutters the context menu and looks out of place
|
// disabled in megalodon. domain blocks from a post clutters the context menu and looks out of place
|
||||||
// if(!account.isLocal()){
|
// if(!account.isLocal()){
|
||||||
// blockDomain.setVisible(true);
|
// blockDomain.setVisible(true);
|
||||||
@@ -391,7 +391,7 @@ public class HeaderStatusDisplayItem extends StatusDisplayItem{
|
|||||||
blockDomain.setVisible(false);
|
blockDomain.setVisible(false);
|
||||||
// }
|
// }
|
||||||
boolean following = relationship!=null && relationship.following;
|
boolean following = relationship!=null && relationship.following;
|
||||||
follow.setTitle(item.parentFragment.getString(following ? R.string.unfollow_user : R.string.follow_user, account.getDisplayUsername()));
|
follow.setTitle(item.parentFragment.getString(following ? R.string.unfollow_user : R.string.follow_user, account.getShortUsername()));
|
||||||
follow.setIcon(following ? R.drawable.ic_fluent_person_delete_24_regular : R.drawable.ic_fluent_person_add_24_regular);
|
follow.setIcon(following ? R.drawable.ic_fluent_person_delete_24_regular : R.drawable.ic_fluent_person_add_24_regular);
|
||||||
UiUtils.insetPopupMenuIcon(item.parentFragment.getContext(), follow);
|
UiUtils.insetPopupMenuIcon(item.parentFragment.getContext(), follow);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user