Implement custom color (without color picker yet)
This commit is contained in:
parent
0ababa179c
commit
10bab68413
6 changed files with 112 additions and 24 deletions
|
@ -474,7 +474,7 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment implemen
|
|||
if (!ColorDialogs.isPaletteColor(customColor)) {
|
||||
colors.add(customColor);
|
||||
}
|
||||
colorsCard = new ColorsCard(mapActivity, selectedColor, this, colors);
|
||||
colorsCard = new ColorsCard(mapActivity, selectedColor, this, colors, app.getSettings().CUSTOM_TRACK_COLORS, null);
|
||||
colorsCard.setListener(this);
|
||||
LinearLayout selectColor = view.findViewById(R.id.select_color);
|
||||
selectColor.addView(colorsCard.build(view.getContext()));
|
||||
|
|
|
@ -479,6 +479,22 @@ public class ApplicationMode {
|
|||
}
|
||||
}
|
||||
|
||||
public List<String> getCustomIconColors() {
|
||||
return app.getSettings().CUSTOM_ICON_COLORS.getStringsListForProfile(this);
|
||||
}
|
||||
|
||||
public void setCustomIconColors(List<String> customColors) {
|
||||
app.getSettings().CUSTOM_ICON_COLORS.setModeValues(this, customColors);
|
||||
}
|
||||
|
||||
public Integer getCustomIconColorIndex() {
|
||||
return app.getSettings().CUSTOM_ICON_COLOR_INDEX.getModeValue(this);
|
||||
}
|
||||
|
||||
public void setCustomIconColorIndex(int colorIndex) {
|
||||
app.getSettings().CUSTOM_ICON_COLOR_INDEX.setModeValue(this, colorIndex);
|
||||
}
|
||||
|
||||
public int getOrder() {
|
||||
return app.getSettings().APP_MODE_ORDER.getModeValue(this);
|
||||
}
|
||||
|
@ -576,6 +592,8 @@ public class ApplicationMode {
|
|||
mode.setRoutingProfile(builder.routingProfile);
|
||||
mode.setRouteService(builder.routeService);
|
||||
mode.setIconColor(builder.iconColor);
|
||||
mode.setCustomIconColors(builder.customIconColors);
|
||||
mode.setCustomIconColorIndex(builder.customIconColorIndex);
|
||||
mode.setLocationIcon(builder.locationIcon);
|
||||
mode.setNavigationIcon(builder.navigationIcon);
|
||||
mode.setOrder(builder.order);
|
||||
|
@ -693,6 +711,8 @@ public class ApplicationMode {
|
|||
private String routingProfile;
|
||||
private String iconResName;
|
||||
private ProfileIconColors iconColor;
|
||||
private List<String> customIconColors;
|
||||
private int customIconColorIndex;
|
||||
private LocationIcon locationIcon;
|
||||
private NavigationIcon navigationIcon;
|
||||
private int order = -1;
|
||||
|
@ -716,6 +736,8 @@ public class ApplicationMode {
|
|||
applicationMode.setRouteService(routeService);
|
||||
applicationMode.setRoutingProfile(routingProfile);
|
||||
applicationMode.setIconResName(iconResName);
|
||||
applicationMode.setCustomIconColors(customIconColors);
|
||||
applicationMode.setCustomIconColorIndex(customIconColorIndex);
|
||||
applicationMode.setIconColor(iconColor);
|
||||
applicationMode.setLocationIcon(locationIcon);
|
||||
applicationMode.setNavigationIcon(navigationIcon);
|
||||
|
@ -764,6 +786,16 @@ public class ApplicationMode {
|
|||
return this;
|
||||
}
|
||||
|
||||
public ApplicationModeBuilder setCustomIconColors(List<String> customIconColors) {
|
||||
this.customIconColors = customIconColors;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApplicationModeBuilder setCustomIconColorIndex(int index) {
|
||||
this.customIconColorIndex = index;
|
||||
return this;
|
||||
}
|
||||
|
||||
public ApplicationModeBuilder setOrder(int order) {
|
||||
this.order = order;
|
||||
return this;
|
||||
|
|
|
@ -984,6 +984,10 @@ public class OsmandSettings {
|
|||
public final CommonPreference<ProfileIconColors> ICON_COLOR = new EnumStringPreference<>(this,
|
||||
"app_mode_icon_color", ProfileIconColors.DEFAULT, ProfileIconColors.values()).makeProfile().cache();
|
||||
|
||||
public final ListStringPreference CUSTOM_ICON_COLORS = (ListStringPreference) new ListStringPreference(this, "custom_icon_colors", null, ",").makeProfile().cache();
|
||||
|
||||
public final CommonPreference<Integer> CUSTOM_ICON_COLOR_INDEX = new IntPreference(this, "custom_icon_color_index", -1).makeProfile().cache();
|
||||
|
||||
public final CommonPreference<String> USER_PROFILE_NAME = new StringPreference(this, "user_profile_name", "").makeProfile().cache();
|
||||
|
||||
public final CommonPreference<String> PARENT_APP_MODE = new StringPreference(this, "parent_app_mode", null).makeProfile().cache();
|
||||
|
|
|
@ -41,6 +41,7 @@ import net.osmand.AndroidUtils;
|
|||
import net.osmand.IndexConstants;
|
||||
import net.osmand.PlatformUtil;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.settings.backend.backup.ProfileSettingsItem;
|
||||
|
@ -55,6 +56,7 @@ import net.osmand.plus.profiles.SelectProfileBottomSheet;
|
|||
import net.osmand.plus.profiles.SelectProfileBottomSheet.DialogMode;
|
||||
import net.osmand.plus.profiles.SelectProfileBottomSheet.OnSelectProfileCallback;
|
||||
import net.osmand.plus.routing.RouteProvider;
|
||||
import net.osmand.plus.track.ColorsCard;
|
||||
import net.osmand.plus.widgets.FlowLayout;
|
||||
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -64,6 +66,7 @@ import org.apache.commons.logging.Log;
|
|||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.DRAWER_SETTINGS_ID;
|
||||
import static net.osmand.plus.profiles.SelectProfileBottomSheet.PROFILES_LIST_UPDATED_ARG;
|
||||
|
@ -90,6 +93,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
private static final String PROFILE_STRINGKEY_KEY = "profile_stringkey_key";
|
||||
private static final String PROFILE_ICON_RES_KEY = "profile_icon_res_key";
|
||||
private static final String PROFILE_COLOR_KEY = "profile_color_key";
|
||||
private static final String PROFILE_CUSTOM_COLOR_INDEX_KEY = "profile_custom_color_index_key";
|
||||
private static final String PROFILE_PARENT_KEY = "profile_parent_key";
|
||||
private static final String PROFILE_LOCATION_ICON_KEY = "profile_location_icon_key";
|
||||
private static final String PROFILE_NAVIGATION_ICON_KEY = "profile_navigation_icon_key";
|
||||
|
@ -145,6 +149,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
changedProfile.name = profile.name;
|
||||
}
|
||||
changedProfile.color = profile.color;
|
||||
changedProfile.customColorIndex = profile.customColorIndex;
|
||||
changedProfile.iconRes = profile.iconRes;
|
||||
changedProfile.routingProfile = profile.routingProfile;
|
||||
changedProfile.routeService = profile.routeService;
|
||||
|
@ -164,6 +169,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
profile.parent = baseModeForNewProfile.getParent();
|
||||
profile.name = baseModeForNewProfile.toHumanString();
|
||||
profile.color = baseModeForNewProfile.getIconColorInfo();
|
||||
profile.customColorIndex = baseModeForNewProfile.getCustomIconColorIndex();
|
||||
profile.iconRes = baseModeForNewProfile.getIconRes();
|
||||
profile.routingProfile = baseModeForNewProfile.getRoutingProfile();
|
||||
profile.routeService = baseModeForNewProfile.getRouteService();
|
||||
|
@ -300,6 +306,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
outState.putString(PROFILE_STRINGKEY_KEY, changedProfile.stringKey);
|
||||
outState.putInt(PROFILE_ICON_RES_KEY, changedProfile.iconRes);
|
||||
outState.putSerializable(PROFILE_COLOR_KEY, changedProfile.color);
|
||||
outState.putInt(PROFILE_CUSTOM_COLOR_INDEX_KEY, changedProfile.customColorIndex);
|
||||
if (changedProfile.parent != null) {
|
||||
outState.putString(PROFILE_PARENT_KEY, changedProfile.parent.getStringKey());
|
||||
}
|
||||
|
@ -314,6 +321,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
changedProfile.stringKey = savedInstanceState.getString(PROFILE_STRINGKEY_KEY);
|
||||
changedProfile.iconRes = savedInstanceState.getInt(PROFILE_ICON_RES_KEY);
|
||||
changedProfile.color = (ProfileIconColors) savedInstanceState.getSerializable(PROFILE_COLOR_KEY);
|
||||
changedProfile.customColorIndex = savedInstanceState.getInt(PROFILE_CUSTOM_COLOR_INDEX_KEY);
|
||||
String parentStringKey = savedInstanceState.getString(PROFILE_PARENT_KEY);
|
||||
changedProfile.parent = ApplicationMode.valueOfStringKey(parentStringKey, null);
|
||||
isBaseProfileImported = savedInstanceState.getBoolean(IS_BASE_PROFILE_IMPORTED);
|
||||
|
@ -330,7 +338,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
}
|
||||
View profileButton = view.findViewById(R.id.profile_button);
|
||||
if (profileButton != null) {
|
||||
int iconColor = ContextCompat.getColor(app, changedProfile.color.getColor(isNightMode()));
|
||||
int iconColor = changedProfile.getActualColor();
|
||||
AndroidUtils.setBackground(profileButton, UiUtilities.tintDrawable(AppCompatResources.getDrawable(app,
|
||||
R.drawable.circle_background_light), UiUtilities.getColorWithAlpha(iconColor, 0.1f)));
|
||||
ImageView profileIcon = view.findViewById(R.id.profile_icon);
|
||||
|
@ -515,7 +523,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
private void updateProfileNameAppearance() {
|
||||
if (profileName != null) {
|
||||
if (profileName.isFocusable() && profileName.isFocusableInTouchMode()) {
|
||||
int selectedColor = ContextCompat.getColor(app, changedProfile.color.getColor(isNightMode()));
|
||||
int selectedColor = changedProfile.getActualColor();
|
||||
profileNameOtfb.setPrimaryColor(selectedColor);
|
||||
profileName.getBackground().mutate().setColorFilter(selectedColor, PorterDuff.Mode.SRC_ATOP);
|
||||
}
|
||||
|
@ -560,8 +568,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
private View createLocationIconView(final LocationIcon locationIcon, ViewGroup rootView) {
|
||||
FrameLayout locationIconView = (FrameLayout) UiUtilities.getInflater(getContext(), isNightMode())
|
||||
.inflate(R.layout.preference_select_icon_button, rootView, false);
|
||||
int changedProfileColor = ContextCompat.getColor(app, changedProfile.color.getColor(
|
||||
app.getDaynightHelper().isNightModeForMapControls()));
|
||||
int changedProfileColor = changedProfile.getActualColor();
|
||||
LayerDrawable locationIconDrawable = (LayerDrawable) AppCompatResources.getDrawable(app, locationIcon.getIconId());
|
||||
if (locationIconDrawable != null) {
|
||||
DrawableCompat.setTint(DrawableCompat.wrap(locationIconDrawable.getDrawable(1)), changedProfileColor);
|
||||
|
@ -609,7 +616,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
LayerDrawable navigationIconDrawable = (LayerDrawable) AppCompatResources.getDrawable(app, navigationIcon.getIconId());
|
||||
if (navigationIconDrawable != null) {
|
||||
DrawableCompat.setTint(DrawableCompat.wrap(navigationIconDrawable.getDrawable(1)),
|
||||
ContextCompat.getColor(app, changedProfile.color.getColor(app.getDaynightHelper().isNightModeForMapControls())));
|
||||
changedProfile.getActualColor());
|
||||
}
|
||||
ImageView imageView = navigationIconView.findViewById(R.id.icon);
|
||||
imageView.setImageDrawable(navigationIconDrawable);
|
||||
|
@ -634,8 +641,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
});
|
||||
ImageView outlineRect = navigationIconView.findViewById(R.id.outlineRect);
|
||||
GradientDrawable rectContourDrawable = (GradientDrawable) AppCompatResources.getDrawable(app, R.drawable.bg_select_icon_button_outline);
|
||||
int changedProfileColor = ContextCompat.getColor(app, changedProfile.color.getColor(
|
||||
app.getDaynightHelper().isNightModeForMapControls()));
|
||||
int changedProfileColor = changedProfile.getActualColor();
|
||||
if (rectContourDrawable != null) {
|
||||
rectContourDrawable.setStroke(AndroidUtils.dpToPx(app, 2), changedProfileColor);
|
||||
}
|
||||
|
@ -660,13 +666,13 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
}
|
||||
|
||||
private void setIconColor(int iconRes) {
|
||||
int changedProfileColor = ContextCompat.getColor(app, changedProfile.color.getColor(
|
||||
app.getDaynightHelper().isNightModeForMapControls()));
|
||||
int changedProfileColor = changedProfile.getActualColor();
|
||||
View iconItem = iconItems.findViewWithTag(iconRes);
|
||||
if (iconItem != null) {
|
||||
int newColor = changedProfile.getActualColor();
|
||||
AndroidUtils.setBackground(iconItem.findViewById(R.id.background),
|
||||
UiUtilities.tintDrawable(AppCompatResources.getDrawable(app, R.drawable.circle_background_light),
|
||||
UiUtilities.getColorWithAlpha(ContextCompat.getColor(app, changedProfile.color.getColor(isNightMode())), 0.1f)));
|
||||
UiUtilities.getColorWithAlpha(newColor, 0.1f)));
|
||||
ImageView outlineCircle = iconItem.findViewById(R.id.outline);
|
||||
GradientDrawable circleContourDrawable = (GradientDrawable) AppCompatResources.getDrawable(app, R.drawable.circle_contour_bg_light);
|
||||
if (circleContourDrawable != null) {
|
||||
|
@ -775,6 +781,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
mode.setRoutingProfile(changedProfile.routingProfile);
|
||||
mode.setRouteService(changedProfile.routeService);
|
||||
mode.setIconColor(changedProfile.color);
|
||||
mode.setCustomIconColorIndex(changedProfile.customColorIndex);
|
||||
mode.setLocationIcon(changedProfile.locationIcon);
|
||||
mode.setNavigationIcon(changedProfile.navigationIcon);
|
||||
|
||||
|
@ -795,6 +802,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
.setRoutingProfile(changedProfile.routingProfile)
|
||||
.setRouteService(changedProfile.routeService)
|
||||
.setIconColor(changedProfile.color)
|
||||
.setCustomIconColorIndex(changedProfile.customColorIndex)
|
||||
.setLocationIcon(changedProfile.locationIcon)
|
||||
.setNavigationIcon(changedProfile.navigationIcon);
|
||||
|
||||
|
@ -963,12 +971,27 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
ApplicationMode parent = null;
|
||||
String name;
|
||||
ProfileIconColors color;
|
||||
int customColorIndex = -1;
|
||||
int iconRes;
|
||||
String routingProfile;
|
||||
RouteProvider.RouteService routeService;
|
||||
NavigationIcon navigationIcon;
|
||||
LocationIcon locationIcon;
|
||||
|
||||
public int getActualColor() {
|
||||
return customColorIndex != -1 ? customColorIndex : ContextCompat.getColor(app, color.getColor(isNightMode()));
|
||||
}
|
||||
|
||||
public ProfileIconColors getProfileColorByColorValue(int colorValue) {
|
||||
for (ProfileIconColors color : ProfileIconColors.values()) {
|
||||
if (ContextCompat.getColor(app, color.getColor(true)) == colorValue
|
||||
|| ContextCompat.getColor(app, color.getColor(false)) == colorValue) {
|
||||
return color;
|
||||
}
|
||||
}
|
||||
return ProfileIconColors.DEFAULT;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
|
@ -982,6 +1005,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
if (parent != null ? !parent.equals(that.parent) : that.parent != null) return false;
|
||||
if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
||||
if (color != that.color) return false;
|
||||
if (customColorIndex != that.customColorIndex) return false;
|
||||
if (routingProfile != null ? !routingProfile.equals(that.routingProfile) : that.routingProfile != null)
|
||||
return false;
|
||||
if (routeService != that.routeService) return false;
|
||||
|
@ -995,6 +1019,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment implements O
|
|||
result = 31 * result + (parent != null ? parent.hashCode() : 0);
|
||||
result = 31 * result + (name != null ? name.hashCode() : 0);
|
||||
result = 31 * result + (color != null ? color.hashCode() : 0);
|
||||
result = 31 * result + customColorIndex;
|
||||
result = 31 * result + iconRes;
|
||||
result = 31 * result + (routingProfile != null ? routingProfile.hashCode() : 0);
|
||||
result = 31 * result + (routeService != null ? routeService.hashCode() : 0);
|
||||
|
|
|
@ -7,12 +7,6 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.google.android.material.internal.FlowLayout;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
|
@ -22,6 +16,8 @@ import net.osmand.plus.R;
|
|||
import net.osmand.plus.UiUtilities;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.routepreparationmenu.cards.BaseCard;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.ListStringPreference;
|
||||
import net.osmand.plus.track.CustomColorBottomSheet.ColorPickerListener;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -30,6 +26,11 @@ import org.apache.commons.logging.Log;
|
|||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
import androidx.core.content.ContextCompat;
|
||||
import androidx.core.graphics.ColorUtils;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
public class ColorsCard extends BaseCard implements ColorPickerListener {
|
||||
|
||||
public static final int MAX_CUSTOM_COLORS = 6;
|
||||
|
@ -41,6 +42,9 @@ public class ColorsCard extends BaseCard implements ColorPickerListener {
|
|||
|
||||
private Fragment targetFragment;
|
||||
|
||||
private ApplicationMode appMode;
|
||||
private ListStringPreference colorsListPreference;
|
||||
|
||||
private List<Integer> colors;
|
||||
private List<Integer> customColors;
|
||||
|
||||
|
@ -51,12 +55,14 @@ public class ColorsCard extends BaseCard implements ColorPickerListener {
|
|||
return R.layout.colors_card;
|
||||
}
|
||||
|
||||
public ColorsCard(MapActivity mapActivity, int selectedColor, Fragment targetFragment, List<Integer> colors) {
|
||||
public ColorsCard(MapActivity mapActivity, int selectedColor, Fragment targetFragment, List<Integer> colors, ListStringPreference colorsListPreference, ApplicationMode appMode) {
|
||||
super(mapActivity);
|
||||
this.targetFragment = targetFragment;
|
||||
this.selectedColor = selectedColor;
|
||||
this.colors = colors;
|
||||
customColors = getCustomColors(app);
|
||||
this.colorsListPreference = colorsListPreference;
|
||||
this.customColors = getCustomColors(colorsListPreference, appMode);
|
||||
this.appMode = appMode;
|
||||
}
|
||||
|
||||
public int getSelectedColor() {
|
||||
|
@ -215,9 +221,18 @@ public class ColorsCard extends BaseCard implements ColorPickerListener {
|
|||
return app.getUIUtilities().getPaintedIcon(R.drawable.ic_bg_transparency, transparencyColor);
|
||||
}
|
||||
|
||||
public static List<Integer> getCustomColors(@NonNull OsmandApplication app) {
|
||||
public static List<Integer> getCustomColors(ListStringPreference colorsListPreference) {
|
||||
return getCustomColors(colorsListPreference, null);
|
||||
}
|
||||
|
||||
public static List<Integer> getCustomColors(ListStringPreference colorsListPreference, ApplicationMode appMode) {
|
||||
List<Integer> colors = new ArrayList<>();
|
||||
List<String> colorNames = app.getSettings().CUSTOM_TRACK_COLORS.getStringsList();
|
||||
List<String> colorNames;
|
||||
if (appMode == null) {
|
||||
colorNames = colorsListPreference.getStringsList();
|
||||
} else {
|
||||
colorNames = colorsListPreference.getStringsListForProfile(appMode);
|
||||
}
|
||||
if (colorNames != null) {
|
||||
for (String colorHex : colorNames) {
|
||||
try {
|
||||
|
@ -233,12 +248,24 @@ public class ColorsCard extends BaseCard implements ColorPickerListener {
|
|||
return colors;
|
||||
}
|
||||
|
||||
public int getIndexOfSelectedColor() {
|
||||
return customColors.indexOf(selectedColor);
|
||||
}
|
||||
|
||||
public boolean isBaseColor(int color) {
|
||||
return colors.contains(color);
|
||||
}
|
||||
|
||||
private void saveCustomColors() {
|
||||
List<String> colorNames = new ArrayList<>();
|
||||
for (Integer color : customColors) {
|
||||
String colorHex = Algorithms.colorToString(color);
|
||||
colorNames.add(colorHex);
|
||||
}
|
||||
app.getSettings().CUSTOM_TRACK_COLORS.setStringsList(colorNames);
|
||||
if (appMode == null) {
|
||||
colorsListPreference.setStringsList(colorNames);
|
||||
} else {
|
||||
colorsListPreference.setStringsListForProfile(appMode, colorNames);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -358,7 +358,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
@Override
|
||||
public void onColorSelected(Integer prevColor, int newColor) {
|
||||
if (prevColor != null) {
|
||||
List<Integer> customColors = ColorsCard.getCustomColors(app);
|
||||
List<Integer> customColors = ColorsCard.getCustomColors(app.getSettings().CUSTOM_TRACK_COLORS);
|
||||
int index = customColors.indexOf(prevColor);
|
||||
if (index != ColorsCard.INVALID_VALUE) {
|
||||
saveCustomColorsToTracks(prevColor, newColor);
|
||||
|
@ -666,7 +666,7 @@ public class TrackAppearanceFragment extends ContextMenuScrollFragment implement
|
|||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
List<Integer> colors = getTrackColors();
|
||||
colorsCard = new ColorsCard(mapActivity, trackDrawInfo.getColor(), this, colors);
|
||||
colorsCard = new ColorsCard(mapActivity, trackDrawInfo.getColor(), this, colors, app.getSettings().CUSTOM_TRACK_COLORS, null);
|
||||
colorsCard.setListener(this);
|
||||
cardsContainer.addView(colorsCard.build(mapActivity));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue