Merge pull request #8719 from osmandapp/Fix_1_edit_fav_icons
Fix 1 edit fav icons
This commit is contained in:
commit
622ce4d72f
9 changed files with 169 additions and 99 deletions
1
OsmAnd/.gitignore
vendored
1
OsmAnd/.gitignore
vendored
|
@ -50,6 +50,7 @@ use/
|
||||||
osmand.properties
|
osmand.properties
|
||||||
osmand.xml
|
osmand.xml
|
||||||
assets/style.css
|
assets/style.css
|
||||||
|
assets/poi_categories.json
|
||||||
assets/help/*.html
|
assets/help/*.html
|
||||||
assets/help/images
|
assets/help/images
|
||||||
assets/help/screens
|
assets/help/screens
|
||||||
|
|
|
@ -323,7 +323,6 @@ task cleanNoTranslate(type: Delete) {
|
||||||
delete('res/values/no_translate.xml')
|
delete('res/values/no_translate.xml')
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task collectFonts(type: Copy) {
|
task collectFonts(type: Copy) {
|
||||||
from "../../resources/fonts"
|
from "../../resources/fonts"
|
||||||
from "../../resources/rendering_styles/fonts"
|
from "../../resources/rendering_styles/fonts"
|
||||||
|
@ -339,7 +338,6 @@ task collectHelpContentsStyle(type: Copy) {
|
||||||
into "assets"
|
into "assets"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
task collectHelpContentsAssets(type: Copy) {
|
task collectHelpContentsAssets(type: Copy) {
|
||||||
from("../../help/website/help") {
|
from("../../help/website/help") {
|
||||||
include "about.html"
|
include "about.html"
|
||||||
|
@ -351,11 +349,15 @@ task collectHelpContentsAssets(type: Copy) {
|
||||||
from("../../help/website/feature_articles") {
|
from("../../help/website/feature_articles") {
|
||||||
include "*.html"
|
include "*.html"
|
||||||
}
|
}
|
||||||
|
|
||||||
into "assets/feature_articles"
|
into "assets/feature_articles"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task copyPoiCategiry(type: Copy) {
|
||||||
|
from("../../resources/poi") {
|
||||||
|
include "poi_categories.json"
|
||||||
|
}
|
||||||
|
into "assets"
|
||||||
|
}
|
||||||
|
|
||||||
task copyStyleIcons(type: Copy) {
|
task copyStyleIcons(type: Copy) {
|
||||||
from "../../resources/rendering_styles/style-icons/"
|
from "../../resources/rendering_styles/style-icons/"
|
||||||
|
@ -378,6 +380,7 @@ task collectExternalResources {
|
||||||
updateNoTranslate,
|
updateNoTranslate,
|
||||||
validateTranslate,
|
validateTranslate,
|
||||||
copyWidgetIcons,
|
copyWidgetIcons,
|
||||||
|
copyPoiCategiry,
|
||||||
downloadWorldMiniBasemap
|
downloadWorldMiniBasemap
|
||||||
|
|
||||||
Gradle gradle = getGradle()
|
Gradle gradle = getGradle()
|
||||||
|
|
9
OsmAnd/res/drawable/ripple_solid_dark_6dp.xml
Normal file
9
OsmAnd/res/drawable/ripple_solid_dark_6dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="@color/active_buttons_and_links_bg_pressed_dark">
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/active_color_primary_dark" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
9
OsmAnd/res/drawable/ripple_solid_light_6dp.xml
Normal file
9
OsmAnd/res/drawable/ripple_solid_light_6dp.xml
Normal file
|
@ -0,0 +1,9 @@
|
||||||
|
<ripple xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
android:color="@color/active_buttons_and_links_bg_pressed_light">
|
||||||
|
<item android:id="@android:id/mask">
|
||||||
|
<shape android:shape="rectangle">
|
||||||
|
<solid android:color="@color/active_color_primary_light" />
|
||||||
|
<corners android:radius="6dp" />
|
||||||
|
</shape>
|
||||||
|
</item>
|
||||||
|
</ripple>
|
|
@ -9,26 +9,31 @@
|
||||||
android:paddingRight="9dp"
|
android:paddingRight="9dp"
|
||||||
android:paddingBottom="4dp">
|
android:paddingBottom="4dp">
|
||||||
|
|
||||||
<ImageView
|
<FrameLayout
|
||||||
android:id="@+id/outline"
|
|
||||||
android:layout_width="48dp"
|
|
||||||
android:layout_height="48dp"
|
|
||||||
android:visibility="invisible"
|
|
||||||
app:srcCompat="@drawable/bg_point_circle_contour" />
|
|
||||||
|
|
||||||
<ImageView
|
|
||||||
android:id="@+id/background"
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:layout_margin="4dp"
|
|
||||||
android:background="@drawable/bg_point_circle" />
|
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/outline"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="48dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="48dp"
|
||||||
android:layout_margin="12dp"
|
android:visibility="invisible"
|
||||||
android:clickable="false"
|
app:srcCompat="@drawable/bg_point_circle_contour" />
|
||||||
android:visibility="gone"
|
|
||||||
app:srcCompat="@drawable/mx_special_star_stroked" />
|
<ImageView
|
||||||
|
android:id="@+id/background"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:background="@drawable/bg_point_circle" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/icon"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="center"
|
||||||
|
android:clickable="false"
|
||||||
|
android:visibility="gone"
|
||||||
|
app:srcCompat="@drawable/mx_special_star_stroked" />
|
||||||
|
</FrameLayout>
|
||||||
</FrameLayout>
|
</FrameLayout>
|
|
@ -22,8 +22,6 @@
|
||||||
android:layout_height="@dimen/dashboard_map_toolbar"
|
android:layout_height="@dimen/dashboard_map_toolbar"
|
||||||
android:background="?attr/card_and_list_background_basic"
|
android:background="?attr/card_and_list_background_basic"
|
||||||
android:minHeight="@dimen/dashboard_map_toolbar"
|
android:minHeight="@dimen/dashboard_map_toolbar"
|
||||||
app:contentInsetLeft="72dp"
|
|
||||||
app:contentInsetStart="72dp"
|
|
||||||
osmand:subtitleTextColor="?android:textColorPrimary"
|
osmand:subtitleTextColor="?android:textColorPrimary"
|
||||||
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar"
|
osmand:theme="@style/ThemeOverlay.AppCompat.ActionBar"
|
||||||
osmand:titleTextColor="?android:textColorPrimary">
|
osmand:titleTextColor="?android:textColorPrimary">
|
||||||
|
@ -37,6 +35,8 @@
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
android:src="@drawable/ic_action_replace"
|
android:src="@drawable/ic_action_replace"
|
||||||
android:layout_marginRight="@dimen/content_padding_half"
|
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_marginEnd="@dimen/content_padding_half" />
|
||||||
|
|
||||||
</androidx.appcompat.widget.Toolbar>
|
</androidx.appcompat.widget.Toolbar>
|
||||||
|
@ -100,8 +100,8 @@
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/name_icon"
|
android:id="@+id/name_icon"
|
||||||
android:layout_width="@dimen/favorites_icon_size"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="@dimen/favorites_icon_size"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="end"
|
android:layout_gravity="end"
|
||||||
android:layout_margin="10dp"
|
android:layout_margin="10dp"
|
||||||
android:contentDescription="@string/icon"
|
android:contentDescription="@string/icon"
|
||||||
|
@ -191,7 +191,7 @@
|
||||||
android:text="@string/select_group"
|
android:text="@string/select_group"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/group_list_button"
|
android:id="@+id/group_list_button"
|
||||||
|
@ -236,7 +236,7 @@
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingTop="6dp"
|
android:paddingTop="6dp"
|
||||||
android:paddingBottom="@dimen/content_padding">
|
android:paddingBottom="@dimen/content_padding_half">
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/group_recycler_view"
|
android:id="@+id/group_recycler_view"
|
||||||
|
@ -274,7 +274,7 @@
|
||||||
android:text="@string/select_icon_profile_dialog_title"
|
android:text="@string/select_icon_profile_dialog_title"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
|
||||||
<androidx.recyclerview.widget.RecyclerView
|
<androidx.recyclerview.widget.RecyclerView
|
||||||
android:id="@+id/group_name_recycler_view"
|
android:id="@+id/group_name_recycler_view"
|
||||||
|
@ -323,7 +323,7 @@
|
||||||
android:text="@string/select_color"
|
android:text="@string/select_color"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/color_name"
|
android:id="@+id/color_name"
|
||||||
|
@ -338,7 +338,7 @@
|
||||||
android:text="@string/select_color"
|
android:text="@string/select_color"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<net.osmand.plus.widgets.FlowLayout
|
<net.osmand.plus.widgets.FlowLayout
|
||||||
|
@ -373,7 +373,7 @@
|
||||||
android:text="@string/select_shape"
|
android:text="@string/select_shape"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/shape_name"
|
android:id="@+id/shape_name"
|
||||||
|
@ -388,13 +388,15 @@
|
||||||
android:text="@string/select_shape"
|
android:text="@string/select_shape"
|
||||||
android:textColor="?android:textColorSecondary"
|
android:textColor="?android:textColorSecondary"
|
||||||
android:textSize="@dimen/default_desc_text_size"
|
android:textSize="@dimen/default_desc_text_size"
|
||||||
osmand:typeface="@string/font_roboto_regular" />
|
osmand:typeface="@string/font_roboto_medium" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<net.osmand.plus.widgets.FlowLayout
|
<net.osmand.plus.widgets.FlowLayout
|
||||||
android:id="@+id/select_shape"
|
android:id="@+id/select_shape"
|
||||||
|
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="start"
|
||||||
android:layout_marginStart="12dp"
|
android:layout_marginStart="12dp"
|
||||||
android:layout_marginLeft="12dp"
|
android:layout_marginLeft="12dp"
|
||||||
android:layout_marginTop="6dp" />
|
android:layout_marginTop="6dp" />
|
||||||
|
@ -403,7 +405,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_marginTop="@dimen/content_padding_half"
|
android:layout_marginTop="@dimen/content_padding_half"
|
||||||
android:layout_marginBottom="@dimen/content_padding_half"
|
|
||||||
android:background="?attr/dashboard_divider" />
|
android:background="?attr/dashboard_divider" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
|
@ -411,7 +412,6 @@
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
android:gravity="center_vertical"
|
|
||||||
android:orientation="horizontal">
|
android:orientation="horizontal">
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
|
@ -430,6 +430,7 @@
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:paddingTop="11dp"
|
||||||
android:orientation="vertical">
|
android:orientation="vertical">
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
|
|
|
@ -47,14 +47,14 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
private BackgroundType backgroundType = BackgroundType.CIRCLE;
|
private BackgroundType backgroundType = BackgroundType.CIRCLE;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
FavouritesDbHelper helper;
|
private FavouritesDbHelper helper;
|
||||||
|
|
||||||
private boolean autoFill;
|
private boolean autoFill;
|
||||||
private boolean saved;
|
private boolean saved;
|
||||||
private int defaultColor;
|
private int defaultColor;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onAttach(Context context) {
|
public void onAttach(@NonNull Context context) {
|
||||||
super.onAttach(context);
|
super.onAttach(context);
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
|
@ -129,7 +129,7 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public FavoritePointEditor getFavoritePointEditor() {
|
private FavoritePointEditor getFavoritePointEditor() {
|
||||||
return editor;
|
return editor;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -422,17 +422,23 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
@Override
|
@Override
|
||||||
public Set<String> getCategories() {
|
public Set<String> getCategories() {
|
||||||
Set<String> categories = new LinkedHashSet<>();
|
Set<String> categories = new LinkedHashSet<>();
|
||||||
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
|
FavouritesDbHelper helper = getHelper();
|
||||||
categories.add(fg.getDisplayName(getMyApplication()));
|
if (helper != null) {
|
||||||
|
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
|
||||||
|
categories.add(fg.getDisplayName(getMyApplication()));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return categories;
|
return categories;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCategoryPoints(String category) {
|
public int getCategoryPointsCount(String category) {
|
||||||
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
|
FavouritesDbHelper helper = getHelper();
|
||||||
if (fg.getDisplayName(getMyApplication()).equals(category)) {
|
if (helper != null) {
|
||||||
return fg.getPoints().size();
|
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
|
||||||
|
if (fg.getDisplayName(getMyApplication()).equals(category)) {
|
||||||
|
return fg.getPoints().size();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -440,9 +446,12 @@ public class FavoritePointEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCategoryColor(String category) {
|
public int getCategoryColor(String category) {
|
||||||
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
|
FavouritesDbHelper helper = getHelper();
|
||||||
if (fg.getDisplayName(getMyApplication()).equals(category)) {
|
if (helper != null) {
|
||||||
return fg.getColor();
|
for (FavouritesDbHelper.FavoriteGroup fg : getHelper().getFavoriteGroups()) {
|
||||||
|
if (fg.getDisplayName(getMyApplication()).equals(category)) {
|
||||||
|
return fg.getColor();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return defaultColor;
|
return defaultColor;
|
||||||
|
|
|
@ -1,15 +1,12 @@
|
||||||
package net.osmand.plus.mapcontextmenu.editors;
|
package net.osmand.plus.mapcontextmenu.editors;
|
||||||
|
|
||||||
import android.annotation.TargetApi;
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
|
||||||
import android.graphics.drawable.Drawable;
|
import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.drawable.GradientDrawable;
|
import android.graphics.drawable.GradientDrawable;
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.IBinder;
|
import android.os.IBinder;
|
||||||
|
|
||||||
import android.util.TypedValue;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
@ -38,7 +35,6 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||||
import com.google.android.material.textfield.TextInputLayout;
|
import com.google.android.material.textfield.TextInputLayout;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.data.FavouritePoint;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
@ -59,8 +55,10 @@ import java.util.LinkedHashMap;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
import static net.osmand.data.FavouritePoint.*;
|
||||||
import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.PERSONAL_CATEGORY;
|
import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.PERSONAL_CATEGORY;
|
||||||
import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.isPersonalCategoryDisplayName;
|
import static net.osmand.plus.FavouritesDbHelper.FavoriteGroup.isPersonalCategoryDisplayName;
|
||||||
|
import static net.osmand.util.Algorithms.capitalizeFirstLetter;
|
||||||
|
|
||||||
public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
|
|
||||||
|
@ -73,13 +71,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
private int selectedIcon;
|
private int selectedIcon;
|
||||||
@ColorInt
|
@ColorInt
|
||||||
private int selectedColor;
|
private int selectedColor;
|
||||||
private FavouritePoint.BackgroundType selectedShape = FavouritePoint.BackgroundType.CIRCLE;
|
private BackgroundType selectedShape = BackgroundType.CIRCLE;
|
||||||
private ImageView nameIcon;
|
private ImageView nameIcon;
|
||||||
private GroupAdapter groupListAdapter;
|
private GroupAdapter groupListAdapter;
|
||||||
private int scrollViewY;
|
private int scrollViewY;
|
||||||
private RecyclerView groupRecyclerView;
|
private RecyclerView groupRecyclerView;
|
||||||
private String selectedIconCategory;
|
private String selectedIconCategory;
|
||||||
private LinkedHashMap<String, JSONArray> group;
|
private LinkedHashMap<String, JSONArray> iconCategories;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -284,6 +282,12 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
private View createColorItemView(@ColorRes final int color, final FlowLayout rootView) {
|
private View createColorItemView(@ColorRes final int color, final FlowLayout rootView) {
|
||||||
FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
|
FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
|
||||||
.inflate(R.layout.point_editor_button, rootView, false);
|
.inflate(R.layout.point_editor_button, rootView, false);
|
||||||
|
ImageView outline = colorItemView.findViewById(R.id.outline);
|
||||||
|
outline.setImageDrawable(
|
||||||
|
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle_contour),
|
||||||
|
ContextCompat.getColor(app,
|
||||||
|
nightMode ? R.color.stroked_buttons_and_links_outline_dark
|
||||||
|
: R.color.stroked_buttons_and_links_outline_light)));
|
||||||
ImageView backgroundCircle = colorItemView.findViewById(R.id.background);
|
ImageView backgroundCircle = colorItemView.findViewById(R.id.background);
|
||||||
AndroidUtils.setBackground(backgroundCircle,
|
AndroidUtils.setBackground(backgroundCircle,
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle), color));
|
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle), color));
|
||||||
|
@ -304,8 +308,9 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
ImageView icon = oldColor.findViewById(R.id.icon);
|
ImageView icon = oldColor.findViewById(R.id.icon);
|
||||||
icon.setImageDrawable(UiUtilities.tintDrawable(icon.getDrawable(), R.color.icon_color_default_light));
|
icon.setImageDrawable(UiUtilities.tintDrawable(icon.getDrawable(), R.color.icon_color_default_light));
|
||||||
}
|
}
|
||||||
if (rootView.findViewWithTag(color) != null) {
|
View newColor = rootView.findViewWithTag(color);
|
||||||
rootView.findViewWithTag(color).findViewById(R.id.outline).setVisibility(View.VISIBLE);
|
if (newColor != null) {
|
||||||
|
newColor.findViewById(R.id.outline).setVisibility(View.VISIBLE);
|
||||||
}
|
}
|
||||||
((TextView) view.findViewById(R.id.color_name)).setText(ColorDialogs.getColorName(color));
|
((TextView) view.findViewById(R.id.color_name)).setText(ColorDialogs.getColorName(color));
|
||||||
selectedColor = color;
|
selectedColor = color;
|
||||||
|
@ -317,18 +322,16 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
|
|
||||||
private void createShapeSelector() {
|
private void createShapeSelector() {
|
||||||
FlowLayout selectShape = view.findViewById(R.id.select_shape);
|
FlowLayout selectShape = view.findViewById(R.id.select_shape);
|
||||||
for (FavouritePoint.BackgroundType backgroundType : FavouritePoint.BackgroundType.values()) {
|
for (BackgroundType backgroundType : BackgroundType.values()) {
|
||||||
selectShape.addView(createShapeItemView(backgroundType, selectShape), new FlowLayout.LayoutParams(0, 0));
|
selectShape.addView(createShapeItemView(backgroundType, selectShape), new FlowLayout.LayoutParams(0, 0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private View createShapeItemView(final FavouritePoint.BackgroundType backgroundType, final FlowLayout rootView) {
|
private View createShapeItemView(final BackgroundType backgroundType, final FlowLayout rootView) {
|
||||||
FrameLayout shapeItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
|
FrameLayout shapeItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
|
||||||
.inflate(R.layout.point_editor_button, rootView, false);
|
.inflate(R.layout.point_editor_button, rootView, false);
|
||||||
ImageView background = shapeItemView.findViewById(R.id.background);
|
ImageView background = shapeItemView.findViewById(R.id.background);
|
||||||
AndroidUtils.setBackground(background,
|
setShapeSelectorBackground(backgroundType, background);
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
|
|
||||||
ContextCompat.getColor(app, R.color.divider_color_light)));
|
|
||||||
ImageView outline = shapeItemView.findViewById(R.id.outline);
|
ImageView outline = shapeItemView.findViewById(R.id.outline);
|
||||||
outline.setImageDrawable(getOutlineDrawable(backgroundType.getIconId()));
|
outline.setImageDrawable(getOutlineDrawable(backgroundType.getIconId()));
|
||||||
background.setOnClickListener(new View.OnClickListener() {
|
background.setOnClickListener(new View.OnClickListener() {
|
||||||
|
@ -344,22 +347,21 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
private Drawable getOutlineDrawable(int iconId) {
|
private Drawable getOutlineDrawable(int iconId) {
|
||||||
String iconName = app.getResources().getResourceName(iconId);
|
String iconName = app.getResources().getResourceName(iconId);
|
||||||
int iconRes = app.getResources().getIdentifier(iconName + "_contour", "drawable", app.getPackageName());
|
int iconRes = app.getResources().getIdentifier(iconName + "_contour", "drawable", app.getPackageName());
|
||||||
return app.getUIUtilities().getIcon(iconRes, R.color.divider_color_light);
|
return app.getUIUtilities().getIcon(iconRes,
|
||||||
|
nightMode ? R.color.stroked_buttons_and_links_outline_dark : R.color.stroked_buttons_and_links_outline_light);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateShapeSelector(FavouritePoint.BackgroundType backgroundType, View rootView) {
|
private void updateShapeSelector(BackgroundType backgroundType, View rootView) {
|
||||||
View oldShape = rootView.findViewWithTag(selectedShape);
|
View oldShape = rootView.findViewWithTag(selectedShape);
|
||||||
if (oldShape != null) {
|
if (oldShape != null) {
|
||||||
oldShape.findViewById(R.id.outline).setVisibility(View.INVISIBLE);
|
oldShape.findViewById(R.id.outline).setVisibility(View.INVISIBLE);
|
||||||
ImageView background = oldShape.findViewById(R.id.background);
|
ImageView background = oldShape.findViewById(R.id.background);
|
||||||
AndroidUtils.setBackground(background,
|
setShapeSelectorBackground(selectedShape, background);
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, selectedShape.getIconId()),
|
|
||||||
ContextCompat.getColor(app, R.color.divider_color_light)));
|
|
||||||
}
|
}
|
||||||
rootView.findViewWithTag(backgroundType).findViewById(R.id.outline).setVisibility(View.VISIBLE);
|
View newShape = rootView.findViewWithTag(backgroundType);
|
||||||
|
newShape.findViewById(R.id.outline).setVisibility(View.VISIBLE);
|
||||||
((TextView) rootView.findViewById(R.id.shape_name)).setText(backgroundType.getNameId());
|
((TextView) rootView.findViewById(R.id.shape_name)).setText(backgroundType.getNameId());
|
||||||
|
ImageView background = newShape.findViewById(R.id.background);
|
||||||
ImageView background = rootView.findViewWithTag(backgroundType).findViewById(R.id.background);
|
|
||||||
AndroidUtils.setBackground(background,
|
AndroidUtils.setBackground(background,
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
|
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, backgroundType.getIconId()),
|
||||||
selectedColor));
|
selectedColor));
|
||||||
|
@ -368,15 +370,23 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
updateNameIcon();
|
updateNameIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setShapeSelectorBackground(BackgroundType backgroundType, ImageView background) {
|
||||||
|
AndroidUtils.setBackground(background,
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
private void createIconSelector() {
|
private void createIconSelector() {
|
||||||
group = new LinkedHashMap<>();
|
iconCategories = new LinkedHashMap<>();
|
||||||
try {
|
try {
|
||||||
JSONObject obj = new JSONObject(loadJSONFromAsset());
|
JSONObject obj = new JSONObject(loadJSONFromAsset());
|
||||||
JSONObject categories = obj.getJSONObject("categories");
|
JSONObject categories = obj.getJSONObject("categories");
|
||||||
for (int i = 0; i < categories.length(); i++) {
|
for (int i = 0; i < categories.length(); i++) {
|
||||||
JSONArray names = categories.names();
|
JSONArray names = categories.names();
|
||||||
JSONObject icons = categories.getJSONObject(names.get(i).toString());
|
JSONObject icons = categories.getJSONObject(names.get(i).toString());
|
||||||
group.put(names.get(i).toString(), icons.getJSONArray("icons"));
|
iconCategories.put(names.get(i).toString(), icons.getJSONArray("icons"));
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -386,19 +396,19 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getInitCategory() {
|
private String getInitCategory() {
|
||||||
for (int j = 0; j < group.values().size(); j++) {
|
for (int j = 0; j < iconCategories.values().size(); j++) {
|
||||||
JSONArray iconJsonArray = (JSONArray) group.values().toArray()[j];
|
JSONArray iconJsonArray = (JSONArray) iconCategories.values().toArray()[j];
|
||||||
for (int i = 0; i < iconJsonArray.length(); i++) {
|
for (int i = 0; i < iconJsonArray.length(); i++) {
|
||||||
try {
|
try {
|
||||||
if (iconJsonArray.getString(i).equals(getNameFromIconId(getIconId()))) {
|
if (iconJsonArray.getString(i).equals(getNameFromIconId(getIconId()))) {
|
||||||
return (String) group.keySet().toArray()[j];
|
return (String) iconCategories.keySet().toArray()[j];
|
||||||
}
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return group.keySet().iterator().next();
|
return iconCategories.keySet().iterator().next();
|
||||||
}
|
}
|
||||||
|
|
||||||
private String getNameFromIconId(int iconId) {
|
private String getNameFromIconId(int iconId) {
|
||||||
|
@ -408,7 +418,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
private void createIconForCategory() {
|
private void createIconForCategory() {
|
||||||
FlowLayout selectIcon = view.findViewById(R.id.select_icon);
|
FlowLayout selectIcon = view.findViewById(R.id.select_icon);
|
||||||
selectIcon.removeAllViews();
|
selectIcon.removeAllViews();
|
||||||
JSONArray iconJsonArray = group.get(selectedIconCategory);
|
JSONArray iconJsonArray = iconCategories.get(selectedIconCategory);
|
||||||
if (iconJsonArray != null) {
|
if (iconJsonArray != null) {
|
||||||
List<String> iconNameList = new ArrayList<>();
|
List<String> iconNameList = new ArrayList<>();
|
||||||
for (int i = 0; i < iconJsonArray.length(); i++) {
|
for (int i = 0; i < iconJsonArray.length(); i++) {
|
||||||
|
@ -418,12 +428,12 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
GroupNameAdapter groupNameListAdapter = new GroupNameAdapter();
|
IconCategoriesAdapter iconCategoriesAdapter = new IconCategoriesAdapter();
|
||||||
groupNameListAdapter.setItems(new ArrayList<>(group.keySet()));
|
iconCategoriesAdapter.setItems(new ArrayList<>(iconCategories.keySet()));
|
||||||
RecyclerView groupNameRecyclerView = view.findViewById(R.id.group_name_recycler_view);
|
RecyclerView groupNameRecyclerView = view.findViewById(R.id.group_name_recycler_view);
|
||||||
groupNameRecyclerView.setAdapter(groupNameListAdapter);
|
groupNameRecyclerView.setAdapter(iconCategoriesAdapter);
|
||||||
groupNameRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
|
groupNameRecyclerView.setLayoutManager(new LinearLayoutManager(app, RecyclerView.HORIZONTAL, false));
|
||||||
groupNameListAdapter.notifyDataSetChanged();
|
iconCategoriesAdapter.notifyDataSetChanged();
|
||||||
for (String name : iconNameList) {
|
for (String name : iconNameList) {
|
||||||
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
|
selectIcon.addView(createIconItemView(name, selectIcon), new FlowLayout.LayoutParams(0, 0));
|
||||||
}
|
}
|
||||||
|
@ -433,10 +443,14 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
private View createIconItemView(final String iconName, final ViewGroup rootView) {
|
private View createIconItemView(final String iconName, final ViewGroup rootView) {
|
||||||
FrameLayout iconItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
|
FrameLayout iconItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
|
||||||
.inflate(R.layout.point_editor_button, rootView, false);
|
.inflate(R.layout.point_editor_button, rootView, false);
|
||||||
|
ImageView outline = iconItemView.findViewById(R.id.outline);
|
||||||
|
outline.setImageDrawable(
|
||||||
|
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle_contour),
|
||||||
|
ContextCompat.getColor(app,
|
||||||
|
nightMode ? R.color.stroked_buttons_and_links_outline_dark
|
||||||
|
: R.color.stroked_buttons_and_links_outline_light)));
|
||||||
ImageView backgroundCircle = iconItemView.findViewById(R.id.background);
|
ImageView backgroundCircle = iconItemView.findViewById(R.id.background);
|
||||||
AndroidUtils.setBackground(backgroundCircle,
|
setIconSelectorBackground(backgroundCircle);
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle),
|
|
||||||
ContextCompat.getColor(app, R.color.divider_color_light)));
|
|
||||||
ImageView icon = iconItemView.findViewById(R.id.icon);
|
ImageView icon = iconItemView.findViewById(R.id.icon);
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
final int iconRes = app.getResources().getIdentifier("mx_" + iconName, "drawable", app.getPackageName());
|
final int iconRes = app.getResources().getIdentifier("mx_" + iconName, "drawable", app.getPackageName());
|
||||||
|
@ -456,11 +470,8 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
if (oldIcon != null) {
|
if (oldIcon != null) {
|
||||||
oldIcon.findViewById(R.id.outline).setVisibility(View.INVISIBLE);
|
oldIcon.findViewById(R.id.outline).setVisibility(View.INVISIBLE);
|
||||||
ImageView background = oldIcon.findViewById(R.id.background);
|
ImageView background = oldIcon.findViewById(R.id.background);
|
||||||
AndroidUtils.setBackground(background,
|
setIconSelectorBackground(background);
|
||||||
UiUtilities.tintDrawable(ContextCompat.getDrawable(app, R.drawable.bg_point_circle),
|
|
||||||
ContextCompat.getColor(app, R.color.divider_color_light)));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
View icon = rootView.findViewWithTag(iconRes);
|
View icon = rootView.findViewWithTag(iconRes);
|
||||||
if (icon != null) {
|
if (icon != null) {
|
||||||
icon.findViewById(R.id.outline).setVisibility(View.VISIBLE);
|
icon.findViewById(R.id.outline).setVisibility(View.VISIBLE);
|
||||||
|
@ -473,6 +484,14 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
updateNameIcon();
|
updateNameIcon();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setIconSelectorBackground(ImageView backgroundCircle) {
|
||||||
|
AndroidUtils.setBackground(backgroundCircle,
|
||||||
|
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)));
|
||||||
|
}
|
||||||
|
|
||||||
private void updateNameIcon() {
|
private void updateNameIcon() {
|
||||||
if (nameIcon != null) {
|
if (nameIcon != null) {
|
||||||
nameIcon.setImageDrawable(getNameIcon());
|
nameIcon.setImageDrawable(getNameIcon());
|
||||||
|
@ -652,11 +671,11 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
|
|
||||||
public abstract int getCategoryColor(String category);
|
public abstract int getCategoryColor(String category);
|
||||||
|
|
||||||
public abstract int getCategoryPoints(String category);
|
public abstract int getCategoryPointsCount(String category);
|
||||||
|
|
||||||
public abstract void setColor(int color);
|
public abstract void setColor(int color);
|
||||||
|
|
||||||
public abstract void setBackgroundType(FavouritePoint.BackgroundType backgroundType);
|
public abstract void setBackgroundType(BackgroundType backgroundType);
|
||||||
|
|
||||||
public abstract void setIcon(int iconId);
|
public abstract void setIcon(int iconId);
|
||||||
|
|
||||||
|
@ -674,7 +693,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
|
|
||||||
public abstract int getPointColor();
|
public abstract int getPointColor();
|
||||||
|
|
||||||
public abstract FavouritePoint.BackgroundType getBackgroundType();
|
public abstract BackgroundType getBackgroundType();
|
||||||
|
|
||||||
public abstract int getIconId();
|
public abstract int getIconId();
|
||||||
|
|
||||||
|
@ -776,7 +795,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
int color = categoryColor == 0 ? getDefaultColor() : categoryColor;
|
int color = categoryColor == 0 ? getDefaultColor() : categoryColor;
|
||||||
holder.groupIcon.setImageDrawable(UiUtilities.tintDrawable(
|
holder.groupIcon.setImageDrawable(UiUtilities.tintDrawable(
|
||||||
ContextCompat.getDrawable(app, R.drawable.ic_action_folder), color));
|
ContextCompat.getDrawable(app, R.drawable.ic_action_folder), color));
|
||||||
holder.pointsCounter.setText(String.valueOf(getCategoryPoints(group)));
|
holder.pointsCounter.setText(String.valueOf(getCategoryPointsCount(group)));
|
||||||
int strokeColor;
|
int strokeColor;
|
||||||
int strokeWidth;
|
int strokeWidth;
|
||||||
if (selectedItemName != null && selectedItemName.equals(items.get(position))) {
|
if (selectedItemName != null && selectedItemName.equals(items.get(position))) {
|
||||||
|
@ -784,17 +803,20 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
R.color.active_color_primary_dark : R.color.active_color_primary_light);
|
R.color.active_color_primary_dark : R.color.active_color_primary_light);
|
||||||
strokeWidth = 2;
|
strokeWidth = 2;
|
||||||
} else {
|
} else {
|
||||||
strokeColor = ContextCompat.getColor(app, R.color.divider_color_light);
|
strokeColor = ContextCompat.getColor(app, nightMode ? R.color.stroked_buttons_and_links_outline_dark
|
||||||
|
: R.color.stroked_buttons_and_links_outline_light);
|
||||||
strokeWidth = 1;
|
strokeWidth = 1;
|
||||||
}
|
}
|
||||||
GradientDrawable rectContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app, R.drawable.bg_select_group_button_outline);
|
GradientDrawable rectContourDrawable = (GradientDrawable) ContextCompat.getDrawable(app,
|
||||||
|
R.drawable.bg_select_group_button_outline);
|
||||||
if (rectContourDrawable != null) {
|
if (rectContourDrawable != null) {
|
||||||
rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, strokeWidth), strokeColor);
|
rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, strokeWidth), strokeColor);
|
||||||
holder.groupButton.setImageDrawable(rectContourDrawable);
|
holder.groupButton.setImageDrawable(rectContourDrawable);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
|
||||||
AndroidUtils.setBackground(app, holder.groupButton, nightMode, R.drawable.ripple_solid_light, R.drawable.ripple_solid_dark);
|
AndroidUtils.setBackground(app, holder.groupButton, nightMode, R.drawable.ripple_solid_light_6dp,
|
||||||
|
R.drawable.ripple_solid_dark_6dp);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -833,7 +855,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class GroupNameAdapter extends RecyclerView.Adapter<NameViewHolder> {
|
class IconCategoriesAdapter extends RecyclerView.Adapter<NameViewHolder> {
|
||||||
|
|
||||||
List<String> items;
|
List<String> items;
|
||||||
|
|
||||||
|
@ -862,11 +884,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
textView.setTextColor(ContextCompat.getColor(app, R.color.preference_category_title));
|
textView.setTextColor(ContextCompat.getColor(app, R.color.preference_category_title));
|
||||||
GradientDrawable buttonBackground = (GradientDrawable) ContextCompat.getDrawable(app,
|
GradientDrawable buttonBackground = (GradientDrawable) ContextCompat.getDrawable(app,
|
||||||
R.drawable.bg_select_icon_group_button).mutate();
|
R.drawable.bg_select_icon_group_button).mutate();
|
||||||
buttonBackground.setStroke(AndroidUtils.dpToPx(app, 1), ContextCompat.getColor(app, R.color.divider_color_light));
|
buttonBackground.setStroke(AndroidUtils.dpToPx(app, 1), ContextCompat.getColor(app,
|
||||||
|
nightMode ? R.color.stroked_buttons_and_links_outline_dark
|
||||||
|
: R.color.stroked_buttons_and_links_outline_light));
|
||||||
buttonBackground.setColor(ContextCompat.getColor(app, R.color.color_transparent));
|
buttonBackground.setColor(ContextCompat.getColor(app, R.color.color_transparent));
|
||||||
AndroidUtils.setBackground(holder.button, buttonBackground);
|
AndroidUtils.setBackground(holder.button, buttonBackground);
|
||||||
}
|
}
|
||||||
textView.setText(category);
|
textView.setText(capitalizeFirstLetter(category));
|
||||||
holder.button.setOnClickListener(new View.OnClickListener() {
|
holder.button.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -886,6 +910,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
|
||||||
static class NameViewHolder extends RecyclerView.ViewHolder {
|
static class NameViewHolder extends RecyclerView.ViewHolder {
|
||||||
final TextView buttonText;
|
final TextView buttonText;
|
||||||
final LinearLayout button;
|
final LinearLayout button;
|
||||||
|
|
||||||
NameViewHolder(@NonNull View itemView) {
|
NameViewHolder(@NonNull View itemView) {
|
||||||
super(itemView);
|
super(itemView);
|
||||||
buttonText = itemView.findViewById(R.id.button_text);
|
buttonText = itemView.findViewById(R.id.button_text);
|
||||||
|
|
|
@ -31,6 +31,7 @@ import net.osmand.plus.mapcontextmenu.editors.WptPtEditor.OnDismissListener;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
|
@ -449,7 +450,14 @@ public class WptPtEditorFragmentNew extends PointEditorFragmentNew {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getCategoryPoints(String category) {
|
public int getCategoryPointsCount(String category) {
|
||||||
|
WptPtEditor editor = getWptPtEditor();
|
||||||
|
if (editor != null) {
|
||||||
|
List<WptPt> points = editor.getGpxFile().getPointsByCategories().get(category);
|
||||||
|
if (points != null) {
|
||||||
|
return points.size();
|
||||||
|
}
|
||||||
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue