Fix transparency in the favorites.gpx

This commit is contained in:
Dima-1 2020-04-16 13:58:35 +03:00
parent 1e6c829bdf
commit a50c15a11c
6 changed files with 42 additions and 19 deletions

View file

@ -11,6 +11,7 @@
Thx - Hardy
-->
<string name="custom_color">Custom color</string>
<string name="wiki_menu_download_descr">Additional maps are needed to view Wikipedia POIs on the map.</string>
<string name="wikipedia_poi_languages_promo">Some Wikipedia articles may not be available in your name, select the languages in which Wikipedia articles will appear on the map.\nYou will be able to switch between all available languages while reading the article.</string>
<string name="shared_string_all_languages">All languages</string>

View file

@ -77,7 +77,11 @@ public class FavouritePoint implements Serializable, LocationPoint {
}
public int getColor() {
return color;
if ((color & 0xFF000000) != 0) {
return color;
} else {
return color | 0xFF000000;
}
}
public String getAddress() {

View file

@ -101,7 +101,11 @@ public class FavouritesDbHelper {
}
public int getColor() {
return color;
if ((color & 0xFF000000) != 0) {
return color;
} else {
return color | 0xFF000000;
}
}
public boolean isVisible() {

View file

@ -840,7 +840,7 @@ public class FavoritesTreeFragment extends OsmandExpandableListFragment implemen
int color = model.getColor() == 0 || model.getColor() == Color.BLACK ? getResources().getColor(R.color.color_favorite) : model.getColor();
if (!model.isPersonal()) {
setCategoryIcon(app, app.getUIUtilities().getPaintedIcon(
R.drawable.ic_action_folder, visible ? (color | 0xff000000) : getResources().getColor(disabledColor)),
R.drawable.ic_action_folder, visible ? color : getResources().getColor(disabledColor)),
groupPosition, isExpanded, row, light);
}
adjustIndicator(app, groupPosition, isExpanded, row, light);

View file

@ -14,7 +14,7 @@ import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.TextView;
import androidx.annotation.ColorRes;
import androidx.annotation.ColorInt;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
@ -44,17 +44,17 @@ public class ColorDialogs {
};
public static int[] pallette = new int[] {
0xb4eecc22,
0xb4d00d0d,
0xb4ff5020,
0xb4eeee10,
0xb488e030,
0xb400842b,
0xb410c0f0,
0xb41010a0,
0xb4a71de1,
0xb4e044bb,
0xb48e2512,
0xffeecc22,
0xffd00d0d,
0xffff5020,
0xffeeee10,
0xff88e030,
0xff00842b,
0xff10c0f0,
0xff1010a0,
0xffa71de1,
0xffe044bb,
0xff8e2512,
0xff000001
};
@ -243,8 +243,8 @@ public class ColorDialogs {
return d;
}
public static int getColorName(@ColorRes int color) {
int colorName = R.string.rendering_value_darkyellow_name;
public static int getColorName(@ColorInt int color) {
int colorName = R.string.custom_color;
for (int i = 0; i < ColorDialogs.pallette.length; i++) {
if (ColorDialogs.pallette[i] == color) {
colorName = ColorDialogs.paletteColors[i];
@ -262,4 +262,15 @@ public class ColorDialogs {
r.getDisplayMetrics()
);
}
public static boolean isPaletteColor(@ColorInt int color) {
boolean isPaletteColor = false;
for (int i = 0; i < ColorDialogs.pallette.length; i++) {
if (ColorDialogs.pallette[i] == color) {
isPaletteColor = true;
break;
}
}
return isPaletteColor;
}
}

View file

@ -24,7 +24,6 @@ import android.widget.ScrollView;
import android.widget.TextView;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DrawableRes;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.Toolbar;
@ -312,9 +311,13 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
for (int color : ColorDialogs.pallette) {
selectColor.addView(createColorItemView(color, selectColor), new FlowLayout.LayoutParams(0, 0));
}
int customColor = getPointColor();
if (!ColorDialogs.isPaletteColor(customColor)) {
selectColor.addView(createColorItemView(customColor, selectColor), new FlowLayout.LayoutParams(0, 0));
}
}
private View createColorItemView(@ColorRes final int color, final FlowLayout rootView) {
private View createColorItemView(@ColorInt final int color, final FlowLayout rootView) {
FrameLayout colorItemView = (FrameLayout) UiUtilities.getInflater(getContext(), nightMode)
.inflate(R.layout.point_editor_button, rootView, false);
ImageView outline = colorItemView.findViewById(R.id.outline);