Search in sources :

Example 1 with ColorsCard

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();
        }
    }
}
Also used : DirectionArrowsCard(net.osmand.plus.track.cards.DirectionArrowsCard) TrackWidthCard(net.osmand.plus.track.cards.TrackWidthCard) SplitIntervalCard(net.osmand.plus.track.cards.SplitIntervalCard) ColorsCard(net.osmand.plus.track.cards.ColorsCard) ColoringType(net.osmand.plus.routing.ColoringType) TrackColoringCard(net.osmand.plus.track.cards.TrackColoringCard) MapActivity(net.osmand.plus.activities.MapActivity)

Example 2 with ColorsCard

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()));
}
Also used : ColorsCard(net.osmand.plus.track.cards.ColorsCard) ListStringPreference(net.osmand.plus.settings.backend.preferences.ListStringPreference) ArrayList(java.util.ArrayList) LinearLayout(android.widget.LinearLayout) MapActivity(net.osmand.plus.activities.MapActivity)

Example 3 with ColorsCard

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()));
    }
}
Also used : ColorsCard(net.osmand.plus.track.cards.ColorsCard) ViewGroup(android.view.ViewGroup) ArrayList(java.util.ArrayList) MapActivity(net.osmand.plus.activities.MapActivity)

Example 4 with ColorsCard

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());
    }
}
Also used : ColorsCard(net.osmand.plus.track.cards.ColorsCard) BackgroundType(net.osmand.data.FavouritePoint.BackgroundType) TextView(android.widget.TextView)

Example 5 with ColorsCard

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();
}
Also used : FlowLayout(net.osmand.plus.widgets.FlowLayout) ProfileIconColors(net.osmand.plus.profiles.ProfileIconColors) ColorsCard(net.osmand.plus.track.cards.ColorsCard) ArrayList(java.util.ArrayList) SuppressLint(android.annotation.SuppressLint) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

ColorsCard (net.osmand.plus.track.cards.ColorsCard)8 MapActivity (net.osmand.plus.activities.MapActivity)6 ArrayList (java.util.ArrayList)4 SuppressLint (android.annotation.SuppressLint)2 ListStringPreference (net.osmand.plus.settings.backend.preferences.ListStringPreference)2 ViewGroup (android.view.ViewGroup)1 LinearLayout (android.widget.LinearLayout)1 TextView (android.widget.TextView)1 BackgroundType (net.osmand.data.FavouritePoint.BackgroundType)1 PromoBannerCard (net.osmand.plus.chooseplan.PromoBannerCard)1 ProfileIconColors (net.osmand.plus.profiles.ProfileIconColors)1 ColoringType (net.osmand.plus.routing.ColoringType)1 ColoringTypeCard (net.osmand.plus.track.cards.ColoringTypeCard)1 DirectionArrowsCard (net.osmand.plus.track.cards.DirectionArrowsCard)1 SplitIntervalCard (net.osmand.plus.track.cards.SplitIntervalCard)1 TrackColoringCard (net.osmand.plus.track.cards.TrackColoringCard)1 TrackWidthCard (net.osmand.plus.track.cards.TrackWidthCard)1 FlowLayout (net.osmand.plus.widgets.FlowLayout)1