icon color change in pr, in bottom sheet dialog, all other places, ui fixes

This commit is contained in:
madwasp79 2019-06-19 14:49:30 +03:00
parent 24d51ba07a
commit 561c1df71e
14 changed files with 164 additions and 111 deletions

View file

@ -158,11 +158,7 @@
</LinearLayout>
<FrameLayout
android:id="@+id/click_block_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"/>
</FrameLayout>
@ -263,9 +259,8 @@
<View
android:layout_width="1dp"
android:layout_height="match_parent"
android:paddingBottom="8dp"
android:paddingTop="8dp"
android:layout_height="36dp"
android:layout_gravity="center_vertical"
android:background="@color/divider_light"/>
<LinearLayout
@ -317,6 +312,12 @@
android:layout_marginRight="@dimen/list_content_padding"
android:text="@string/osmand_routing_promo"/>
<FrameLayout
android:id="@+id/click_block_layout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:clickable="false"/>
</LinearLayout>
<LinearLayout

View file

@ -59,7 +59,6 @@
android:layout_marginEnd="@dimen/bottom_sheet_icon_margin"
android:layout_marginRight="@dimen/bottom_sheet_icon_margin"
android:layout_gravity="center_vertical"
android:tint="?attr/primary_icon_color"
tools:src="@drawable/ic_action_coordinates_latitude"/>
<LinearLayout
@ -103,6 +102,12 @@
</LinearLayout>
<ImageView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:scaleType="fitXY"
android:src="@drawable/bg_shadow_list_bottom"/>
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent" >

View file

@ -40,7 +40,7 @@
android:layout_height="wrap_content"
android:ellipsize="end"
android:maxLines="2"
android:textColor="@color/main_font_dark"
android:textColor="?attr/main_font_color_basic"
android:textSize="@dimen/default_list_text_size"
tools:text="Bicycle" />
@ -51,6 +51,7 @@
android:ellipsize="end"
android:maxLines="1"
android:textSize="@dimen/default_desc_text_size"
android:textColor="@color/description_font_and_bottom_sheet_icons"
tools:text="Type: Bicycle" />
</LinearLayout>
@ -70,7 +71,7 @@
android:paddingEnd="10dp"
android:paddingRight="10dp"
android:src="@drawable/ic_action_additional_option"
android:tint="?attr/primary_icon_color" />
android:tint="@color/description_font_and_bottom_sheet_icons" />
<android.support.v7.widget.SwitchCompat
android:id="@+id/compound_button"

View file

@ -505,4 +505,14 @@
<color name="profile_icon_color_yellow_light">#F0B400</color>
<color name="profile_icon_color_magenta_light">#CC0063</color>
<color name="profile_icon_color_blue_dark_default">#B3237BFF</color>
<color name="profile_icon_color_purple_dark">#B3732EEB</color>
<color name="profile_icon_color_green_dark">#B30EBE92</color>
<color name="profile_icon_color_blue_dark">#B3007EB3</color>
<color name="profile_icon_color_red_dark">#B3FF2200</color>
<color name="profile_icon_color_yellow_dark">#B3F0B400</color>
<color name="profile_icon_color_magenta_dark">#B3CC0063</color>
<color name="profile_icon_color_inactive">#727272</color>
</resources>

View file

@ -114,7 +114,7 @@
<item name="ctx_menu_card_btn">@color/ctx_menu_card_btn_light</item>
<item name="searchbar_text">@color/searchbar_text_light</item>
<item name="searchbar_text_hint">@color/searchbar_text_hint_light</item>
<item name="list_divider">@color/list_divider_dark</item>
<item name="list_divider">@color/divider_light</item>
<item name="expandable_category_color">?android:attr/colorBackground</item>
<item name="bottomToolBarColor">@color/tool_bar_color_light</item>
<item name="downloadButtonBackground">@drawable/download_light</item>
@ -368,7 +368,7 @@
<item name="ctx_menu_card_btn">@color/ctx_menu_card_btn_dark</item>
<item name="searchbar_text">@color/searchbar_text_dark</item>
<item name="searchbar_text_hint">@color/searchbar_text_hint_dark</item>
<item name="list_divider">@color/list_divider_light</item>
<item name="list_divider">@color/divider_dark</item>
<item name="expandable_category_color">?android:attr/colorBackground</item>
<item name="bottomToolBarColor">@color/tool_bar_color_dark</item>
<item name="downloadButtonBackground">@drawable/download_dark</item>

View file

@ -222,6 +222,11 @@ public class ApplicationMode {
applicationMode.routeService = service;
return this;
}
public ApplicationModeBuilder setColor(ProfileIconColors colorData) {
applicationMode.iconColor = colorData;
return this;
}
}
private static ApplicationModeBuilder create(int key, String stringKey) {
@ -562,32 +567,42 @@ public class ApplicationMode {
}
public ProfileIconColors getIconColorInfo() {
return iconColor;
if (iconColor != null) {
return iconColor;
} else {
return ProfileIconColors.DEFAULT;
}
}
public enum ProfileIconColors{
DEFAULT(R.string.rendering_value_default_name, R.color.profile_icon_color_blue_light_default),
PURPLE(R.string.rendering_value_purple_name, R.color.profile_icon_color_purple_light),
GREEN(R.string.rendering_value_green_name, R.color.profile_icon_color_green_light),
BLUE(R.string.rendering_value_blue_name, R.color.profile_icon_color_blue_light),
RED(R.string.rendering_value_red_name, R.color.profile_icon_color_red_light),
DARK_YELLOW(R.string.rendering_value_darkyellow_name, R.color.profile_icon_color_yellow_light),
MAGENTA(R.string.shared_string_color_magenta, R.color.profile_icon_color_magenta_light);
DEFAULT(R.string.rendering_value_default_name, R.color.profile_icon_color_blue_light_default, R.color.profile_icon_color_blue_dark_default),
PURPLE(R.string.rendering_value_purple_name, R.color.profile_icon_color_purple_light, R.color.profile_icon_color_purple_dark),
GREEN(R.string.rendering_value_green_name, R.color.profile_icon_color_green_light, R.color.profile_icon_color_green_dark),
BLUE(R.string.rendering_value_blue_name, R.color.profile_icon_color_blue_light, R.color.profile_icon_color_blue_dark),
RED(R.string.rendering_value_red_name, R.color.profile_icon_color_red_light, R.color.profile_icon_color_red_dark),
DARK_YELLOW(R.string.rendering_value_darkyellow_name, R.color.profile_icon_color_yellow_light, R.color.profile_icon_color_yellow_dark),
MAGENTA(R.string.shared_string_color_magenta, R.color.profile_icon_color_magenta_light, R.color.profile_icon_color_magenta_dark);
@StringRes private int name;
@ColorRes private int color;
@ColorRes private int dayColor;
@ColorRes private int nightColor;
ProfileIconColors(@StringRes int name, @ColorRes int color) {
ProfileIconColors(@StringRes int name, @ColorRes int dayColor, @ColorRes int nightColor) {
this.name = name;
this.color = color;
this.dayColor = dayColor;
this.nightColor = nightColor;
}
public int getName() {
return name;
}
public int getColor() {
return color;
public int getColor(boolean nightMode) {
if (nightMode) {
return nightColor;
} else {
return dayColor;
}
}
}

View file

@ -367,7 +367,8 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
getAppModeDescription(am),
am.getStringKey(),
am.getIconRes(getMyApplication()),
isSelected
isSelected,
am.getIconColorInfo()
));
}
}
@ -403,22 +404,19 @@ public abstract class SettingsBaseActivity extends ActionBarPreferenceActivity
}
void updateModeButton(ApplicationMode mode) {
boolean nightMode = !getMyApplication().getSettings().isLightContent();
String title = Algorithms.isEmpty(mode.getUserProfileName())
? mode.toHumanString(SettingsBaseActivity.this)
: mode.getUserProfileName();
getModeTitleTV().setText(title);
getModeSubTitleTV().setText(getAppModeDescription(mode));
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getIconRes(this),
getMyApplication().getSettings().isLightContent()
? R.color.active_buttons_and_links_light
: R.color.active_buttons_and_links_dark));
getDropDownArrow().setImageDrawable(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down,
getMyApplication().getSettings().isLightContent()
? R.color.active_buttons_and_links_light
: R.color.active_buttons_and_links_dark));
settings.APPLICATION_MODE.set(mode);
previousAppMode = mode;
getModeIconIV().setImageDrawable(getMyApplication().getUIUtilities().getIcon(mode.getIconRes(this),
mode.getIconColorInfo().getColor(nightMode)));
getDropDownArrow().setImageDrawable(getMyApplication().getUIUtilities().getIcon(R.drawable.ic_action_arrow_drop_down,
R.color.icon_color));
isModeSelected = true;
updateAllSettings();
}

View file

@ -86,12 +86,12 @@ public class AppModeDialog {
final boolean checked = selected.contains(mode);
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
if (checked) {
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), mode.getIconColorInfo().getColor(nightMode)));
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
tb.findViewById(R.id.selection).setVisibility(View.VISIBLE);
} else {
if (useMapTheme) {
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), R.color.description_font_and_bottom_sheet_icons));
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), mode.getIconColorInfo().getColor(nightMode)));
iv.setBackgroundResource(AndroidUtils.resolveAttribute(ctx, android.R.attr.selectableItemBackground));
} else {
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getIconRes(ctx)));
@ -138,10 +138,9 @@ public class AppModeDialog {
View selection = tb.findViewById(R.id.selection);
if (checked) {
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), mode.getIconColorInfo().getColor(nightMode));
iv.setImageDrawable(drawable);
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
AndroidUtils.setBackground(ctx, iv, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark);
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark);
@ -152,7 +151,7 @@ public class AppModeDialog {
if (useMapTheme) {
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
if (Build.VERSION.SDK_INT >= 21) {
Drawable active = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
Drawable active = ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), mode.getIconColorInfo().getColor(nightMode));
drawable = AndroidUtils.createPressedStateListDrawable(drawable, active);
}
iv.setImageDrawable(drawable);
@ -200,7 +199,7 @@ public class AppModeDialog {
int metricsY = (int) ctx.getResources().getDimension(R.dimen.route_info_modes_height);
View tb = layoutInflater.inflate(layoutId, null);
ImageView iv = (ImageView) tb.findViewById(R.id.app_mode_icon);
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), isNightMode(ctx, useMapTheme) ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
iv.setImageDrawable(ctx.getUIUtilities().getIcon(mode.getIconRes(ctx), mode.getIconColorInfo().getColor(isNightMode(ctx, useMapTheme))));
iv.setContentDescription(mode.toHumanString(ctx));
// tb.setCompoundDrawablesWithIntrinsicBounds(null, ctx.getIconsCache().getIcon(mode.getIconId(), R.color.app_mode_icon_color), null, null);
LayoutParams lp = new LinearLayout.LayoutParams(metricsX, metricsY);

View file

@ -64,13 +64,11 @@ public class AppProfileArrayAdapter extends ArrayAdapter<ProfileDataObject> {
if (getMyApp(context) != null) {
if (mode.isSelected()) {
iconDrawable = getMyApp(context).getUIUtilities().getIcon(mode.getIconRes(),
getMyApp(context).getSettings().isLightContent()
? R.color.ctx_menu_direction_color_light
: R.color.active_buttons_and_links_dark
);
mode.getIconColor(!getMyApp(context).getSettings().isLightContent())
);
} else {
iconDrawable = getMyApp(context).getUIUtilities()
.getIcon(mode.getIconRes(), R.color.icon_color);
.getIcon(mode.getIconRes(), R.color.profile_icon_color_inactive);
}
} else {
iconDrawable = context.getDrawable(mode.getIconRes());

View file

@ -16,6 +16,9 @@ import android.content.DialogInterface;
import android.content.DialogInterface.OnDismissListener;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Build;
import android.os.Build.VERSION;
import android.os.Build.VERSION_CODES;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
@ -75,8 +78,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
public static final String SELECTED_ITEM = "editedProfile";
public static final String SELECTED_ICON = "selectedIcon";
public static final String CURRENT_PROFILE_COLOR_ATTR = "currentProfileIconColor";
OsmandApplication app;
ApplicationMode mode = null;
@ -244,12 +245,14 @@ public class EditProfileFragment extends BaseOsmAndFragment {
((EditProfileActivity) getActivity()).getSupportActionBar().setElevation(5.0f);
}
int iconColor;
if (!isUserProfile) {
iconColor = R.color.icon_color;
} else {
iconColor = profile.iconColor;
}
int iconColor = profile.iconColor.getColor(nightMode);
// if (isNew) {
// iconColor = profile.iconColor.getColor(nightMode);
// } else if (isUserProfile) {
// iconColor = profile.iconColor.getColor(nightMode);
// } else {
// iconColor = R.color.icon_color;
// }
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(startIconId, iconColor));
colorSample.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_circle, iconColor));
@ -301,43 +304,59 @@ public class EditProfileFragment extends BaseOsmAndFragment {
}
});
profileIconBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final SelectProfileBottomSheetDialogFragment iconSelectDialog = new SelectProfileBottomSheetDialogFragment();
Bundle bundle = new Bundle();
bundle.putString(DIALOG_TYPE, TYPE_ICON);
bundle.putString(SELECTED_ICON, profile.iconStringName);
iconSelectDialog.setArguments(bundle);
if (getActivity() != null) {
getActivity().getSupportFragmentManager().beginTransaction()
.add(iconSelectDialog, "select_icon")
.commitAllowingStateLoss();
}
}
});
selectColorBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final ListPopupWindow popupWindow = new ListPopupWindow(activity);
popupWindow.setAnchorView(selectColorBtn);
popupWindow.setContentWidth(AndroidUtils.dpToPx(activity, 200f));
popupWindow.setModal(true);
popupWindow.setDropDownGravity(Gravity.TOP | Gravity.RIGHT);
popupWindow.setVerticalOffset(AndroidUtils.dpToPx(activity, -48f));
popupWindow.setHorizontalOffset(AndroidUtils.dpToPx(activity, -6f));
final ProfileColorAdapter profileColorAdapter = new ProfileColorAdapter(activity, mode.getIconColorInfo());
popupWindow.setAdapter(profileColorAdapter);
popupWindow.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
if (isUserProfile || isNew) {
profileIconBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final SelectProfileBottomSheetDialogFragment iconSelectDialog = new SelectProfileBottomSheetDialogFragment();
Bundle bundle = new Bundle();
bundle.putString(DIALOG_TYPE, TYPE_ICON);
bundle.putString(SELECTED_ICON, profile.iconStringName);
iconSelectDialog.setArguments(bundle);
if (getActivity() != null) {
getActivity().getSupportFragmentManager().beginTransaction()
.add(iconSelectDialog, "select_icon")
.commitAllowingStateLoss();
}
});
popupWindow.show();
}
});
selectColorBtn.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
final ListPopupWindow popupWindow = new ListPopupWindow(activity);
popupWindow.setAnchorView(selectColorBtn);
popupWindow.setContentWidth(AndroidUtils.dpToPx(activity, 200f));
popupWindow.setModal(true);
popupWindow.setDropDownGravity(Gravity.TOP | Gravity.RIGHT);
popupWindow.setVerticalOffset(AndroidUtils.dpToPx(activity, -48f));
popupWindow.setHorizontalOffset(AndroidUtils.dpToPx(activity, -6f));
final ProfileColorAdapter profileColorAdapter = new ProfileColorAdapter(activity, mode.getIconColorInfo());
popupWindow.setAdapter(profileColorAdapter);
popupWindow.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
isDataChanged = true;
profile.iconColor = ProfileIconColors.values()[position];
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(profile.iconId, profile.iconColor.getColor(nightMode)));
colorSample.setImageDrawable(app.getUIUtilities().getIcon(R.drawable.ic_action_circle, profile.iconColor.getColor(nightMode)));
popupWindow.dismiss();
}
});
popupWindow.show();
}
});
} else {
if (VERSION.SDK_INT > VERSION_CODES.LOLLIPOP) {
selectColorBtn.setBackground(null);
profileIconBtn.setBackground(null);
} else {
selectColorBtn.setBackgroundDrawable(null);
profileIconBtn.setBackgroundDrawable(null);
}
});
}
mapConfigBtn.setOnClickListener(new OnClickListener() {
@Override
@ -477,8 +496,8 @@ public class EditProfileFragment extends BaseOsmAndFragment {
profile.iconId = pos;
profile.iconStringName = stringRes;
profileIcon.setImageDrawable(app.getUIUtilities().getIcon(pos,
nightMode ? R.color.active_buttons_and_links_dark
: R.color.active_buttons_and_links_light));
profile.iconColor.getColor(nightMode)));
}
};
}
@ -627,6 +646,8 @@ public class EditProfileFragment extends BaseOsmAndFragment {
builder.setRoutingProfile(profile.routingProfileDataObject.getStringKey());
}
builder.setColor(profile.iconColor);
ApplicationMode mode = builder.customReg();
ApplicationMode.saveCustomModeToSettings(getSettings());
@ -644,7 +665,6 @@ public class EditProfileFragment extends BaseOsmAndFragment {
getSettings().ROUTER_SERVICE.setModeValue(mode, RouteService.OSMAND);
}
}
}
isDataChanged = false;
isCancelAllowed = true;
@ -799,7 +819,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
ApplicationMode parent = null;
int iconId = R.drawable.map_world_globe_dark;
String iconStringName = "map_world_globe_dark";
int iconColor = R.color.active_buttons_and_links_light;
ProfileIconColors iconColor = ProfileIconColors.DEFAULT;
RoutingProfileDataObject routingProfileDataObject = null;
ApplicationProfileObject(ApplicationMode mode, boolean isNew, boolean isUserProfile) {
@ -812,7 +832,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
parent = mode.getParent();
iconId = mode.getIconRes(getMyApplication());
iconStringName = Algorithms.isEmpty(mode.getIconName())? "map_world_globe_dark" : mode.getIconName();
iconColor = mode.getIconColorInfo() == null ? R.color.profile_icon_color_blue_light_default : mode.getIconColorInfo().getColor();
iconColor = mode.getIconColorInfo() == null ? ProfileIconColors.DEFAULT : mode.getIconColorInfo();
userProfileTitle = mode.getUserProfileName();
} else {
key = mode.getStringResource();
@ -837,12 +857,13 @@ public class EditProfileFragment extends BaseOsmAndFragment {
}
public void init() {
boolean nightMode = !app.getSettings().isLightContent();
String currentColorName = app.getString(ProfileIconColors.DEFAULT.getName());
ColorListItem item = new ColorListItem(currentColorName, currentColorName, ProfileIconColors.DEFAULT.getColor());
ColorListItem item = new ColorListItem(currentColorName, currentColorName, ProfileIconColors.DEFAULT.getColor(nightMode));
add(item);
for (ProfileIconColors pic : ProfileIconColors.values()) {
if (pic != ProfileIconColors.DEFAULT) {
item = new ColorListItem(currentColorName, app.getString(pic.getName()), pic.getColor());
item = new ColorListItem(currentColorName, app.getString(pic.getName()), pic.getColor(nightMode));
add(item);
}
}
@ -888,13 +909,7 @@ public class EditProfileFragment extends BaseOsmAndFragment {
this.color = color;
}
public String getCurrentValueName() {
return currentValueName;
}
public String getValueName() {
return valueName;
}
public int getColor() {
return color;

View file

@ -1,5 +1,8 @@
package net.osmand.plus.profiles;
import android.support.annotation.ColorRes;
import net.osmand.plus.ApplicationMode.ProfileIconColors;
public class ProfileDataObject {
private String name;
@ -7,13 +10,15 @@ public class ProfileDataObject {
private int iconRes;
private String stringKey;
private boolean isSelected;
private ProfileIconColors iconColor;
public ProfileDataObject(String name, String description, String stringKey, int iconRes, boolean isSelected) {
public ProfileDataObject(String name, String description, String stringKey, int iconRes, boolean isSelected, ProfileIconColors iconColor) {
this.name = name;
this.iconRes = iconRes;
this.description = description;
this.isSelected = isSelected;
this.stringKey = stringKey;
this.iconColor = iconColor;
}
public String getName() {
@ -39,4 +44,8 @@ public class ProfileDataObject {
public String getStringKey() {
return stringKey;
}
@ColorRes public int getIconColor(boolean isNightMode) {
return iconColor.getColor(isNightMode);
}
}

View file

@ -6,7 +6,6 @@ import android.support.annotation.Nullable;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.SwitchCompat;
import android.view.LayoutInflater;
import android.view.MotionEvent;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
@ -18,15 +17,19 @@ import android.widget.TextView;
import java.util.ArrayList;
import java.util.List;
import java.util.Set;
import net.osmand.PlatformUtil;
import net.osmand.plus.ApplicationMode;
import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.profiles.ProfileMenuAdapter.ProfileViewHolder;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder> {
private static final Log LOG = PlatformUtil.getLog(ProfileMenuAdapter.class);
private List<Object> items = new ArrayList<>();
private Set<ApplicationMode> selectedItems;
@Nullable
@ -143,10 +146,11 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
if (iconRes == 0 || iconRes == -1) {
iconRes = R.drawable.ic_action_world_globe;
}
selectedIconColorRes = mode.getIconColorInfo().getColor(isNightMode(app));
if (selectedItems.contains(mode)) {
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, selectedIconColorRes));
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, mode.getIconColorInfo().getColor(isNightMode(app))));
} else {
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color));
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.profile_icon_color_inactive));
}
}

View file

@ -1,6 +1,7 @@
package net.osmand.plus.profiles;
import android.os.Parcel;
import net.osmand.plus.ApplicationMode.ProfileIconColors;
public class RoutingProfileDataObject extends ProfileDataObject {
@ -8,7 +9,7 @@ public class RoutingProfileDataObject extends ProfileDataObject {
private String fileName;
public RoutingProfileDataObject(String stringKey, String name, String descr, int iconRes, boolean isSelected, String fileName) {
super(name, descr, stringKey, iconRes, isSelected);
super(name, descr, stringKey, iconRes, isSelected, null);
this.fileName = fileName;
}

View file

@ -152,7 +152,7 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
if (mode != ApplicationMode.DEFAULT) {
profiles.add(new ProfileDataObject( mode.toHumanString(ctx),
ctx.getString(BaseProfilesDescr.valueOf(mode.getStringKey().toUpperCase()).getDescrRes()),
mode.getStringKey(), mode.getSmallIconDark(), false));
mode.getStringKey(), mode.getSmallIconDark(), false, mode.getIconColorInfo()));
}
}
return profiles;
@ -177,7 +177,4 @@ public class SettingsProfileFragment extends BaseOsmAndFragment {
return descrRes;
}
}
}