From fecf5ccfc5e6e5a7a2321cc220e4797c2a657f47 Mon Sep 17 00:00:00 2001 From: M66B Date: Sat, 15 Jan 2022 18:26:55 +0100 Subject: [PATCH] Use buttons for folder favorites --- .../faircode/email/FragmentDialogFolder.java | 27 +++++++------ .../main/res/layout/dialog_folder_select.xml | 40 +++++++------------ 2 files changed, 28 insertions(+), 39 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java b/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java index 19a4d9f78b..d07ff3cf9e 100644 --- a/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java +++ b/app/src/main/java/eu/faircode/email/FragmentDialogFolder.java @@ -33,6 +33,7 @@ import android.view.inputmethod.InputMethodManager; import android.widget.AdapterView; import android.widget.ArrayAdapter; import android.widget.AutoCompleteTextView; +import android.widget.Button; import android.widget.ImageButton; import android.widget.TextView; @@ -87,9 +88,9 @@ public class FragmentDialogFolder extends FragmentDialogBase { final AutoCompleteTextView etSearch = dview.findViewById(R.id.etSearch); final ImageButton ibNext = dview.findViewById(R.id.ibNext); final TextView tvNoFolder = dview.findViewById(R.id.tvNoFolder); - final TextView tvFavorite1 = dview.findViewById(R.id.tvFavorite1); - final TextView tvFavorite2 = dview.findViewById(R.id.tvFavorite2); - final TextView tvFavorite3 = dview.findViewById(R.id.tvFavorite3); + final Button btnFavorite1 = dview.findViewById(R.id.btnFavorite1); + final Button btnFavorite2 = dview.findViewById(R.id.btnFavorite2); + final Button btnFavorite3 = dview.findViewById(R.id.btnFavorite3); final ImageButton ibResetFavorites = dview.findViewById(R.id.ibResetFavorites); final RecyclerView rvFolder = dview.findViewById(R.id.rvFolder); final ContentLoadingProgressBar pbWait = dview.findViewById(R.id.pbWait); @@ -163,9 +164,9 @@ public class FragmentDialogFolder extends FragmentDialogBase { } }); - tvFavorite1.setVisibility(View.GONE); - tvFavorite2.setVisibility(View.GONE); - tvFavorite3.setVisibility(View.GONE); + btnFavorite1.setVisibility(View.GONE); + btnFavorite2.setVisibility(View.GONE); + btnFavorite3.setVisibility(View.GONE); ibResetFavorites.setVisibility(View.GONE); View.OnClickListener listener = new View.OnClickListener() { @@ -184,16 +185,16 @@ public class FragmentDialogFolder extends FragmentDialogBase { dismiss(); } }; - tvFavorite1.setOnClickListener(listener); - tvFavorite2.setOnClickListener(listener); - tvFavorite3.setOnClickListener(listener); + btnFavorite1.setOnClickListener(listener); + btnFavorite2.setOnClickListener(listener); + btnFavorite3.setOnClickListener(listener); ibResetFavorites.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { - tvFavorite1.setVisibility(View.GONE); - tvFavorite2.setVisibility(View.GONE); - tvFavorite3.setVisibility(View.GONE); + btnFavorite1.setVisibility(View.GONE); + btnFavorite2.setVisibility(View.GONE); + btnFavorite3.setVisibility(View.GONE); ibResetFavorites.setVisibility(View.GONE); final DB db = DB.getInstance(context); @@ -306,7 +307,7 @@ public class FragmentDialogFolder extends FragmentDialogBase { tvNoFolder.setVisibility(View.VISIBLE); else { if (data.favorites != null && data.favorites.size() > 0) { - TextView[] tv = new TextView[]{tvFavorite1, tvFavorite2, tvFavorite3}; + TextView[] tv = new TextView[]{btnFavorite1, btnFavorite2, btnFavorite3}; for (int i = 0; i < data.favorites.size(); i++) { EntityFolder favorite = data.favorites.get(i); tv[i].setTag(favorite.id); diff --git a/app/src/main/res/layout/dialog_folder_select.xml b/app/src/main/res/layout/dialog_folder_select.xml index 44cb1cf4ec..fb1944ce98 100644 --- a/app/src/main/res/layout/dialog_folder_select.xml +++ b/app/src/main/res/layout/dialog_folder_select.xml @@ -41,58 +41,46 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@+id/etSearch" /> - - - + app:layout_constraintTop_toBottomOf="@+id/btnFavorite1" />