Search in sources :

Example 6 with ColorsCard

use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.

the class ProfileAppearanceFragment method onCardPressed.

@Override
public void onCardPressed(@NonNull BaseCard card) {
    if (card instanceof ColorsCard) {
        ColorsCard cardOfColors = (ColorsCard) card;
        int color = cardOfColors.getSelectedColor();
        if (color == changedProfile.getActualColor()) {
            return;
        }
        if (cardOfColors.isBaseColor(color)) {
            changedProfile.customColor = null;
            changedProfile.color = changedProfile.getProfileColorByColorValue(color);
        } else {
            changedProfile.customColor = cardOfColors.getSelectedColor();
            changedProfile.color = null;
        }
        if (iconItems != null) {
            updateIconColor(changedProfile.iconRes);
        }
        updateColorName();
        updateProfileNameAppearance();
        updateProfileButton();
        setVerticalScrollBarEnabled(false);
        updatePreference(findPreference(MASTER_PROFILE));
        updatePreference(findPreference(LOCATION_ICON_ITEMS));
        updatePreference(findPreference(NAV_ICON_ITEMS));
        setVerticalScrollBarEnabled(true);
    }
}
Also used : ColorsCard(net.osmand.plus.track.cards.ColorsCard) SuppressLint(android.annotation.SuppressLint)

Example 7 with ColorsCard

use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.

the class RouteLineColorCard method createCards.

private void createCards(ViewGroup container) {
    MapActivity mapActivity = getMapActivity();
    if (mapActivity != null) {
        List<Integer> colors = new ArrayList<>();
        for (int color : ColorDialogs.pallette) {
            colors.add(color);
        }
        int selectedColorDay = getSelectedColorForTheme(colors, false);
        int selectedColorNight = getSelectedColorForTheme(colors, true);
        int selectedColor = isNightMap() ? selectedColorNight : selectedColorDay;
        ListStringPreference preference = app.getSettings().CUSTOM_ROUTE_LINE_COLORS;
        colorsCard = new ColorsCard(mapActivity, null, targetFragment, selectedColor, colors, preference, true);
        colorsCard.setListener(this);
        container.addView(colorsCard.build(mapActivity));
        coloringTypeCard = new ColoringTypeCard(mapActivity, previewRouteLineInfo.getRouteColoringType());
        container.addView(coloringTypeCard.build(mapActivity));
        promoCard = new PromoBannerCard(mapActivity, true);
        container.addView(promoCard.build(mapActivity));
    }
}
Also used : ColorsCard(net.osmand.plus.track.cards.ColorsCard) ListStringPreference(net.osmand.plus.settings.backend.preferences.ListStringPreference) PromoBannerCard(net.osmand.plus.chooseplan.PromoBannerCard) ArrayList(java.util.ArrayList) ColoringTypeCard(net.osmand.plus.track.cards.ColoringTypeCard) MapActivity(net.osmand.plus.activities.MapActivity)

Example 8 with ColorsCard

use of net.osmand.plus.track.cards.ColorsCard in project Osmand by osmandapp.

the class TrackAppearanceFragment method setupColorsCard.

private void setupColorsCard(@NonNull ViewGroup container) {
    MapActivity mapActivity = getMapActivity();
    if (mapActivity != null) {
        List<Integer> colors = getTrackColors();
        colorsCard = new ColorsCard(mapActivity, null, this, trackDrawInfo.getColor(), colors, settings.CUSTOM_TRACK_COLORS, true);
        addCard(container, colorsCard);
        int dp12 = getResources().getDimensionPixelSize(R.dimen.card_padding);
        AndroidUtils.setPadding(colorsCard.getView(), 0, dp12, 0, dp12);
        boolean shouldShowColorsCard = trackDrawInfo.getColoringType().isTrackSolid();
        AndroidUiHelper.updateVisibility(colorsCard.getView(), shouldShowColorsCard);
    }
}
Also used : ColorsCard(net.osmand.plus.track.cards.ColorsCard) 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