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);
}
}
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));
}
}
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);
}
}
Aggregations