mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
b77ea55641
commit
1a8ae5a5f1
|
@ -120,9 +120,7 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
|
|||
ivState.setImageResource(R.drawable.baseline_cloud_off_24);
|
||||
ivState.setVisibility(folder.synchronize || folder.state != null ? View.VISIBLE : View.INVISIBLE);
|
||||
|
||||
String name = (folder.display == null
|
||||
? Helper.localizeFolderName(context, folder.name)
|
||||
: folder.display);
|
||||
String name = folder.getDisplayName(context);
|
||||
if (folder.unseen > 0)
|
||||
tvName.setText(context.getString(R.string.title_folder_unseen, name, folder.unseen));
|
||||
else
|
||||
|
|
|
@ -1467,12 +1467,8 @@ public class AdapterMessage extends PagedListAdapter<TupleMessageEx, AdapterMess
|
|||
PopupMenu popupMenu = new PopupMenu(context, anchor);
|
||||
|
||||
int order = 0;
|
||||
for (EntityFolder folder : folders) {
|
||||
String name = (folder.display == null
|
||||
? Helper.localizeFolderName(context, folder.name)
|
||||
: folder.display);
|
||||
popupMenu.getMenu().add(Menu.NONE, folder.id.intValue(), order++, name);
|
||||
}
|
||||
for (EntityFolder folder : folders)
|
||||
popupMenu.getMenu().add(Menu.NONE, folder.id.intValue(), order++, folder.getDisplayName(context));
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
|
|
@ -19,6 +19,8 @@ package eu.faircode.email;
|
|||
Copyright 2018 by Marcel Bokhorst (M66B)
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
|
||||
|
@ -132,6 +134,10 @@ public class EntityFolder implements Serializable {
|
|||
public EntityFolder() {
|
||||
}
|
||||
|
||||
String getDisplayName(Context context) {
|
||||
return (display == null ? Helper.localizeFolderName(context, name) : display);
|
||||
}
|
||||
|
||||
boolean isOutgoing() {
|
||||
return isOutgoing(this.type);
|
||||
}
|
||||
|
|
|
@ -781,12 +781,8 @@ public class FragmentMessages extends FragmentEx {
|
|||
PopupMenu popupMenu = new PopupMenu(getContext(), popupAnchor);
|
||||
|
||||
int order = 0;
|
||||
for (EntityFolder folder : folders) {
|
||||
String name = (folder.display == null
|
||||
? Helper.localizeFolderName(getContext(), folder.name)
|
||||
: folder.display);
|
||||
popupMenu.getMenu().add(Menu.NONE, folder.id.intValue(), order++, name);
|
||||
}
|
||||
for (EntityFolder folder : folders)
|
||||
popupMenu.getMenu().add(Menu.NONE, folder.id.intValue(), order++, folder.getDisplayName(getContext()));
|
||||
|
||||
popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
|
||||
@Override
|
||||
|
@ -996,9 +992,7 @@ public class FragmentMessages extends FragmentEx {
|
|||
if (folder == null)
|
||||
setSubtitle(null);
|
||||
else {
|
||||
String name = (folder.display == null
|
||||
? Helper.localizeFolderName(getContext(), folder.name)
|
||||
: folder.display);
|
||||
String name = folder.getDisplayName(getContext());
|
||||
if (folder.unseen > 0)
|
||||
setSubtitle(getString(R.string.title_folder_unseen, name, folder.unseen));
|
||||
else
|
||||
|
@ -1601,10 +1595,9 @@ public class FragmentMessages extends FragmentEx {
|
|||
|
||||
private void moveUndo(final MessageTarget result) {
|
||||
// Show undo snackbar
|
||||
String display = (result.target.display == null ? result.target.name : result.target.display);
|
||||
final Snackbar snackbar = Snackbar.make(
|
||||
view,
|
||||
getString(R.string.title_moving, Helper.localizeFolderName(getContext(), display)),
|
||||
getString(R.string.title_moving, result.target.getDisplayName(getContext())),
|
||||
Snackbar.LENGTH_INDEFINITE);
|
||||
snackbar.setAction(R.string.title_undo, new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in New Issue