use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.
the class TrackAppearanceFragment method onCardPressed.
@Override
public void onCardPressed(@NonNull BaseCard card) {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
if (card instanceof SplitIntervalCard) {
SplitIntervalBottomSheet.showInstance(mapActivity.getSupportFragmentManager(), trackDrawInfo, this);
} else if (card instanceof TrackColoringCard) {
TrackColoringCard trackColoringCard = ((TrackColoringCard) card);
ColoringType currentColoringType = trackColoringCard.getSelectedColoringType();
String routeInfoAttribute = trackColoringCard.getRouteInfoAttribute();
trackDrawInfo.setColoringType(currentColoringType);
trackDrawInfo.setRouteInfoAttribute(routeInfoAttribute);
refreshMap();
if (coloringTypeCard != null) {
coloringTypeCard.setColoringType(currentColoringType);
}
if (colorsCard != null) {
AndroidUiHelper.updateVisibility(colorsCard.getView(), currentColoringType.isTrackSolid());
}
updatePromoCardVisibility();
} else if (card instanceof ColorsCard) {
int color = ((ColorsCard) card).getSelectedColor();
trackDrawInfo.setColor(color);
updateColorItems();
} else if (card instanceof TrackWidthCard) {
updateAppearanceIcon();
} else if (card instanceof DirectionArrowsCard) {
updateAppearanceIcon();
}
}
}
use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.
the class AddNewFavoriteCategoryBottomSheet method setupColorsCard.
private void setupColorsCard() {
MapActivity mapActivity = ((MapActivity) getActivity());
if (mapActivity == null) {
return;
}
List<Integer> colors = new ArrayList<>();
for (int color : ColorDialogs.pallette) {
colors.add(color);
}
ListStringPreference colorsListPref = requiredMyApplication().getSettings().CUSTOM_TRACK_COLORS;
colorsCard = new ColorsCard(mapActivity, null, this, categoryColor, colors, colorsListPref, true);
colorsCard.setListener(this);
LinearLayout colorsCardContainer = view.findViewById(R.id.colors_card_container);
colorsCardContainer.addView(colorsCard.build(view.getContext()));
}
use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.
the class EditorFragment method createColorSelector.
private void createColorSelector() {
MapActivity mapActivity = getMapActivity();
if (mapActivity != null) {
List<Integer> colors = new ArrayList<>();
for (int color : ColorDialogs.pallette) {
colors.add(color);
}
int customColor = getPointColor();
if (!ColorDialogs.isPaletteColor(customColor)) {
colors.add(customColor);
}
colorsCard = new ColorsCard(mapActivity, null, this, getPointColor(), colors, app.getSettings().CUSTOM_TRACK_COLORS, true);
colorsCard.setListener(this);
ViewGroup colorsCardContainer = view.findViewById(R.id.colors_card_container);
colorsCardContainer.addView(colorsCard.build(view.getContext()));
}
}
use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.
the class PointEditorFragmentNew method onCardPressed.
@Override
public void onCardPressed(@NonNull BaseCard card) {
if (card instanceof IconsCard) {
setIcon(iconsCard.getSelectedIconId());
updateNameIcon();
} else if (card instanceof ColorsCard) {
int color = ((ColorsCard) card).getSelectedColor();
updateColorSelector(color);
} else if (card instanceof ShapesCard) {
BackgroundType selectedShape = shapesCard.getSelectedShape();
setBackgroundType(selectedShape);
updateNameIcon();
updateSelectedShapeText();
((TextView) view.findViewById(R.id.shape_name)).setText(selectedShape.getNameId());
}
}
use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.
the class ProfileAppearanceFragment method createColorsCard.
private void createColorsCard(PreferenceViewHolder holder) {
MapActivity mapActivity = getMapActivity();
if (mapActivity == null) {
return;
}
FlowLayout colorsCardContainer = (FlowLayout) holder.findViewById(R.id.color_items);
colorsCardContainer.removeAllViews();
int selectedColor = changedProfile.getActualColor();
List<Integer> colors = new ArrayList<>();
for (ProfileIconColors color : ProfileIconColors.values()) {
colors.add(ContextCompat.getColor(app, color.getColor(isNightMode())));
}
colorsCard = new ColorsCard(mapActivity, getSelectedAppMode(), this, selectedColor, colors, app.getSettings().CUSTOM_ICON_COLORS, false);
colorsCard.setListener(this);
colorsCardContainer.addView(colorsCard.build(app));
updateColorName();
}
Aggregations