Show icon single source/target folder

pull/184/head
M66B 4 years ago
parent e3ea98e43a
commit 310f39d1e3

@ -7293,6 +7293,19 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
this.name = folder.name; this.name = folder.name;
this.display = folder.getDisplayName(context); this.display = folder.getDisplayName(context);
} }
@Override
public boolean equals(Object other) {
if (other instanceof Folder)
return this.id == ((Folder) other).id;
else
return false;
}
@Override
public int hashCode() {
return Objects.hash(id);
}
} }
} }
@ -7554,15 +7567,27 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences.
tvSourceFolders.setText(getDisplay(result, false)); tvSourceFolders.setText(getDisplay(result, false));
tvTargetFolders.setText(getDisplay(result, true)); tvTargetFolders.setText(getDisplay(result, true));
List<MessageTarget.Folder> sources = new ArrayList<>();
List<MessageTarget.Folder> targets = new ArrayList<>();
for (MessageTarget t : result) {
if (!sources.contains(t.sourceFolder))
sources.add(t.sourceFolder);
if (!targets.contains(t.targetFolder))
targets.add(t.targetFolder);
}
Drawable source = null; Drawable source = null;
Drawable target = null; if (sources.size() == 1) {
if (result.size() == 1) { source = getResources().getDrawable(EntityFolder.getIcon(sources.get(0).type), null);
source = getResources().getDrawable(EntityFolder.getIcon(result.get(0).sourceFolder.type), null);
target = getResources().getDrawable(EntityFolder.getIcon(result.get(0).targetFolder.type), null);
if (source != null) if (source != null)
source.setBounds(0, 0, source.getIntrinsicWidth(), source.getIntrinsicHeight()); source.setBounds(0, 0, source.getIntrinsicWidth(), source.getIntrinsicHeight());
}
Drawable target = null;
if (targets.size() == 1) {
target = getResources().getDrawable(EntityFolder.getIcon(targets.get(0).type), null);
if (target != null) if (target != null)
target.setBounds(0, 0, target.getIntrinsicWidth(), source.getIntrinsicHeight()); target.setBounds(0, 0, target.getIntrinsicWidth(), target.getIntrinsicHeight());
} }
tvSourceFolders.setCompoundDrawablesRelative(source, null, null, null); tvSourceFolders.setCompoundDrawablesRelative(source, null, null, null);

Loading…
Cancel
Save