Empty for 0

This commit is contained in:
androiddevkotlin 2021-03-02 09:24:37 +02:00
parent d2e36e0783
commit be5c29f7e5

View file

@ -143,14 +143,17 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
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();
int favoriteCategoryCount = e.getKey().length(); String favoriteCategoryCount = String.valueOf(e.getKey().length());
favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue(), favoriteCategoryCount, false)); favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, categoryName, e.getValue(), favoriteCategoryCount, false));
} }
} }
} else { } else {
List<FavouritesDbHelper.FavoriteGroup> gs = favoritesHelper.getFavoriteGroups(); List<FavouritesDbHelper.FavoriteGroup> gs = favoritesHelper.getFavoriteGroups();
for (final FavouritesDbHelper.FavoriteGroup category : gs) { for (final FavouritesDbHelper.FavoriteGroup category : gs) {
int favoriteCategoryCount = category.getPoints().size(); String favoriteCategoryCount = String.valueOf(category.getPoints().size());
if (favoriteCategoryCount.equals("0")){
favoriteCategoryCount = app.getString(R.string.shared_string_empty);
}
favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()), favoriteCategoryContainer.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
category.getColor(), favoriteCategoryCount, !category.isVisible())); category.getColor(), favoriteCategoryCount, !category.isVisible()));
} }
@ -161,7 +164,7 @@ public class SelectFavoriteCategoryBottomSheet extends MenuBottomSheetDialogFrag
} }
} }
private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor, int categoryPointCount, boolean isHidden) { private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor, String categoryPointCount, boolean isHidden) {
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.bottom_sheet_item_with_descr_and_radio_btn, null); View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.bottom_sheet_item_with_descr_and_radio_btn, null);
final AppCompatImageView button = (AppCompatImageView) itemView.findViewById(R.id.icon); final AppCompatImageView button = (AppCompatImageView) itemView.findViewById(R.id.icon);
final int dp8 = AndroidUtils.dpToPx(app, 8f); final int dp8 = AndroidUtils.dpToPx(app, 8f);