Equal width for mini buttons

pull/194/merge
M66B 3 years ago
parent 0d9c4af681
commit 49ce21c90a

@ -308,12 +308,14 @@ public class FragmentDialogFolder extends FragmentDialogBase {
else {
if (data.favorites != null && data.favorites.size() > 0) {
Button[] btn = new Button[]{btnFavorite1, btnFavorite2, btnFavorite3};
for (int i = 0; i < data.favorites.size(); i++) {
for (int i = 0; i < btn.length; i++)
if (i < data.favorites.size()) {
EntityFolder favorite = data.favorites.get(i);
btn[i].setTag(favorite.id);
btn[i].setText(favorite.getDisplayName(context));
btn[i].setVisibility(View.VISIBLE);
}
} else
btn[i].setVisibility(View.INVISIBLE);
ibResetFavorites.setVisibility(View.VISIBLE);
}

@ -192,19 +192,24 @@ public class FragmentDialogSearch extends FragmentDialogBase {
}
};
boolean hasSearches = false;
Button[] btn = new Button[]{btnSearch1, btnSearch2, btnSearch3};
for (int i = 1; i <= 3; i++) {
boolean has = prefs.contains("last_search" + i);
if (has) {
hasSearches = true;
String search = prefs.getString("last_search" + i, null);
btn[i - 1].setText(search);
btn[i - 1].setOnClickListener(onSearch);
}
btn[i - 1].setVisibility(has ? View.VISIBLE : View.GONE);
int searches = 0;
for (int i = 0; i < btn.length; i++)
if (prefs.contains("last_search" + (i + 1)))
searches++;
for (int i = 0; i < btn.length; i++) {
if (prefs.contains("last_search" + (i + 1))) {
String search = prefs.getString("last_search" + (i + 1), null);
btn[i].setText(search);
btn[i].setOnClickListener(onSearch);
btn[i].setVisibility(View.VISIBLE);
} else
btn[i].setVisibility(searches > 0 ? View.INVISIBLE : View.GONE);
}
ibResetSearches.setVisibility(hasSearches ? View.VISIBLE : View.GONE);
ibResetSearches.setVisibility(searches > 0 ? View.VISIBLE : View.GONE);
ibResetSearches.setOnClickListener(new View.OnClickListener() {
@Override

Loading…
Cancel
Save