Merge branch 'master' of git://github.com/osmandapp/Osmand into android_http_server

This commit is contained in:
simon 2020-09-03 13:52:11 +03:00
commit 409aa0574a

View file

@ -84,18 +84,17 @@ public class SelectCategoryDialogFragment extends DialogFragment {
if (gpxCategories != null) { if (gpxCategories != null) {
for (Map.Entry<String, Integer> e : gpxCategories.entrySet()) { for (Map.Entry<String, Integer> e : gpxCategories.entrySet()) {
String categoryName = e.getKey(); String categoryName = e.getKey();
ll.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue())); ll.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue(), false));
} }
} }
} else { } else {
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups(); List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
for (final FavouritesDbHelper.FavoriteGroup category : gs) { for (final FavouritesDbHelper.FavoriteGroup category : gs) {
if (category.isVisible()) {
ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()), ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
category.getColor())); category.getColor(), !category.isVisible()));
}
} }
} }
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null); View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button); Button button = (Button)itemView.findViewById(R.id.button);
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.ic_zoom_in), null, null, null); button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.ic_zoom_in), null, null, null);
@ -120,9 +119,12 @@ public class SelectCategoryDialogFragment extends DialogFragment {
return builder.create(); return builder.create();
} }
private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor) { private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor, boolean isHidden) {
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null); View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button); Button button = (Button)itemView.findViewById(R.id.button);
if(isHidden){
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.ic_action_hide), null, null, null);
} else {
if (categoryColor != 0) { if (categoryColor != 0) {
button.setCompoundDrawablesWithIntrinsicBounds( button.setCompoundDrawablesWithIntrinsicBounds(
getIcon(activity, R.drawable.ic_action_folder, categoryColor), null, null, null); getIcon(activity, R.drawable.ic_action_folder, categoryColor), null, null, null);
@ -131,6 +133,7 @@ public class SelectCategoryDialogFragment extends DialogFragment {
getIcon(activity, R.drawable.ic_action_folder, ContextCompat.getColor(activity, getIcon(activity, R.drawable.ic_action_folder, ContextCompat.getColor(activity,
gpxFile != null ? R.color.gpx_color_point : R.color.color_favorite)), null, null, null); gpxFile != null ? R.color.gpx_color_point : R.color.color_favorite)), null, null, null);
} }
}
button.setCompoundDrawablePadding(AndroidUtils.dpToPx(activity,15f)); button.setCompoundDrawablePadding(AndroidUtils.dpToPx(activity,15f));
String name = categoryName.length() == 0 ? getString(R.string.shared_string_favorites) : categoryName; String name = categoryName.length() == 0 ? getString(R.string.shared_string_favorites) : categoryName;
button.setText(name); button.setText(name);