From 4dfa0b221997db65331309a8e291b5cb4168a32c Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 15 Aug 2020 18:38:05 +0200 Subject: [PATCH] Show folder type icon in move dialog --- .../java/eu/faircode/email/FragmentMessages.java | 16 ++++++++++++++++ app/src/main/res/layout/dialog_ask_move.xml | 4 ++++ 2 files changed, 20 insertions(+) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index bc360e4a38..086381a48e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -7283,11 +7283,13 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. static class Folder implements Serializable { long id; + String type; String name; String display; Folder(Context context, EntityFolder folder) { this.id = folder.id; + this.type = folder.type; this.name = folder.name; this.display = folder.getDisplayName(context); } @@ -7552,6 +7554,20 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. tvSourceFolders.setText(getDisplay(result, false)); tvTargetFolders.setText(getDisplay(result, true)); + Drawable source = null; + Drawable target = null; + if (result.size() == 1) { + 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) + source.setBounds(0, 0, source.getIntrinsicWidth(), source.getIntrinsicHeight()); + if (target != null) + target.setBounds(0, 0, target.getIntrinsicWidth(), source.getIntrinsicHeight()); + } + + tvSourceFolders.setCompoundDrawablesRelative(source, null, null, null); + tvTargetFolders.setCompoundDrawablesRelative(target, null, null, null); + if (notagain != null) cbNotAgain.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override diff --git a/app/src/main/res/layout/dialog_ask_move.xml b/app/src/main/res/layout/dialog_ask_move.xml index 4303345a16..d9f1ddf1e8 100644 --- a/app/src/main/res/layout/dialog_ask_move.xml +++ b/app/src/main/res/layout/dialog_ask_move.xml @@ -26,6 +26,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="24dp" + android:drawableStart="@drawable/baseline_inbox_24" + android:drawablePadding="6dp" android:text="Source folders" android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="?android:attr/textColorPrimary" @@ -49,6 +51,8 @@ android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="12dp" + android:drawableStart="@drawable/baseline_archive_24" + android:drawablePadding="6dp" android:text="Target folders" android:textAppearance="@style/TextAppearance.AppCompat.Medium" android:textColor="?android:attr/textColorPrimary"