It now properly sets a default on every change. Not the final implementation yet

This commit is contained in:
LucasGGamerM 2022-12-14 20:39:02 -03:00
parent 5d87fb7b67
commit 6d875fd890
1 changed files with 6 additions and 1 deletions

View File

@ -667,7 +667,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
languageButton.setCompoundDrawableTintList(languageButton.getTextColors());
languageButton.setCompoundDrawablePadding(V.dp(6));
updateLanguage(languageResolver.getDefault());
updateLanguage(languageResolver.getDefault(accountID));
languagePopup=new PopupMenu(getActivity(), languageButton);
languageButton.setOnTouchListener(languagePopup.getDragToOpenListener());
languageButton.setOnClickListener(v->languagePopup.show());
@ -694,6 +694,10 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
return languageButton;
}
private void setDefaultLanguage(String language) {
GlobalUserPreferences.defaultLanguages.put(accountID, language);
}
@Override
public boolean onOptionsItemSelected(MenuItem item){
return true;
@ -850,6 +854,7 @@ public class ComposeFragment extends MastodonToolbarFragment implements OnBackPr
newRecentLanguages.remove(language);
newRecentLanguages.add(0, language);
recentLanguages.put(accountID, newRecentLanguages.stream().limit(4).collect(Collectors.toList()));
setDefaultLanguage(language);
GlobalUserPreferences.save();
}
}