Add browse map profile color changes

This commit is contained in:
Dima-1 2020-01-15 18:53:15 +02:00
parent 5f09de60c0
commit 27278fd802
5 changed files with 17 additions and 13 deletions

View file

@ -11,8 +11,10 @@
Thx - Hardy Thx - Hardy
--> -->
<string name="ltr_or_rtl_combine_via_space">%1$s %2$s</string> <string name="app_mode_osm">OSM</string>
<string name="ltr_or_rtl_combine_via_colon">%1$s: %2$s</string> <string name="select_nav_icon_descr">You will see the icon only while navigation or while moving.</string>
<string name="select_map_icon_descr">Map icon appears only on the map, and changing while navigation to navigation icon.</string>
<string name="ltr_or_rtl_combine">%1$s: %2$s</string>
<string name="reset_confirmation_descr">By clicking %1$s, you will lose all your changes.</string> <string name="reset_confirmation_descr">By clicking %1$s, you will lose all your changes.</string>
<string name="reset_all_profile_settings_descr">All profile settings will be reset to the state after installation.</string> <string name="reset_all_profile_settings_descr">All profile settings will be reset to the state after installation.</string>
<string name="reset_all_profile_settings">Reset all profile settings to default?</string> <string name="reset_all_profile_settings">Reset all profile settings to default?</string>

View file

@ -832,6 +832,7 @@ public class ApplicationMode {
} }
public enum ProfileIcons { public enum ProfileIcons {
DEFAULT(R.drawable.ic_world_globe_dark, R.string.app_mode_default, "ic_world_globe_dark"),
CAR(R.drawable.ic_action_car_dark, R.string.app_mode_car, "ic_action_car_dark"), CAR(R.drawable.ic_action_car_dark, R.string.app_mode_car, "ic_action_car_dark"),
TAXI(R.drawable.ic_action_taxi, R.string.app_mode_taxi, "ic_action_taxi"), TAXI(R.drawable.ic_action_taxi, R.string.app_mode_taxi, "ic_action_taxi"),
TRUCK(R.drawable.ic_action_truck_dark, R.string.app_mode_truck, "ic_action_truck_dark"), TRUCK(R.drawable.ic_action_truck_dark, R.string.app_mode_truck, "ic_action_truck_dark"),
@ -856,7 +857,8 @@ public class ApplicationMode {
CAMPER(R.drawable.ic_action_camper, R.string.app_mode_camper, "ic_action_camper"), CAMPER(R.drawable.ic_action_camper, R.string.app_mode_camper, "ic_action_camper"),
PICKUP_TRUCK(R.drawable.ic_action_pickup_truck, R.string.app_mode_pickup_truck, "ic_action_pickup_truck"), PICKUP_TRUCK(R.drawable.ic_action_pickup_truck, R.string.app_mode_pickup_truck, "ic_action_pickup_truck"),
WAGON(R.drawable.ic_action_wagon, R.string.app_mode_wagon, "ic_action_wagon"), WAGON(R.drawable.ic_action_wagon, R.string.app_mode_wagon, "ic_action_wagon"),
UTV(R.drawable.ic_action_utv, R.string.app_mode_utv, "ic_action_utv"); UTV(R.drawable.ic_action_utv, R.string.app_mode_utv, "ic_action_utv"),
OSM(R.drawable.ic_action_osmand_logo, R.string.app_mode_osm, "ic_action_osmand_logo");
@DrawableRes @DrawableRes
private int resId; private int resId;
@ -896,7 +898,7 @@ public class ApplicationMode {
return pi.resStringId; return pi.resStringId;
} }
} }
return CAR.getResStringId(); return DEFAULT.getResStringId();
} }
} }

View file

@ -265,14 +265,9 @@ public class ConfigureProfileFragment extends BaseSettingsFragment {
if (ctx == null) { if (ctx == null) {
return; return;
} }
Preference configureMap = findPreference(PROFILE_APPEARANCE); Preference configureMap = findPreference(PROFILE_APPEARANCE);
if (!getSelectedAppMode().equals(ApplicationMode.DEFAULT)) { configureMap.setIcon(getContentIcon(getSelectedAppMode().getIconRes()));
configureMap.setIcon(getContentIcon(getSelectedAppMode().getIconRes())); configureMap.setFragment(ProfileAppearanceFragment.TAG);
configureMap.setFragment(ProfileAppearanceFragment.TAG);
} else {
configureMap.setVisible(false);
}
} }
private void setupCopyProfileSettingsPref() { private void setupCopyProfileSettingsPref() {

View file

@ -59,9 +59,7 @@ public class MainSettingsFragment extends BaseSettingsFragment {
@Override @Override
protected void setupPreferences() { protected void setupPreferences() {
allAppModes = new ArrayList<>(ApplicationMode.allPossibleValues()); allAppModes = new ArrayList<>(ApplicationMode.allPossibleValues());
allAppModes.remove(ApplicationMode.DEFAULT);
availableAppModes = new LinkedHashSet<>(ApplicationMode.values(getMyApplication())); availableAppModes = new LinkedHashSet<>(ApplicationMode.values(getMyApplication()));
availableAppModes.remove(ApplicationMode.DEFAULT);
Preference globalSettings = findPreference("global_settings"); Preference globalSettings = findPreference("global_settings");
globalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings)); globalSettings.setIcon(getContentIcon(R.drawable.ic_action_settings));
PreferenceCategory selectedProfile = (PreferenceCategory) findPreference(SELECTED_PROFILE); PreferenceCategory selectedProfile = (PreferenceCategory) findPreference(SELECTED_PROFILE);

View file

@ -183,6 +183,10 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
findPreference(SELECT_ICON).setIconSpaceReserved(false); findPreference(SELECT_ICON).setIconSpaceReserved(false);
findPreference(SELECT_LOCATION_ICON).setIconSpaceReserved(false); findPreference(SELECT_LOCATION_ICON).setIconSpaceReserved(false);
findPreference(SELECT_NAV_ICON).setIconSpaceReserved(false); findPreference(SELECT_NAV_ICON).setIconSpaceReserved(false);
if (getSelectedAppMode().equals(ApplicationMode.DEFAULT)) {
findPreference(SELECT_ICON).setVisible(false);
findPreference(ICON_ITEMS).setVisible(false);
}
} }
@SuppressLint("InlinedApi") @SuppressLint("InlinedApi")
@ -326,6 +330,9 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
} }
} }
}); });
if (getSelectedAppMode().equals(ApplicationMode.DEFAULT)) {
profileName.setFocusable(false);
}
profileNameOtfb = (OsmandTextFieldBoxes) holder.findViewById(R.id.profile_name_otfb); profileNameOtfb = (OsmandTextFieldBoxes) holder.findViewById(R.id.profile_name_otfb);
} else if (MASTER_PROFILE.equals(preference.getKey())) { } else if (MASTER_PROFILE.equals(preference.getKey())) {
baseProfileName = (EditText) holder.findViewById(R.id.master_profile_et); baseProfileName = (EditText) holder.findViewById(R.id.master_profile_et);