ui tweaks and fixes (icon resources, dividers, etc
This commit is contained in:
parent
07db107b7a
commit
fb86a15b3f
17 changed files with 145 additions and 111 deletions
|
@ -71,6 +71,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/divider_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="64dp"
|
||||
|
|
|
@ -252,7 +252,7 @@
|
|||
android:layout_marginEnd="@dimen/list_content_padding"
|
||||
android:layout_marginLeft="@dimen/list_content_padding"
|
||||
android:layout_marginRight="@dimen/list_content_padding"
|
||||
android:text="You can add own modified version of routing.xml to ..osmand/files/routing/"/>
|
||||
android:text="@string/osmand_routing_promo"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
|
||||
android:id="@+id/menu_image"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
Thx - Hardy
|
||||
|
||||
-->
|
||||
|
||||
<string name="osmand_routing_promo">You can add own modified version of routing.xml to ..osmand/routing</string>
|
||||
<string name="app_mode_skiing">Skiing</string>
|
||||
<string name="base_profile_descr_ski">Skiing</string>
|
||||
<string name="show_compass_ruler">Show compass ruler</string>
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<ListPreference
|
||||
android:key="router_service"
|
||||
android:summary="@string/router_service_descr"
|
||||
android:title="@string/router_service"/>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="routing_preferences"
|
||||
|
|
|
@ -469,7 +469,7 @@ public class ApplicationMode {
|
|||
@Expose private final String stringKey;
|
||||
@Expose private String userProfileName;
|
||||
@Expose private ApplicationMode parent;
|
||||
@Expose private String iconName = "R.drawable.map_world_globe_dark";
|
||||
@Expose private String iconName = "map_world_globe_dark";
|
||||
@Expose private int mapIconId = R.drawable.map_world_globe_dark;
|
||||
@Expose private int smallIconDark = R.drawable.ic_world_globe_dark;
|
||||
@Expose private float defaultSpeed = 10f;
|
||||
|
|
|
@ -83,14 +83,12 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
addPreferencesFromResource(R.xml.navigation_settings);
|
||||
PreferenceScreen screen = getPreferenceScreen();
|
||||
settings = getMyApplication().getSettings();
|
||||
routerServicePreference = (ListPreference) screen.findPreference(settings.ROUTER_SERVICE.getId());
|
||||
RouteService[] vls = RouteService.getAvailableRouters(getMyApplication());
|
||||
String[] entries = new String[vls.length];
|
||||
for(int i=0; i<entries.length; i++){
|
||||
entries[i] = vls[i].getName();
|
||||
}
|
||||
registerListPreference(settings.ROUTER_SERVICE, screen, entries, vls);
|
||||
|
||||
|
||||
registerBooleanPreference(settings.SNAP_TO_ROAD, screen);
|
||||
|
||||
Integer[] intValues = new Integer[] { 0, 5, 10, 15, 20, 25, 30, 45, 60, 90};
|
||||
|
@ -365,7 +363,6 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
prepareRoutingPrefs(getPreferenceScreen());
|
||||
reloadVoiceListPreference(getPreferenceScreen());
|
||||
super.updateAllSettings();
|
||||
routerServicePreference.setSummary(getString(R.string.router_service_descr) + " [" + settings.ROUTER_SERVICE.get() + "]");
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -386,12 +383,6 @@ public class SettingsNavigationActivity extends SettingsBaseActivity {
|
|||
return true;
|
||||
}
|
||||
super.onPreferenceChange(preference, newValue);
|
||||
if (id.equals(settings.ROUTER_SERVICE.getId())) {
|
||||
routerServicePreference.setSummary(getString(R.string.router_service_descr) + " ["
|
||||
+ settings.ROUTER_SERVICE.get() + "]");
|
||||
prepareRoutingPrefs(getPreferenceScreen());
|
||||
super.updateAllSettings();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -86,15 +86,15 @@ 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.getSmallIconDark(), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName()), nightMode ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
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.getSmallIconDark(), R.color.description_font_and_bottom_sheet_icons));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName()), R.color.description_font_and_bottom_sheet_icons));
|
||||
iv.setBackgroundResource(AndroidUtils.resolveAttribute(ctx, android.R.attr.selectableItemBackground));
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getSmallIconDark()));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName())));
|
||||
}
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||
tb.findViewById(R.id.selection).setVisibility(View.INVISIBLE);
|
||||
|
@ -138,7 +138,7 @@ public class AppModeDialog {
|
|||
View selection = tb.findViewById(R.id.selection);
|
||||
|
||||
if (checked) {
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName()), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
iv.setImageDrawable(drawable);
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_checked)));
|
||||
|
||||
|
@ -150,9 +150,9 @@ public class AppModeDialog {
|
|||
}
|
||||
} else {
|
||||
if (useMapTheme) {
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(mode.getSmallIconDark(), nightMode ? R.color.route_info_control_icon_color_dark : R.color.route_info_control_icon_color_light);
|
||||
Drawable drawable = ctx.getUIUtilities().getIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName()), 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.getSmallIconDark(), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
Drawable active = ctx.getUIUtilities().getIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName()), nightMode ? R.color.active_buttons_and_links_dark : R.color.active_buttons_and_links_light);
|
||||
drawable = AndroidUtils.createPressedStateListDrawable(drawable, active);
|
||||
}
|
||||
iv.setImageDrawable(drawable);
|
||||
|
@ -163,7 +163,7 @@ public class AppModeDialog {
|
|||
AndroidUtils.setBackground(ctx, selection, nightMode, R.drawable.btn_border_pressed_trans_light, R.drawable.btn_border_pressed_trans_dark);
|
||||
}
|
||||
} else {
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(mode.getSmallIconDark()));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getThemedIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName())));
|
||||
}
|
||||
iv.setContentDescription(String.format("%s %s", mode.toHumanString(ctx), ctx.getString(R.string.item_unchecked)));
|
||||
}
|
||||
|
@ -200,7 +200,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.getSmallIconDark(), isNightMode(ctx, useMapTheme) ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
iv.setImageDrawable(ctx.getUIUtilities().getIcon(ApplicationMode.getIconResFromName(ctx, mode.getIconName(), ctx.getPackageName()), isNightMode(ctx, useMapTheme) ? R.color.active_buttons_and_links_dark : R.color.route_info_checked_mode_icon_color_light));
|
||||
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);
|
||||
|
|
|
@ -76,7 +76,8 @@ public class DirectionIndicationDialogFragment extends BaseOsmAndDialogFragment
|
|||
TextView appModeTv = (TextView) mainView.findViewById(R.id.app_mode_text_view);
|
||||
ApplicationMode appMode = settings.APPLICATION_MODE.get();
|
||||
appModeTv.setText(appMode.getStringResource());
|
||||
appModeTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getIconsCache().getIcon(appMode.getSmallIconDark()), null);
|
||||
appModeTv.setCompoundDrawablesWithIntrinsicBounds(null, null, getIconsCache().getIcon(
|
||||
ApplicationMode.getIconResFromName(getMyApplication(), appMode.getIconName(), getMyApplication().getPackageName())), null);
|
||||
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
((ObservableScrollView) mainView.findViewById(R.id.scroll_view)).setScrollViewCallbacks(new ObservableScrollViewCallbacks() {
|
||||
|
|
|
@ -661,7 +661,8 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
if (mapActivity != null) {
|
||||
final ImageButton appModesBtn = (ImageButton) mapActivity.findViewById(R.id.snap_to_road_image_button);
|
||||
appModesBtn.setBackgroundResource(nightMode ? R.drawable.btn_circle_night : R.drawable.btn_circle);
|
||||
appModesBtn.setImageDrawable(getActiveIcon(planRouteContext.getSnappedMode().getMapIconId()));
|
||||
appModesBtn.setImageDrawable(getActiveIcon(ApplicationMode.getIconResFromName(
|
||||
getContext(), planRouteContext.getSnappedMode().getIconName(), getContext().getPackageName())));
|
||||
appModesBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -805,7 +805,8 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
|
||||
ImageButton snapToRoadBtn = (ImageButton) mapActivity.findViewById(R.id.snap_to_road_image_button);
|
||||
snapToRoadBtn.setBackgroundResource(nightMode ? R.drawable.btn_circle_night : R.drawable.btn_circle);
|
||||
snapToRoadBtn.setImageDrawable(getActiveIcon(appMode.getMapIconId()));
|
||||
snapToRoadBtn.setImageDrawable(getActiveIcon(ApplicationMode.getIconResFromName(
|
||||
getMyApplication(), appMode.getIconName(), getMyApplication().getPackageName())));
|
||||
snapToRoadBtn.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
|
|
|
@ -95,7 +95,8 @@ public class SnapToRoadBottomSheetDialogFragment extends android.support.design.
|
|||
for (int i = 0; i < modes.size(); i++) {
|
||||
ApplicationMode mode = modes.get(i);
|
||||
View row = View.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.list_item_icon_and_title, null);
|
||||
((ImageView) row.findViewById(R.id.icon)).setImageDrawable(getContentIcon(mode.getSmallIconDark()));
|
||||
((ImageView) row.findViewById(R.id.icon)).setImageDrawable(
|
||||
getContentIcon(ApplicationMode.getIconResFromName(app, mode.getIconName(), app.getPackageName())));
|
||||
((TextView) row.findViewById(R.id.title)).setText(mode.toHumanString(getContext()));
|
||||
row.setOnClickListener(onClickListener);
|
||||
row.setTag(i);
|
||||
|
|
|
@ -55,8 +55,7 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
|||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent,
|
||||
Bundle savedInstanceState) {
|
||||
themeRes = nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme;
|
||||
adapter = new ProfileMenuAdapter(allModes, selectedModes, getMyApplication(), listener);
|
||||
adapter.setBottomSheetMode(true);
|
||||
adapter = new ProfileMenuAdapter(allModes, selectedModes, getMyApplication(), listener, true);
|
||||
recyclerView = new RecyclerView(getContext());
|
||||
recyclerView = (RecyclerView) View
|
||||
.inflate(new ContextThemeWrapper(getContext(), themeRes), R.layout.recyclerview, null);
|
||||
|
@ -128,13 +127,6 @@ public class AppModesBottomSheetDialogFragment extends MenuBottomSheetDialogFrag
|
|||
|
||||
items.add(new TitleItem(getString(R.string.application_profiles)));
|
||||
items.add(new BaseBottomSheetItem.Builder().setCustomView(recyclerView).create());
|
||||
items.add(new BaseBottomSheetItem.Builder().setCustomView(textButtonView)
|
||||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
startActivity(new Intent(getContext(), SettingsProfileActivity.class));
|
||||
}
|
||||
}).create());
|
||||
}
|
||||
|
||||
public void setUpdateMapRouteMenuListener(
|
||||
|
|
|
@ -713,18 +713,20 @@ public class EditProfileFragment extends BaseOsmAndFragment {
|
|||
|
||||
Map<String, GeneralRouter> inputProfiles = context.getRoutingConfig().getAllRouters();
|
||||
for (Entry<String, GeneralRouter> e : inputProfiles.entrySet()) {
|
||||
int iconRes = R.drawable.ic_action_gdirections_dark;
|
||||
String name = e.getValue().getProfileName();
|
||||
String description = context.getString(R.string.osmand_default_routing);
|
||||
if (!Algorithms.isEmpty(e.getValue().getFilename())) {
|
||||
description = e.getValue().getFilename();
|
||||
} else if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
|
||||
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
|
||||
name = context
|
||||
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
|
||||
if (!e.getKey().equals("geocoding")) {
|
||||
int iconRes = R.drawable.ic_action_gdirections_dark;
|
||||
String name = e.getValue().getProfileName();
|
||||
String description = context.getString(R.string.osmand_default_routing);
|
||||
if (!Algorithms.isEmpty(e.getValue().getFilename())) {
|
||||
description = e.getValue().getFilename();
|
||||
} else if (RoutingProfilesResources.isRpValue(name.toUpperCase())){
|
||||
iconRes = RoutingProfilesResources.valueOf(name.toUpperCase()).getIconRes();
|
||||
name = context
|
||||
.getString(RoutingProfilesResources.valueOf(name.toUpperCase()).getStringRes());
|
||||
}
|
||||
profilesObjects.add(new RoutingProfileDataObject(e.getKey(), name, description,
|
||||
iconRes, false, e.getValue().getFilename()));
|
||||
}
|
||||
profilesObjects.add(new RoutingProfileDataObject(e.getKey(), name, description,
|
||||
iconRes, false, e.getValue().getFilename()));
|
||||
}
|
||||
return profilesObjects;
|
||||
}
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.profiles;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.support.annotation.ColorRes;
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -11,6 +12,7 @@ import android.view.ViewGroup;
|
|||
import android.widget.ImageView;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
|
@ -22,17 +24,18 @@ import net.osmand.util.Algorithms;
|
|||
|
||||
public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder> {
|
||||
|
||||
private List<ApplicationMode> items;
|
||||
private List<Object> items = new ArrayList<>();
|
||||
private Set<ApplicationMode> selectedItems;
|
||||
private ProfileListener listener;
|
||||
private final OsmandApplication app;
|
||||
@ColorRes
|
||||
private int selectedIconColorRes;
|
||||
private boolean isBottomSheet = false;
|
||||
private static final String MANAGE_BTN = "manage_button";
|
||||
|
||||
public ProfileMenuAdapter(List<ApplicationMode> items, Set<ApplicationMode> selectedItems,
|
||||
OsmandApplication app, ProfileListener listener) {
|
||||
this.items = items;
|
||||
this.items.addAll(items);
|
||||
this.listener = listener;
|
||||
this.app = app;
|
||||
this.selectedItems = selectedItems;
|
||||
|
@ -41,7 +44,20 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
: R.color.active_buttons_and_links_light;
|
||||
}
|
||||
|
||||
public List<ApplicationMode> getItems() {
|
||||
public ProfileMenuAdapter(List<ApplicationMode> items, Set<ApplicationMode> selectedItems,
|
||||
OsmandApplication app, ProfileListener listener, boolean isBottomSheet) {
|
||||
this.items.addAll(items);
|
||||
this.items.add(MANAGE_BTN);
|
||||
this.listener = listener;
|
||||
this.app = app;
|
||||
this.selectedItems = selectedItems;
|
||||
this.isBottomSheet = isBottomSheet;
|
||||
selectedIconColorRes = isNightMode(app)
|
||||
? R.color.active_buttons_and_links_dark
|
||||
: R.color.active_buttons_and_links_light;
|
||||
}
|
||||
|
||||
public List<Object> getItems() {
|
||||
return items;
|
||||
}
|
||||
|
||||
|
@ -50,10 +66,6 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void setBottomSheetMode(boolean isBottomSheet) {
|
||||
this.isBottomSheet = isBottomSheet;
|
||||
}
|
||||
|
||||
public void setListener(ProfileListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
@ -62,10 +74,18 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
items.clear();
|
||||
this.selectedItems.clear();
|
||||
items.addAll(newList);
|
||||
if (isBottomSheet) {
|
||||
items.add(MANAGE_BTN);
|
||||
}
|
||||
this.selectedItems.addAll(selectedItems);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
return super.getItemViewType(position);
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public ProfileViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
|
@ -76,64 +96,85 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull final ProfileViewHolder holder, int position) {
|
||||
final ApplicationMode item = items.get(position);
|
||||
Object obj = items.get(position);
|
||||
|
||||
if (isBottomSheet) {
|
||||
holder.divider.setBackgroundColor(isNightMode(app)
|
||||
? app.getResources().getColor(R.color.divider_dark)
|
||||
: app.getResources().getColor(R.color.divider_light));
|
||||
}
|
||||
if (obj instanceof ApplicationMode) {
|
||||
final ApplicationMode item = (ApplicationMode) obj;
|
||||
if (isBottomSheet) {
|
||||
holder.divider.setBackgroundColor(isNightMode(app)
|
||||
? app.getResources().getColor(R.color.divider_dark)
|
||||
: app.getResources().getColor(R.color.divider_light));
|
||||
}
|
||||
|
||||
if (item.getParent() != null) {
|
||||
holder.title.setText(item.getUserProfileName());
|
||||
holder.descr.setText(String.format(app.getString(R.string.profile_type_descr_string),
|
||||
Algorithms.capitalizeFirstLetterAndLowercase(
|
||||
item.getParent().getStringKey().replace("_", " "))));
|
||||
} else {
|
||||
holder.title.setText(app.getResources().getString(item.getStringResource()));
|
||||
holder.descr.setText(R.string.profile_type_base_string);
|
||||
}
|
||||
if (item.getParent() != null) {
|
||||
holder.title.setText(item.getUserProfileName());
|
||||
holder.descr.setText(String.format(app.getString(R.string.profile_type_descr_string),
|
||||
Algorithms.capitalizeFirstLetterAndLowercase(
|
||||
item.getParent().getStringKey().replace("_", " "))));
|
||||
} else {
|
||||
holder.title.setText(app.getResources().getString(item.getStringResource()));
|
||||
holder.descr.setText(R.string.profile_type_base_string);
|
||||
}
|
||||
|
||||
holder.title.setTextColor(app.getResources().getColor(isNightMode(app)
|
||||
? R.color.main_font_dark
|
||||
: R.color.main_font_light));
|
||||
holder.title.setTextColor(app.getResources().getColor(isNightMode(app)
|
||||
? R.color.main_font_dark
|
||||
: R.color.main_font_light));
|
||||
|
||||
int iconRes = item.getParent() == null
|
||||
? item.getSmallIconDark()
|
||||
: ApplicationMode.getIconResFromName(app, item.getIconName(), app.getPackageName());
|
||||
int iconRes = item.getParent() == null
|
||||
? item.getSmallIconDark()
|
||||
: ApplicationMode.getIconResFromName(app, item.getIconName(), app.getPackageName());
|
||||
|
||||
if (iconRes == 0 || iconRes == -1) {
|
||||
iconRes = R.drawable.ic_action_world_globe;
|
||||
}
|
||||
if (iconRes == 0 || iconRes == -1) {
|
||||
iconRes = R.drawable.ic_action_world_globe;
|
||||
}
|
||||
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.aSwitch.setChecked(true);
|
||||
holder.icon
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(iconRes, selectedIconColorRes));
|
||||
} else {
|
||||
holder.aSwitch.setChecked(false);
|
||||
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color));
|
||||
}
|
||||
final int ficon = iconRes;
|
||||
|
||||
holder.aSwitch.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.changeProfileStatus(item, holder.aSwitch.isChecked());
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.icon.setImageDrawable(app.getUIUtilities()
|
||||
.getIcon(item.getSmallIconDark(), selectedIconColorRes));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(
|
||||
app.getUIUtilities().getIcon(item.getSmallIconDark(), R.color.icon_color));
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.aSwitch.setChecked(true);
|
||||
holder.icon
|
||||
.setImageDrawable(app.getUIUtilities().getIcon(iconRes, selectedIconColorRes));
|
||||
} else {
|
||||
holder.aSwitch.setChecked(false);
|
||||
holder.icon.setImageDrawable(app.getUIUtilities().getIcon(iconRes, R.color.icon_color));
|
||||
}
|
||||
|
||||
holder.aSwitch.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.changeProfileStatus(item, holder.aSwitch.isChecked());
|
||||
if (selectedItems.contains(item)) {
|
||||
holder.icon.setImageDrawable(app.getUIUtilities()
|
||||
.getIcon(ficon, selectedIconColorRes));
|
||||
} else {
|
||||
holder.icon.setImageDrawable(
|
||||
app.getUIUtilities().getIcon(ficon, R.color.icon_color));
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.editProfile(item);
|
||||
}
|
||||
});
|
||||
});
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
listener.editProfile(item);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
final String title = (String) obj;
|
||||
if (title.equals("manage_button"))
|
||||
holder.divider.setVisibility(View.INVISIBLE);
|
||||
holder.icon.setVisibility(View.INVISIBLE);
|
||||
holder.descr.setVisibility(View.GONE);
|
||||
holder.aSwitch.setVisibility(View.GONE);
|
||||
holder.menuIcon.setVisibility(View.GONE);
|
||||
holder.title.setTextColor(app.getResources().getColor(selectedIconColorRes));
|
||||
holder.title.setText(R.string.shared_string_manage);
|
||||
holder.profileOptions.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
app.startActivity(new Intent(app, SettingsProfileActivity.class));
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -149,7 +190,7 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
|
||||
TextView title, descr;
|
||||
SwitchCompat aSwitch;
|
||||
ImageView icon;
|
||||
ImageView icon, menuIcon;
|
||||
LinearLayout profileOptions;
|
||||
View divider;
|
||||
|
||||
|
@ -161,6 +202,7 @@ public class ProfileMenuAdapter extends RecyclerView.Adapter<ProfileViewHolder>
|
|||
icon = itemView.findViewById(R.id.icon);
|
||||
profileOptions = itemView.findViewById(R.id.profile_settings);
|
||||
divider = itemView.findViewById(R.id.divider_bottom);
|
||||
menuIcon = itemView.findViewById(R.id.menu_image);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -43,8 +43,6 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
private SelectProfileListener listener;
|
||||
|
||||
private final List<ProfileDataObject> profiles = new ArrayList<>();
|
||||
private final List<ApplicationMode> appModes = new ArrayList<>();
|
||||
private final Set<ApplicationMode> activeAppModes = new HashSet<>();
|
||||
|
||||
private List<IconResWithDescr> icons;
|
||||
private String selectedItemKey;
|
||||
|
@ -82,6 +80,12 @@ public class SelectProfileBottomSheetDialogFragment extends MenuBottomSheetDialo
|
|||
dismiss();
|
||||
}
|
||||
});
|
||||
|
||||
if (type.equals(TYPE_NAV_PROFILE) || type.equals(TYPE_BASE_APP_PROFILE)) {
|
||||
if (items.get(items.size()-1).getView() != null) {
|
||||
items.get(items.size()-1).getView().findViewById(R.id.divider_bottom).setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.view.LayoutInflater;
|
|||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import net.osmand.plus.ApplicationMode;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
|
@ -84,7 +85,8 @@ public class NavStartStopAction extends QuickAction {
|
|||
if (!helper.isRoutePlanningMode() && !helper.isFollowingMode()) {
|
||||
return ((MapActivity) context).getMapActions().getRouteMode(null).getSmallIconDark();
|
||||
}
|
||||
return helper.getAppMode().getSmallIconDark();
|
||||
return ApplicationMode.getIconResFromName(context, helper.getAppMode().getIconName(),
|
||||
context.getPackageName());
|
||||
}
|
||||
return super.getIconRes(context);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue