Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
02ffbd80f7
12 changed files with 2237 additions and 45 deletions
18
OsmAnd/res/layout/favorite_categories_dialog.xml
Normal file
18
OsmAnd/res/layout/favorite_categories_dialog.xml
Normal file
|
@ -0,0 +1,18 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="@dimen/dialog_content_bottom_margin"
|
||||
android:paddingLeft="@dimen/dialog_content_margin"
|
||||
android:paddingRight="@dimen/dialog_content_margin"
|
||||
android:paddingTop="@dimen/dialog_content_bottom_margin">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/list_container"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</ScrollView>
|
30
OsmAnd/res/layout/favorite_category_dialog_item.xml
Normal file
30
OsmAnd/res/layout/favorite_category_dialog_item.xml
Normal file
|
@ -0,0 +1,30 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="44dp"
|
||||
android:layout_height="50dp">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/image_view"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:scaleType="center"
|
||||
android:src="@drawable/ic_action_folder"/>
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@color/color_transparent"
|
||||
android:text="Restaurant"
|
||||
android:gravity="left|center_vertical"
|
||||
android:textSize="@dimen/default_list_text_size"
|
||||
android:textAllCaps="false"/>
|
||||
|
||||
</LinearLayout>
|
|
@ -114,6 +114,7 @@
|
|||
android:layout_marginLeft="8dp"
|
||||
android:textColor="?android:textColorPrimary"
|
||||
android:textColorHint="?android:textColorSecondary"
|
||||
android:text="Name"
|
||||
android:inputType="text"/>
|
||||
|
||||
|
||||
|
@ -167,7 +168,9 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginRight="16dp"
|
||||
android:layout_marginLeft="8dp"/>
|
||||
android:layout_marginLeft="8dp"
|
||||
android:completionThreshold="1"
|
||||
android:drawableRight="@drawable/ic_action_arrow_drop_down"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<?xml version='1.0' encoding='utf-8'?>
|
||||
<resources>
|
||||
<!--
|
||||
Disclaimer:
|
||||
|
@ -9,6 +9,8 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="favorite_category_add_new">Add new</string>
|
||||
<string name="favorite_category_select">Select category</string>
|
||||
<string name="default_speed_system_descr">Define speed measurement system</string>
|
||||
<string name="default_speed_system">Speed measurement</string>
|
||||
<string name="nm">nm</string>
|
||||
|
|
2002
OsmAnd/res/values/strings.xml.orig
Normal file
2002
OsmAnd/res/values/strings.xml.orig
Normal file
File diff suppressed because it is too large
Load diff
|
@ -435,6 +435,14 @@ public class FavouritesDbHelper {
|
|||
}
|
||||
}
|
||||
|
||||
public FavoriteGroup getGroup(String name) {
|
||||
if (flatGroups.containsKey(name)) {
|
||||
return flatGroups.get(name);
|
||||
} else {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
private FavouritePoint findFavoriteByAllProperties(String category, String name, double lat, double lon){
|
||||
if (flatGroups.containsKey(category)) {
|
||||
FavoriteGroup fg = flatGroups.get(category);
|
||||
|
|
|
@ -59,7 +59,7 @@ public class IndexItemCategoryWithSubcat implements Comparable<IndexItemCategory
|
|||
|
||||
public static List<IndexItemCategoryWithSubcat> categorizeIndexItems(final OsmandApplication ctx,
|
||||
Collection<IndexItem> indexItems) {
|
||||
boolean skipWiki = Version.isFreeVersion(ctx);
|
||||
boolean skipWiki = Version.isFreeVersion(ctx);NewLocalIndexesFragment
|
||||
final Map<String, IndexItemCategoryWithSubcat> cats = new TreeMap<>();
|
||||
ArrayList<IndexItemCategoryWithSubcat> mainList = new ArrayList<>();
|
||||
for (IndexItem i : indexItems) {
|
||||
|
|
|
@ -3,6 +3,7 @@ package net.osmand.plus.mapcontextmenu.details;
|
|||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.text.Html;
|
||||
import android.text.TextUtils;
|
||||
import android.text.util.Linkify;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
|
@ -79,9 +80,10 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
|||
|
||||
textView.setAutoLinkMask(Linkify.ALL);
|
||||
textView.setLinksClickable(true);
|
||||
textView.setEllipsize(TextUtils.TruncateAt.END);
|
||||
if (isWiki) {
|
||||
textView.setMinLines(1);
|
||||
textView.setMaxLines(5);
|
||||
textView.setMaxLines(15);
|
||||
}
|
||||
textView.setText(text);
|
||||
if (textColor > 0) {
|
||||
|
|
|
@ -3,7 +3,6 @@ package net.osmand.plus.mapcontextmenu.editors;
|
|||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
|
@ -11,6 +10,7 @@ import android.os.Bundle;
|
|||
import net.osmand.data.FavouritePoint;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.FavouritesDbHelper.FavoriteGroup;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -21,9 +21,11 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
|
||||
private FavoritePointEditor editor;
|
||||
private FavouritePoint favorite;
|
||||
private FavoriteGroup group;
|
||||
FavouritesDbHelper helper;
|
||||
|
||||
private boolean saved;
|
||||
private int defaultColor;
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
|
@ -35,7 +37,12 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
boolean light = getMyApplication().getSettings().isLightContent();
|
||||
defaultColor = light ? R.color.icon_color : R.color.icon_color_light;
|
||||
|
||||
favorite = editor.getFavorite();
|
||||
group = helper.getGroup(favorite);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -52,6 +59,12 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCategory(String name) {
|
||||
group = helper.getGroup(name);
|
||||
super.setCategory(name);
|
||||
}
|
||||
|
||||
public static void showInstance(final MapActivity mapActivity) {
|
||||
FavoritePointEditor editor = mapActivity.getFavoritePointEditor();
|
||||
//int slideInAnim = editor.getSlideInAnimation();
|
||||
|
@ -71,8 +84,8 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
|
||||
@Override
|
||||
protected void save(final boolean needDismiss) {
|
||||
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(), getName(), getCategory());
|
||||
point.setDescription(getDescription());
|
||||
final FavouritePoint point = new FavouritePoint(favorite.getLatitude(), favorite.getLongitude(), getNameTextValue(), getCategoryTextValue());
|
||||
point.setDescription(getDescriptionTextValue());
|
||||
AlertDialog.Builder builder = FavouritesDbHelper.checkDuplicates(point, helper, getMapActivity());
|
||||
|
||||
if (favorite.getName().equals(point.getName()) &&
|
||||
|
@ -125,7 +138,6 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
|
||||
@Override
|
||||
protected void delete(final boolean needDismiss) {
|
||||
final Resources resources = this.getResources();
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setMessage(getString(R.string.favourites_remove_dialog_msg, favorite.getName()));
|
||||
builder.setNegativeButton(R.string.shared_string_no, null);
|
||||
|
@ -143,39 +155,41 @@ public class FavoritePointEditorFragment extends PointEditorFragment {
|
|||
}
|
||||
|
||||
@Override
|
||||
public String getHeaderText() {
|
||||
public String getHeaderCaption() {
|
||||
return getMapActivity().getResources().getString(R.string.favourites_edit_dialog_title);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getNameValue() {
|
||||
public String getNameInitValue() {
|
||||
return favorite.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCategoryValue() {
|
||||
public String getCategoryInitValue() {
|
||||
return favorite.getCategory();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getDescriptionValue() {
|
||||
public String getDescriptionInitValue() {
|
||||
return favorite.getDescription();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getNameIcon() {
|
||||
return FavoriteImageDrawable.getOrCreate(getMapActivity(), favorite.getColor(), getMapActivity().getMapView().getCurrentRotatedTileBox().getDensity());
|
||||
int color = defaultColor;
|
||||
if (group != null) {
|
||||
color = group.color;
|
||||
}
|
||||
return FavoriteImageDrawable.getOrCreate(getMapActivity(), color, getMapActivity().getMapView().getCurrentRotatedTileBox().getDensity());
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getCategoryIcon() {
|
||||
FavouritesDbHelper helper = getMyApplication().getFavorites();
|
||||
FavouritesDbHelper.FavoriteGroup group = helper.getGroup(favorite);
|
||||
int color = defaultColor;
|
||||
if (group != null) {
|
||||
return getIcon(R.drawable.ic_action_folder_stroke, group.color);
|
||||
} else {
|
||||
return null;
|
||||
color = group.color;
|
||||
}
|
||||
return getIcon(R.drawable.ic_action_folder_stroke, color);
|
||||
}
|
||||
|
||||
public Drawable getIcon(int resId, int color) {
|
||||
|
|
|
@ -1,27 +1,25 @@
|
|||
package net.osmand.plus.mapcontextmenu.editors;
|
||||
|
||||
import android.annotation.TargetApi;
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.res.Resources;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.TypedValue;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.ScrollView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
|
@ -29,7 +27,7 @@ import net.osmand.plus.IconsCache;
|
|||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapcontextmenu.editors.dialogs.SelectCategoryDialogFragment;
|
||||
import net.osmand.plus.widgets.AutoCompleteTextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -99,16 +97,16 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
}
|
||||
|
||||
TextView headerCaption = (TextView) view.findViewById(R.id.header_caption);
|
||||
headerCaption.setText(getHeaderText());
|
||||
headerCaption.setText(getHeaderCaption());
|
||||
TextView nameCaption = (TextView) view.findViewById(R.id.name_caption);
|
||||
nameCaption.setText(getNameText());
|
||||
nameCaption.setText(getNameCaption());
|
||||
TextView categoryCaption = (TextView) view.findViewById(R.id.category_caption);
|
||||
categoryCaption.setText(getCategoryText());
|
||||
categoryCaption.setText(getCategoryCaption());
|
||||
|
||||
EditText nameEdit = (EditText) view.findViewById(R.id.name_edit);
|
||||
nameEdit.setText(getNameValue());
|
||||
nameEdit.setText(getNameInitValue());
|
||||
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) view.findViewById(R.id.category_edit);
|
||||
categoryEdit.setText(getCategoryValue());
|
||||
categoryEdit.setText(getCategoryInitValue());
|
||||
categoryEdit.setThreshold(1);
|
||||
final FavouritesDbHelper helper = getMyApplication().getFavorites();
|
||||
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
|
||||
|
@ -117,10 +115,29 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
list[i] =gs.get(i).name;
|
||||
}
|
||||
categoryEdit.setAdapter(new ArrayAdapter<>(getMapActivity(), R.layout.list_textview, list));
|
||||
categoryEdit.setOnTouchListener(new View.OnTouchListener() {
|
||||
@Override
|
||||
public boolean onTouch(final View v, MotionEvent event) {
|
||||
final EditText editText = (EditText) v;
|
||||
final int DRAWABLE_RIGHT = 2;
|
||||
if (event.getAction() == MotionEvent.ACTION_UP) {
|
||||
if (event.getX() >= (editText.getRight()
|
||||
- editText.getCompoundDrawables()[DRAWABLE_RIGHT].getBounds().width()
|
||||
- editText.getPaddingRight())) {
|
||||
|
||||
DialogFragment dialogFragment =
|
||||
SelectCategoryDialogFragment.createInstance();
|
||||
dialogFragment.show(getChildFragmentManager(), "SelectCategoryDialogFragment");
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
EditText descriptionEdit = (EditText) view.findViewById(R.id.description_edit);
|
||||
if (getDescriptionValue() != null) {
|
||||
descriptionEdit.setText(getDescriptionValue());
|
||||
if (getDescriptionInitValue() != null) {
|
||||
descriptionEdit.setText(getDescriptionInitValue());
|
||||
}
|
||||
|
||||
ImageView nameImage = (ImageView) view.findViewById(R.id.name_image);
|
||||
|
@ -172,9 +189,15 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
}
|
||||
|
||||
public abstract PointEditor getEditor();
|
||||
|
||||
public abstract String getToolbarTitle();
|
||||
|
||||
public void setCategory(String name) {
|
||||
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) getView().findViewById(R.id.category_edit);
|
||||
categoryEdit.setText(name);
|
||||
ImageView categoryImage = (ImageView) getView().findViewById(R.id.category_image);
|
||||
categoryImage.setImageDrawable(getCategoryIcon());
|
||||
}
|
||||
|
||||
protected MapActivity getMapActivity() {
|
||||
return (MapActivity)getActivity();
|
||||
}
|
||||
|
@ -201,33 +224,33 @@ public abstract class PointEditorFragment extends Fragment {
|
|||
}
|
||||
}
|
||||
|
||||
public abstract String getHeaderText();
|
||||
public abstract String getHeaderCaption();
|
||||
|
||||
public String getNameText() {
|
||||
public String getNameCaption() {
|
||||
return getMapActivity().getResources().getString(R.string.favourites_edit_dialog_name);
|
||||
}
|
||||
public String getCategoryText() {
|
||||
public String getCategoryCaption() {
|
||||
return getMapActivity().getResources().getString(R.string.favourites_edit_dialog_category);
|
||||
}
|
||||
|
||||
public abstract String getNameValue();
|
||||
public abstract String getCategoryValue();
|
||||
public abstract String getDescriptionValue();
|
||||
public abstract String getNameInitValue();
|
||||
public abstract String getCategoryInitValue();
|
||||
public abstract String getDescriptionInitValue();
|
||||
|
||||
public abstract Drawable getNameIcon();
|
||||
public abstract Drawable getCategoryIcon();
|
||||
|
||||
public String getName() {
|
||||
public String getNameTextValue() {
|
||||
EditText nameEdit = (EditText) getView().findViewById(R.id.name_edit);
|
||||
return nameEdit.getText().toString().trim();
|
||||
}
|
||||
|
||||
public String getCategory() {
|
||||
public String getCategoryTextValue() {
|
||||
AutoCompleteTextViewEx categoryEdit = (AutoCompleteTextViewEx) getView().findViewById(R.id.category_edit);
|
||||
return categoryEdit.getText().toString().trim();
|
||||
}
|
||||
|
||||
public String getDescription() {
|
||||
public String getDescriptionTextValue() {
|
||||
EditText descriptionEdit = (EditText) getView().findViewById(R.id.description_edit);
|
||||
String res = descriptionEdit.getText().toString().trim();
|
||||
return Algorithms.isEmpty(res) ? null : res;
|
||||
|
|
|
@ -1,5 +0,0 @@
|
|||
package net.osmand.plus.mapcontextmenu.editors.dialogs;
|
||||
|
||||
public class CategoryDialogs {
|
||||
|
||||
}
|
|
@ -0,0 +1,95 @@
|
|||
package net.osmand.plus.mapcontextmenu.editors.dialogs;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Dialog;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import net.osmand.plus.FavouritesDbHelper;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.mapcontextmenu.editors.PointEditorFragment;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
public class SelectCategoryDialogFragment extends DialogFragment {
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Dialog onCreateDialog(Bundle savedInstanceState) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getActivity());
|
||||
builder.setTitle(R.string.favorite_category_select);
|
||||
final View v = getActivity().getLayoutInflater().inflate(R.layout.favorite_categories_dialog, null, false);
|
||||
|
||||
LinearLayout ll = (LinearLayout) v.findViewById(R.id.list_container);
|
||||
|
||||
final FavouritesDbHelper helper = ((OsmandApplication) getActivity().getApplication()).getFavorites();
|
||||
List<FavouritesDbHelper.FavoriteGroup> gs = helper.getFavoriteGroups();
|
||||
for (final FavouritesDbHelper.FavoriteGroup category : gs) {
|
||||
View itemView = getActivity().getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
|
||||
ImageView icon = (ImageView)itemView.findViewById(R.id.image_view);
|
||||
if (category.color != 0) {
|
||||
icon.setImageDrawable(getIcon(getActivity(), R.drawable.ic_action_folder, category.color));
|
||||
} else {
|
||||
icon.setImageDrawable(getIcon(getActivity(), R.drawable.ic_action_folder));
|
||||
}
|
||||
Button button = (Button)itemView.findViewById(R.id.button);
|
||||
button.setText(category.name);
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
((PointEditorFragment) getParentFragment()).setCategory(category.name);
|
||||
dismiss();
|
||||
}
|
||||
});
|
||||
ll.addView(itemView);
|
||||
}
|
||||
View itemView = getActivity().getLayoutInflater().inflate(R.layout.favorite_category_dialog_item, null);
|
||||
ImageView icon = (ImageView)itemView.findViewById(R.id.image_view);
|
||||
icon.setImageDrawable(getIcon(getActivity(), R.drawable.map_zoom_in));
|
||||
Button button = (Button)itemView.findViewById(R.id.button);
|
||||
button.setText(getActivity().getResources().getText(R.string.favorite_category_add_new));
|
||||
button.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
//((PointEditorFragment) getParentFragment()).setCategory(null);
|
||||
//dismiss();
|
||||
}
|
||||
});
|
||||
ll.addView(itemView);
|
||||
|
||||
builder.setView(v);
|
||||
builder.setNegativeButton(R.string.shared_string_cancel, null);
|
||||
|
||||
return builder.create();
|
||||
}
|
||||
|
||||
public static SelectCategoryDialogFragment createInstance() {
|
||||
return new SelectCategoryDialogFragment();
|
||||
}
|
||||
|
||||
private static Drawable getIcon(final Activity activity, int iconId) {
|
||||
OsmandApplication app = (OsmandApplication)activity.getApplication();
|
||||
IconsCache iconsCache = app.getIconsCache();
|
||||
boolean light = app.getSettings().isLightContent();
|
||||
return iconsCache.getIcon(iconId,
|
||||
light ? R.color.icon_color : R.color.icon_color_light);
|
||||
}
|
||||
|
||||
private static Drawable getIcon(final Activity activity, int resId, int color) {
|
||||
OsmandApplication app = (OsmandApplication)activity.getApplication();
|
||||
Drawable d = app.getResources().getDrawable(resId).mutate();
|
||||
d.clearColorFilter();
|
||||
d.setColorFilter(color, PorterDuff.Mode.SRC_IN);
|
||||
return d;
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue