Add "manage accounts" item to settings

This commit is contained in:
Grishka 2023-10-18 01:41:10 +03:00
parent e525aef3d9
commit 9b3e153a4d
3 changed files with 16 additions and 0 deletions

View File

@ -17,6 +17,7 @@ import org.joinmastodon.android.api.session.AccountSession;
import org.joinmastodon.android.api.session.AccountSessionManager;
import org.joinmastodon.android.events.SelfUpdateStateChangedEvent;
import org.joinmastodon.android.model.viewmodel.ListItem;
import org.joinmastodon.android.ui.AccountSwitcherSheet;
import org.joinmastodon.android.ui.M3AlertDialogBuilder;
import org.joinmastodon.android.ui.utils.HideableSingleViewRecyclerAdapter;
import org.joinmastodon.android.ui.utils.UiUtils;
@ -57,6 +58,7 @@ public class SettingsMainFragment extends BaseSettingsFragment<Void>{
new ListItem<>(R.string.settings_notifications, 0, R.drawable.ic_notifications_24px, this::onNotificationsClick),
new ListItem<>(AccountSessionManager.get(accountID).domain, getString(R.string.settings_server_explanation), R.drawable.ic_dns_24px, this::onServerClick),
new ListItem<>(getString(R.string.about_app, getString(R.string.app_name)), null, R.drawable.ic_info_24px, this::onAboutClick, null, 0, true),
new ListItem<>(R.string.manage_accounts, 0, R.drawable.ic_switch_account_24px, this::onManageAccountsClick),
new ListItem<>(R.string.log_out, 0, R.drawable.ic_logout_24px, this::onLogOutClick, R.attr.colorM3Error, false)
));
@ -150,6 +152,10 @@ public class SettingsMainFragment extends BaseSettingsFragment<Void>{
Nav.go(getActivity(), SettingsAboutAppFragment.class, makeFragmentArgs());
}
private void onManageAccountsClick(ListItem<?> item){
new AccountSwitcherSheet(getActivity(), null).show();
}
private void onLogOutClick(ListItem<?> item_){
AccountSession session=AccountSessionManager.getInstance().getAccount(accountID);
new M3AlertDialogBuilder(getActivity())

View File

@ -0,0 +1,9 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M14,11Q15.25,11 16.125,10.125Q17,9.25 17,8Q17,6.75 16.125,5.875Q15.25,5 14,5Q12.75,5 11.875,5.875Q11,6.75 11,8Q11,9.25 11.875,10.125Q12.75,11 14,11ZM8,15.75Q9.1,14.475 10.65,13.738Q12.2,13 14,13Q15.8,13 17.35,13.738Q18.9,14.475 20,15.75Q20,15.75 20,15.75Q20,15.75 20,15.75V4Q20,4 20,4Q20,4 20,4H8Q8,4 8,4Q8,4 8,4V15.75Q8,15.75 8,15.75Q8,15.75 8,15.75ZM8,18Q7.175,18 6.588,17.413Q6,16.825 6,16V4Q6,3.175 6.588,2.587Q7.175,2 8,2H20Q20.825,2 21.413,2.587Q22,3.175 22,4V16Q22,16.825 21.413,17.413Q20.825,18 20,18ZM4,22Q3.175,22 2.588,21.413Q2,20.825 2,20V6H4V20Q4,20 4,20Q4,20 4,20H18V22ZM14,9Q13.575,9 13.288,8.712Q13,8.425 13,8Q13,7.575 13.288,7.287Q13.575,7 14,7Q14.425,7 14.713,7.287Q15,7.575 15,8Q15,8.425 14.713,8.712Q14.425,9 14,9ZM10.7,16H17.3Q16.575,15.5 15.738,15.25Q14.9,15 14,15Q13.1,15 12.263,15.25Q11.425,15.5 10.7,16ZM14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Q14,9.875 14,9.875Z"/>
</vector>

View File

@ -645,6 +645,7 @@
<string name="no_followed_hashtags_subtitle">Follows will appear here</string>
<string name="no_lists_title">Organize your home feed with Lists</string>
<string name="no_lists_subtitle">Yours will appear here</string>
<string name="manage_accounts">Manage accounts</string>
<plurals name="x_posts_recently">
<item quantity="one">%,d post recently</item>
<item quantity="other">%,d posts recently</item>