Fix Dialog to Edit FAV and GPX icons.

This commit is contained in:
Dima-1 2020-05-05 16:41:03 +03:00
parent d3bf28d8a1
commit 68637e7bda
10 changed files with 148 additions and 132 deletions

View file

@ -1,9 +1,9 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/icon_color_active_light" />
<corners android:radius="18dp" />
<corners android:radius="@dimen/context_menu_progress_padding_left" />
<stroke
android:width="1dp"
android:color="@color/icon_color_active_light"
android:radius="18dp" />
android:radius="@dimen/context_menu_progress_padding_left" />
</shape>

View file

@ -4,7 +4,7 @@
xmlns:osmand="http://schemas.android.com/apk/res-auto"
android:orientation="vertical"
android:layout_width="0dp"
android:layout_height="36dp"
android:layout_height="@dimen/dialog_button_height"
android:layout_weight="1">
<LinearLayout

View file

@ -5,9 +5,9 @@
android:layout_height="wrap_content"
android:paddingStart="0dp"
android:paddingLeft="0dp"
android:paddingEnd="9dp"
android:paddingRight="9dp"
android:paddingBottom="4dp">
android:paddingEnd="@dimen/favorites_select_icon_button_right_padding"
android:paddingRight="@dimen/favorites_select_icon_button_right_padding"
android:paddingBottom="@dimen/context_menu_buttons_padding_bottom">
<FrameLayout
android:layout_width="wrap_content"
@ -15,22 +15,23 @@
<ImageView
android:id="@+id/outline"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_width="@dimen/context_menu_buttons_bottom_height"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:visibility="invisible"
app:srcCompat="@drawable/bg_point_circle_contour" />
<ImageView
android:id="@+id/background"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/favorites_icon_size"
android:layout_height="@dimen/favorites_icon_size"
android:padding="@dimen/favorites_icon_padding"
android:layout_gravity="center"
android:background="@drawable/bg_point_circle" />
app:srcCompat="@drawable/bg_point_circle" />
<ImageView
android:id="@+id/icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center"
android:clickable="false"
android:visibility="gone"

View file

@ -19,25 +19,26 @@
<androidx.appcompat.widget.Toolbar
android:id="@+id/toolbar"
android:layout_width="fill_parent"
android:layout_height="@dimen/dashboard_map_toolbar"
android:layout_height="@dimen/toolbar_height"
android:background="?attr/card_and_list_background_basic"
android:minHeight="@dimen/dashboard_map_toolbar"
android:paddingRight="@dimen/content_padding"
android:paddingEnd="@dimen/content_padding"
android:minHeight="@dimen/toolbar_height"
osmand:subtitleTextColor="?android:textColorPrimary"
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar"
osmand:titleTextColor="?android:textColorPrimary">
<ImageView
android:id="@+id/toolbar_action"
android:layout_width="@dimen/list_item_height"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="match_parent"
android:layout_gravity="end"
android:contentDescription="@string/replace_all"
android:scaleType="center"
android:src="@drawable/ic_action_replace"
android:layout_marginRight="@dimen/content_padding_half"
android:layout_marginStart="@dimen/content_padding_half"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginEnd="@dimen/content_padding_half" />
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding" />
</androidx.appcompat.widget.Toolbar>
@ -57,8 +58,8 @@
<FrameLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding">
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding">
<LinearLayout
@ -83,15 +84,16 @@
android:layout_height="wrap_content"
android:drawableEnd="@drawable/btn_circle_transparent_full"
android:drawableRight="@drawable/btn_circle_transparent_full"
android:drawablePadding="60dp"
android:drawablePadding="@dimen/favorites_list_item_height"
android:inputType="textMultiLine"
android:maxLines="4"
android:minHeight="60dp"
android:paddingStart="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:minHeight="@dimen/favorites_list_item_height"
android:paddingStart="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding_small"
android:paddingRight="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding_small"
android:scrollHorizontally="false"
android:textSize="16sp"
android:textSize="@dimen/default_list_text_size"
tools:text="@string/lorem_ipsum" />
</com.google.android.material.textfield.TextInputLayout>
@ -100,11 +102,11 @@
<ImageView
android:id="@+id/name_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/favorites_icon_size"
android:layout_height="@dimen/favorites_icon_size"
android:padding="@dimen/favorites_icon_padding"
android:layout_gravity="end"
android:layout_margin="12dp"
android:scaleType="center"
android:layout_margin="@dimen/content_padding_small"
android:contentDescription="@string/icon"
android:src="@drawable/ic_action_home_dark" />
@ -114,7 +116,7 @@
android:id="@+id/description"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/card_padding"
android:layout_marginTop="@dimen/content_padding_small"
android:gravity="center_vertical"
android:orientation="horizontal">
@ -123,8 +125,8 @@
android:id="@+id/description_caption"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/list_content_padding"
android:layout_marginRight="@dimen/list_content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_weight="1"
android:hint="@string/shared_string_description"
app:boxBackgroundColor="#4DCCCCCC">
@ -135,11 +137,12 @@
android:layout_height="wrap_content"
android:inputType="textMultiLine"
android:maxLines="4"
android:minHeight="60dp"
android:paddingStart="12dp"
android:paddingLeft="12dp"
android:paddingRight="12dp"
android:textSize="16sp"
android:minHeight="@dimen/favorites_list_item_height"
android:paddingStart="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding_small"
android:paddingRight="@dimen/content_padding_small"
android:paddingEnd="@dimen/content_padding_small"
android:textSize="@dimen/default_list_text_size"
tools:text="@string/lorem_ipsum" />
</com.google.android.material.textfield.TextInputLayout>
@ -148,7 +151,7 @@
<net.osmand.plus.widgets.TextViewEx
android:id="@+id/description_button"
android:layout_width="wrap_content"
android:layout_height="48dp"
android:layout_height="@dimen/context_menu_buttons_bottom_height"
android:layout_marginStart="@dimen/content_padding_half"
android:layout_marginLeft="@dimen/content_padding_half"
android:paddingLeft="@dimen/content_padding_half"
@ -171,7 +174,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:minHeight="@dimen/bottom_sheet_selected_item_title_height"
android:minHeight="@dimen/toolbar_height"
android:orientation="vertical">
<LinearLayout
@ -185,9 +188,9 @@
android:layout_weight="1"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="14dp"
android:paddingTop="@dimen/context_menu_first_line_top_margin"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="14dp"
android:paddingBottom="@dimen/context_menu_first_line_top_margin"
android:text="@string/select_group"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -217,15 +220,14 @@
<ImageView
android:id="@+id/group_list_button_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:paddingStart="@dimen/content_padding_small"
android:paddingLeft="@dimen/content_padding_small"
android:paddingEnd="@dimen/route_info_buttons_padding_top_bottom"
android:paddingRight="@dimen/route_info_buttons_padding_top_bottom"
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:src="@drawable/ic_action_folder"
tools:src="@drawable/ic_action_group_select_all"
android:contentDescription="@string/shared_string_list" />
</LinearLayout>
@ -235,8 +237,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:paddingTop="6dp"
android:paddingBottom="@dimen/content_padding_half">
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
android:paddingBottom="@dimen/content_padding">
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/group_recycler_view"
@ -259,8 +261,6 @@
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:background="?attr/dashboard_divider" />
<net.osmand.plus.widgets.TextViewEx
@ -268,9 +268,9 @@
android:layout_height="wrap_content"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingTop="@dimen/context_menu_first_line_top_margin"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="14dp"
android:paddingBottom="@dimen/context_menu_first_line_top_margin"
android:text="@string/select_icon_profile_dialog_title"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -295,15 +295,14 @@
android:id="@+id/select_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="6dp" />
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:layout_marginBottom="@dimen/content_padding_half" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:background="?attr/dashboard_divider" />
<LinearLayout
@ -317,9 +316,9 @@
android:layout_weight="1"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingTop="@dimen/context_menu_first_line_top_margin"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="14dp"
android:paddingBottom="@dimen/context_menu_first_line_top_margin"
android:text="@string/select_color"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -332,9 +331,9 @@
android:gravity="end"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingTop="@dimen/context_menu_first_line_top_margin"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="14dp"
android:paddingBottom="@dimen/context_menu_first_line_top_margin"
android:text="@string/select_color"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -345,15 +344,13 @@
android:id="@+id/select_color"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="6dp" />
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:layout_marginBottom="@dimen/content_padding_half" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/content_padding_half"
android:layout_marginBottom="@dimen/content_padding_half"
android:background="?attr/dashboard_divider" />
<LinearLayout
@ -367,9 +364,9 @@
android:layout_weight="1"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingTop="@dimen/context_menu_first_line_top_margin"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="14dp"
android:paddingBottom="@dimen/context_menu_first_line_top_margin"
android:text="@string/select_shape"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -382,9 +379,9 @@
android:gravity="end"
android:letterSpacing="@dimen/description_letter_spacing"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="@dimen/content_padding_half"
android:paddingTop="@dimen/context_menu_first_line_top_margin"
android:paddingRight="@dimen/content_padding"
android:paddingBottom="14dp"
android:paddingBottom="@dimen/context_menu_first_line_top_margin"
android:text="@string/select_shape"
android:textColor="?android:textColorSecondary"
android:textSize="@dimen/default_desc_text_size"
@ -393,18 +390,17 @@
<net.osmand.plus.widgets.FlowLayout
android:id="@+id/select_shape"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="start"
android:layout_marginStart="12dp"
android:layout_marginLeft="12dp"
android:layout_marginTop="6dp" />
android:layout_marginStart="@dimen/content_padding_small"
android:layout_marginLeft="@dimen/content_padding_small"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:layout_marginBottom="@dimen/content_padding_half" />
<View
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_marginTop="@dimen/content_padding_half"
android:background="?attr/dashboard_divider" />
<LinearLayout
@ -416,22 +412,24 @@
<ImageView
android:id="@+id/replace_action_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_gravity="center_vertical"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:contentDescription="@string/update_existing"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="21dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:paddingBottom="21dp"
tools:src="@drawable/ic_action_replace" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingTop="11dp"
android:orientation="vertical">
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:orientation="vertical"
android:paddingTop="@dimen/content_padding_half"
android:paddingBottom="@dimen/content_padding_half">
<TextView
android:id="@+id/replace_action_title"
@ -466,21 +464,24 @@
<ImageView
android:id="@+id/delete_action_icon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginEnd="@dimen/content_padding"
android:layout_marginRight="@dimen/content_padding"
android:layout_gravity="center_vertical"
android:contentDescription="@string/delete_point"
android:paddingStart="@dimen/content_padding"
android:paddingLeft="@dimen/content_padding"
android:paddingTop="12dp"
android:paddingEnd="32dp"
android:paddingRight="32dp"
android:paddingBottom="12dp"
android:src="@drawable/ic_action_delete_dark" />
<TextView
android:id="@+id/delete_action_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/content_padding"
android:layout_marginLeft="@dimen/content_padding"
android:layout_marginTop="@dimen/content_padding_small"
android:layout_marginBottom="@dimen/content_padding_small"
android:maxLines="1"
android:text="@string/shared_string_delete"
android:textAppearance="@style/TextAppearance.ListItemCategoryTitle"

View file

@ -2,8 +2,8 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="142dp"
android:layout_height="76dp"
android:layout_width="@dimen/favorites_select_group_button_width"
android:layout_height="@dimen/favorites_select_group_button_height"
android:layout_marginLeft="@dimen/content_padding_half"
android:layout_marginStart="@dimen/content_padding_half">
@ -19,22 +19,21 @@
<ImageView
android:id="@+id/groupIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="6dp"
android:paddingRight="6dp"
android:paddingStart="6dp"
android:paddingEnd="6dp"
android:paddingTop="6dp"
android:src="@drawable/ic_action_folder"
tools:src="@drawable/ic_action_folder" />
android:layout_width="@dimen/standard_icon_size"
android:layout_height="@dimen/standard_icon_size"
android:layout_marginLeft="@dimen/context_menu_padding_margin_tiny"
android:layout_marginRight="@dimen/context_menu_padding_margin_tiny"
android:layout_marginStart="@dimen/context_menu_padding_margin_tiny"
android:layout_marginEnd="@dimen/context_menu_padding_margin_tiny"
android:layout_marginTop="@dimen/context_menu_padding_margin_tiny"
android:src="@drawable/ic_action_folder" />
<TextView
android:id="@+id/counter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingTop="6dp"
android:paddingTop="@dimen/context_menu_padding_margin_tiny"
tools:text="255" />
</LinearLayout>
@ -46,7 +45,7 @@
android:paddingStart="@dimen/content_padding_half"
android:paddingRight="@dimen/content_padding_half"
android:paddingEnd="@dimen/content_padding_half"
android:paddingTop="33dp"
android:paddingTop="@dimen/context_menu_transport_grid_item_width"
tools:text="@string/favorite" />
</FrameLayout>

View file

@ -93,11 +93,19 @@
<dimen name="fab_margin_bottom_big">108dp</dimen>
<!-- General -->
<dimen name="dialog_button_height">54dp</dimen>
<dimen name="dialog_button_ex_height">90dp</dimen>
<dimen name="list_item_height">65dp</dimen>
<dimen name="list_header_height">60dp</dimen>
<dimen name="dashboard_map_top_padding">480dp</dimen>
<dimen name="dashboard_land_width">480dp</dimen>
<dimen name="favorites_icon_size">60dp</dimen>
<dimen name="favorites_icon_padding">3dp</dimen>
<dimen name="favorites_list_item_height">90dp</dimen>
<dimen name="favorites_select_group_button_height">114dp</dimen>
<dimen name="favorites_select_group_button_width">213dp</dimen>
<dimen name="favorites_select_icon_button_right_padding">14dp</dimen>
<!-- TextSizes -->
<dimen name="default_list_text_size_large">22sp</dimen>
<dimen name="default_list_text_size">18sp</dimen>

View file

@ -71,9 +71,14 @@
<dimen name="favorites_icon_right_margin">24dp</dimen>
<dimen name="favorites_icon_size">40dp</dimen>
<dimen name="favorites_icon_padding">2dp</dimen>
<dimen name="favorites_list_item_height">60dp</dimen>
<dimen name="local_index_check_right_margin">10dp</dimen>
<dimen name="favorites_select_group_button_height">76dp</dimen>
<dimen name="favorites_select_group_button_width">142dp</dimen>
<dimen name="favorites_icon_top_margin">13dp</dimen>
<dimen name="favorites_select_icon_button_right_padding">9dp</dimen>
<dimen name="local_index_check_right_margin">10dp</dimen>
<dimen name="dialog_elements_vertical_margin">16dp</dimen>
<dimen name="dialog_content_margin">24dp</dimen>
<dimen name="dialog_content_bottom_margin">16dp</dimen>

View file

@ -425,10 +425,10 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
FavouritePoint favorite = getFavorite();
int color = favorite != null ? getColor() : 0;
FavoriteGroup group = getGroup();
if (group != null && color == 0) {
if (group != null && (color == 0 || color == 0xFF000000)) {
color = group.getColor();
}
if (color == 0) {
if (color == 0 || color == 0xFF000000) {
color = defaultColor;
}
return color;
@ -457,20 +457,22 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
OsmandApplication app = getMyApplication();
if (editor.isNew()) {
FavoriteGroup lastUsedGroup = helper.getGroup(getLastUsedGroup());
if (lastUsedGroup != null) {
if (lastUsedGroup != null && lastUsedGroup.isVisible()) {
categories.add(lastUsedGroup.getDisplayName(app));
}
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
if (lastUsedGroup != null && !fg.equals(lastUsedGroup)) {
if (lastUsedGroup != null && !fg.equals(lastUsedGroup) && fg.isVisible()) {
categories.add(fg.getDisplayName(app));
}
}
} else {
for (FavoriteGroup fg : helper.getFavoriteGroups()) {
if (fg.isVisible()) {
categories.add(fg.getDisplayName(app));
}
}
}
}
return categories;
}

View file

@ -4,6 +4,7 @@ import android.annotation.SuppressLint;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.graphics.Color;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable;
import android.os.Build;
@ -327,8 +328,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
nightMode ? R.color.stroked_buttons_and_links_outline_dark
: R.color.stroked_buttons_and_links_outline_light)));
ImageView backgroundCircle = colorItemView.findViewById(R.id.background);
AndroidUtils.setBackground(backgroundCircle,
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle), color));
backgroundCircle.setImageDrawable(UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle), color));
backgroundCircle.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@ -400,8 +400,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
newShape.findViewById(R.id.outline).setVisibility(View.VISIBLE);
((TextView) rootView.findViewById(R.id.shape_name)).setText(backgroundType.getNameId());
ImageView background = newShape.findViewById(R.id.background);
AndroidUtils.setBackground(background,
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
background.setImageDrawable(UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
selectedColor));
selectedShape = backgroundType;
setBackgroundType(backgroundType);
@ -409,8 +408,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
private void setShapeSelectorBackground(BackgroundType backgroundType, ImageView background) {
AndroidUtils.setBackground(background,
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
background.setImageDrawable(UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
ContextCompat.getColor(app,
nightMode ? R.color.inactive_buttons_and_links_bg_dark
: R.color.inactive_buttons_and_links_bg_light)));
@ -472,7 +470,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
iconCategoriesRecyclerView.setAdapter(iconCategoriesAdapter);
iconCategoriesRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
iconCategoriesAdapter.notifyDataSetChanged();
iconCategoriesRecyclerView.scrollToPosition(iconCategoriesAdapter.getItemPosition(selectedIconCategory));
iconCategoriesRecyclerView.smoothScrollToPosition(iconCategoriesAdapter.getItemPosition(selectedIconCategory));
for (String name : iconNameList) {
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
}
@ -521,7 +519,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
ContextCompat.getColor(app, R.color.color_white)));
icon.findViewById(R.id.outline).setVisibility(View.VISIBLE);
ImageView backgroundCircle = icon.findViewById(R.id.background);
AndroidUtils.setBackground(backgroundCircle,
backgroundCircle.setImageDrawable(
UiUtilities.tintDrawable(ContextCompat.getDrawable(view.getContext(), R.drawable.bg_point_circle), selectedColor));
}
selectedIcon = iconRes;
@ -530,8 +528,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
}
private void setIconSelectorBackground(ImageView backgroundCircle) {
AndroidUtils.setBackground(backgroundCircle,
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle),
backgroundCircle.setImageDrawable(UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle),
ContextCompat.getColor(app, nightMode
? R.color.inactive_buttons_and_links_bg_dark
: R.color.inactive_buttons_and_links_bg_light)));
@ -835,7 +832,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
final String group = items.get(position);
holder.groupName.setText(group);
int categoryColor = getCategoryColor(group);
int color = categoryColor == 0 ? getDefaultColor() : categoryColor;
int color = categoryColor == 0 || categoryColor == Color.BLACK ? getDefaultColor() : categoryColor;
holder.groupIcon.setImageDrawable(UiUtilities.tintDrawable(
ContextCompat.getDrawable(app, R.drawable.ic_action_folder), color));
holder.pointsCounter.setText(String.valueOf(getCategoryPointsCount(group)));

View file

@ -2,6 +2,7 @@ package net.osmand.plus.mapcontextmenu.editors;
import android.app.Activity;
import android.app.Dialog;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
@ -88,10 +89,12 @@ public class SelectCategoryDialogFragment extends DialogFragment {
} else {
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
if (category.isVisible()) {
ll.addView(createCategoryItem(activity, nightMode, category.getDisplayName(getContext()),
category.getColor()));
}
}
}
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
button.setCompoundDrawablesWithIntrinsicBounds(getIcon(activity, R.drawable.map_zoom_in), null, null, null);
@ -119,7 +122,7 @@ public class SelectCategoryDialogFragment extends DialogFragment {
private View createCategoryItem(@NonNull final Activity activity, boolean nightMode, final String categoryName, final int categoryColor) {
View itemView = UiUtilities.getInflater(activity, nightMode).inflate(R.layout.favorite_category_dialog_item, null);
Button button = (Button)itemView.findViewById(R.id.button);
if (categoryColor != 0) {
if (categoryColor != 0 & categoryColor != Color.BLACK) {
button.setCompoundDrawablesWithIntrinsicBounds(
getIcon(activity, R.drawable.ic_action_folder, categoryColor), null, null, null);
} else {