Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/mapsme/omim.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaria Volvenkova <d.volvenkova@corp.mail.ru>2018-04-03 15:05:09 +0300
committerRoman Kuznetsov <r.kuznetsow@gmail.com>2018-04-06 15:59:42 +0300
commit5a53eed0629cc1dd995cacfe0e04d0fb642d7afe (patch)
tree9d6b89eae08e4e4c5d3248bb890904cf62bcfd18 /android/src
parent33d9a07005a2e158c7cd2a945f5ab4e226d8205b (diff)
Minor Android fixes.
Diffstat (limited to 'android/src')
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java39
-rw-r--r--android/src/com/mapswithme/maps/bookmarks/data/Icon.java25
2 files changed, 36 insertions, 28 deletions
diff --git a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java
index 6404b2c9a3..326fc8e065 100644
--- a/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java
+++ b/android/src/com/mapswithme/maps/bookmarks/data/BookmarkManager.java
@@ -57,37 +57,20 @@ public enum BookmarkManager
@NonNull
private List<BookmarksCloudListener> mCloudListeners = new ArrayList<>();
-
- @Retention(RetentionPolicy.SOURCE)
- @IntDef({ PREDEFINED_COLOR_NONE, PREDEFINED_COLOR_RED, PREDEFINED_COLOR_BLUE,
- PREDEFINED_COLOR_PURPLE, PREDEFINED_COLOR_YELLOW, PREDEFINED_COLOR_PINK,
- PREDEFINED_COLOR_BROWN, PREDEFINED_COLOR_GREEN, PREDEFINED_COLOR_ORANGE })
-
- public @interface PredefinedColor {}
-
- public static final int PREDEFINED_COLOR_NONE = 0;
- public static final int PREDEFINED_COLOR_RED = 1;
- public static final int PREDEFINED_COLOR_BLUE = 2;
- public static final int PREDEFINED_COLOR_PURPLE = 3;
- public static final int PREDEFINED_COLOR_YELLOW = 4;
- public static final int PREDEFINED_COLOR_PINK = 5;
- public static final int PREDEFINED_COLOR_BROWN = 6;
- public static final int PREDEFINED_COLOR_GREEN = 7;
- public static final int PREDEFINED_COLOR_ORANGE = 8;
-
+
static
{
- ICONS.add(new Icon("placemark-red", PREDEFINED_COLOR_RED, R.drawable.ic_bookmark_marker_red_off, R.drawable.ic_bookmark_marker_red_on));
- ICONS.add(new Icon("placemark-blue", PREDEFINED_COLOR_BLUE, R.drawable.ic_bookmark_marker_blue_off, R.drawable.ic_bookmark_marker_blue_on));
- ICONS.add(new Icon("placemark-purple", PREDEFINED_COLOR_PURPLE, R.drawable.ic_bookmark_marker_purple_off, R.drawable.ic_bookmark_marker_purple_on));
- ICONS.add(new Icon("placemark-yellow", PREDEFINED_COLOR_YELLOW, R.drawable.ic_bookmark_marker_yellow_off, R.drawable.ic_bookmark_marker_yellow_on));
- ICONS.add(new Icon("placemark-pink", PREDEFINED_COLOR_PINK, R.drawable.ic_bookmark_marker_pink_off, R.drawable.ic_bookmark_marker_pink_on));
- ICONS.add(new Icon("placemark-brown", PREDEFINED_COLOR_BROWN, R.drawable.ic_bookmark_marker_brown_off, R.drawable.ic_bookmark_marker_brown_on));
- ICONS.add(new Icon("placemark-green", PREDEFINED_COLOR_GREEN, R.drawable.ic_bookmark_marker_green_off, R.drawable.ic_bookmark_marker_green_on));
- ICONS.add(new Icon("placemark-orange", PREDEFINED_COLOR_ORANGE, R.drawable.ic_bookmark_marker_orange_off, R.drawable.ic_bookmark_marker_orange_on));
+ ICONS.add(new Icon("placemark-red", Icon.PREDEFINED_COLOR_RED, R.drawable.ic_bookmark_marker_red_off, R.drawable.ic_bookmark_marker_red_on));
+ ICONS.add(new Icon("placemark-blue", Icon.PREDEFINED_COLOR_BLUE, R.drawable.ic_bookmark_marker_blue_off, R.drawable.ic_bookmark_marker_blue_on));
+ ICONS.add(new Icon("placemark-purple", Icon.PREDEFINED_COLOR_PURPLE, R.drawable.ic_bookmark_marker_purple_off, R.drawable.ic_bookmark_marker_purple_on));
+ ICONS.add(new Icon("placemark-yellow", Icon.PREDEFINED_COLOR_YELLOW, R.drawable.ic_bookmark_marker_yellow_off, R.drawable.ic_bookmark_marker_yellow_on));
+ ICONS.add(new Icon("placemark-pink", Icon.PREDEFINED_COLOR_PINK, R.drawable.ic_bookmark_marker_pink_off, R.drawable.ic_bookmark_marker_pink_on));
+ ICONS.add(new Icon("placemark-brown", Icon.PREDEFINED_COLOR_BROWN, R.drawable.ic_bookmark_marker_brown_off, R.drawable.ic_bookmark_marker_brown_on));
+ ICONS.add(new Icon("placemark-green", Icon.PREDEFINED_COLOR_GREEN, R.drawable.ic_bookmark_marker_green_off, R.drawable.ic_bookmark_marker_green_on));
+ ICONS.add(new Icon("placemark-orange", Icon.PREDEFINED_COLOR_ORANGE, R.drawable.ic_bookmark_marker_orange_off, R.drawable.ic_bookmark_marker_orange_on));
}
- static Icon getIconByColor(int color)
+ static Icon getIconByColor(@Icon.PredefinedColor int color)
{
for (Icon icon : ICONS)
{
@@ -334,6 +317,7 @@ public enum BookmarkManager
public long getLastEditedCategory() { return nativeGetLastEditedCategory(); }
+ @Icon.PredefinedColor
public int getLastEditedColor() { return nativeGetLastEditedColor(); }
public void setCloudEnabled(boolean enabled) { nativeSetCloudEnabled(enabled); }
@@ -470,6 +454,7 @@ public enum BookmarkManager
private native long nativeGetLastEditedCategory();
+ @Icon.PredefinedColor
private native int nativeGetLastEditedColor();
private native void nativeSetCloudEnabled(boolean enabled);
diff --git a/android/src/com/mapswithme/maps/bookmarks/data/Icon.java b/android/src/com/mapswithme/maps/bookmarks/data/Icon.java
index 3d89451c12..5ae7ac73ff 100644
--- a/android/src/com/mapswithme/maps/bookmarks/data/Icon.java
+++ b/android/src/com/mapswithme/maps/bookmarks/data/Icon.java
@@ -1,14 +1,35 @@
package com.mapswithme.maps.bookmarks.data;
+import android.support.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
public class Icon
{
+ @Retention(RetentionPolicy.SOURCE)
+ @IntDef({ PREDEFINED_COLOR_NONE, PREDEFINED_COLOR_RED, PREDEFINED_COLOR_BLUE,
+ PREDEFINED_COLOR_PURPLE, PREDEFINED_COLOR_YELLOW, PREDEFINED_COLOR_PINK,
+ PREDEFINED_COLOR_BROWN, PREDEFINED_COLOR_GREEN, PREDEFINED_COLOR_ORANGE })
+ public @interface PredefinedColor {}
+
+ public static final int PREDEFINED_COLOR_NONE = 0;
+ public static final int PREDEFINED_COLOR_RED = 1;
+ public static final int PREDEFINED_COLOR_BLUE = 2;
+ public static final int PREDEFINED_COLOR_PURPLE = 3;
+ public static final int PREDEFINED_COLOR_YELLOW = 4;
+ public static final int PREDEFINED_COLOR_PINK = 5;
+ public static final int PREDEFINED_COLOR_BROWN = 6;
+ public static final int PREDEFINED_COLOR_GREEN = 7;
+ public static final int PREDEFINED_COLOR_ORANGE = 8;
+
private final String mName;
+ @PredefinedColor
private final int mColor;
private final int mResId;
private final int mSelectedResId;
- public Icon(String Name, int color, int resId, int selectedResId)
+ public Icon(String Name, @PredefinedColor int color, int resId, int selectedResId)
{
mName = Name;
mColor = color;
@@ -16,6 +37,7 @@ public class Icon
mSelectedResId = selectedResId;
}
+ @PredefinedColor
public int getColor()
{
return mColor;
@@ -46,6 +68,7 @@ public class Icon
}
@Override
+ @PredefinedColor
public int hashCode()
{
return mColor;