Fix doesn`t update profile data selected previously
(cherry picked from commit fabc631520
)
This commit is contained in:
parent
f094c01269
commit
fb9c94340c
2 changed files with 3 additions and 23 deletions
|
@ -698,7 +698,7 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
ProfileAppearanceFragment profileAppearanceFragment = getProfileAppearanceFragment();
|
ProfileAppearanceFragment profileAppearanceFragment = getProfileAppearanceFragment();
|
||||||
if (profileAppearanceFragment != null) {
|
if (profileAppearanceFragment != null) {
|
||||||
if (profileAppearanceFragment.isProfileAppearanceChanged(this)) {
|
if (profileAppearanceFragment.isProfileAppearanceChanged()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -36,13 +36,11 @@ import net.osmand.plus.ApplicationMode;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
import net.osmand.plus.UiUtilities.DialogButtonType;
|
import net.osmand.plus.UiUtilities.DialogButtonType;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
|
||||||
import net.osmand.plus.profiles.LocationIcon;
|
import net.osmand.plus.profiles.LocationIcon;
|
||||||
import net.osmand.plus.profiles.NavigationIcon;
|
import net.osmand.plus.profiles.NavigationIcon;
|
||||||
import net.osmand.plus.profiles.ProfileIconColors;
|
import net.osmand.plus.profiles.ProfileIconColors;
|
||||||
import net.osmand.plus.profiles.ProfileIcons;
|
import net.osmand.plus.profiles.ProfileIcons;
|
||||||
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment;
|
import net.osmand.plus.profiles.SelectProfileBottomSheetDialogFragment;
|
||||||
import net.osmand.plus.routing.RouteProvider;
|
|
||||||
import net.osmand.plus.widgets.FlowLayout;
|
import net.osmand.plus.widgets.FlowLayout;
|
||||||
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
|
import net.osmand.plus.widgets.OsmandTextFieldBoxes;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -116,8 +114,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
profile.name = baseModeForNewProfile.toHumanString();
|
profile.name = baseModeForNewProfile.toHumanString();
|
||||||
profile.color = baseModeForNewProfile.getIconColorInfo();
|
profile.color = baseModeForNewProfile.getIconColorInfo();
|
||||||
profile.iconRes = baseModeForNewProfile.getIconRes();
|
profile.iconRes = baseModeForNewProfile.getIconRes();
|
||||||
profile.routingProfile = baseModeForNewProfile.getRoutingProfile();
|
|
||||||
profile.routeService = baseModeForNewProfile.getRouteService();
|
|
||||||
profile.locationIcon = baseModeForNewProfile.getLocationIcon();
|
profile.locationIcon = baseModeForNewProfile.getLocationIcon();
|
||||||
profile.navigationIcon = baseModeForNewProfile.getNavigationIcon();
|
profile.navigationIcon = baseModeForNewProfile.getNavigationIcon();
|
||||||
} else {
|
} else {
|
||||||
|
@ -126,8 +122,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
profile.name = getSelectedAppMode().toHumanString();
|
profile.name = getSelectedAppMode().toHumanString();
|
||||||
profile.color = getSelectedAppMode().getIconColorInfo();
|
profile.color = getSelectedAppMode().getIconColorInfo();
|
||||||
profile.iconRes = getSelectedAppMode().getIconRes();
|
profile.iconRes = getSelectedAppMode().getIconRes();
|
||||||
profile.routingProfile = getSelectedAppMode().getRoutingProfile();
|
|
||||||
profile.routeService = getSelectedAppMode().getRouteService();
|
|
||||||
profile.locationIcon = getSelectedAppMode().getLocationIcon();
|
profile.locationIcon = getSelectedAppMode().getLocationIcon();
|
||||||
profile.navigationIcon = getSelectedAppMode().getNavigationIcon();
|
profile.navigationIcon = getSelectedAppMode().getNavigationIcon();
|
||||||
}
|
}
|
||||||
|
@ -144,8 +138,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
}
|
}
|
||||||
changedProfile.color = profile.color;
|
changedProfile.color = profile.color;
|
||||||
changedProfile.iconRes = profile.iconRes;
|
changedProfile.iconRes = profile.iconRes;
|
||||||
changedProfile.routingProfile = profile.routingProfile;
|
|
||||||
changedProfile.routeService = profile.routeService;
|
|
||||||
changedProfile.locationIcon = profile.locationIcon;
|
changedProfile.locationIcon = profile.locationIcon;
|
||||||
changedProfile.navigationIcon = profile.navigationIcon;
|
changedProfile.navigationIcon = profile.navigationIcon;
|
||||||
}
|
}
|
||||||
|
@ -388,7 +380,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
for (ProfileIconColors color : ProfileIconColors.values()) {
|
for (ProfileIconColors color : ProfileIconColors.values()) {
|
||||||
View colorItem = createColorItemView(color, colorItems);
|
View colorItem = createColorItemView(color, colorItems);
|
||||||
colorItems.addView(colorItem, new FlowLayout.LayoutParams(0, 0));
|
colorItems.addView(colorItem, new FlowLayout.LayoutParams(0, 0));
|
||||||
|
|
||||||
}
|
}
|
||||||
updateColorSelector(changedProfile.color);
|
updateColorSelector(changedProfile.color);
|
||||||
} else if (ICON_ITEMS.equals(preference.getKey())) {
|
} else if (ICON_ITEMS.equals(preference.getKey())) {
|
||||||
|
@ -663,12 +654,11 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (isNewProfile) {
|
if (isNewProfile) {
|
||||||
|
changedProfile.stringKey = changedProfile.parent.getStringKey() + "_" + System.currentTimeMillis();
|
||||||
ApplicationMode.ApplicationModeBuilder builder = ApplicationMode
|
ApplicationMode.ApplicationModeBuilder builder = ApplicationMode
|
||||||
.createCustomMode(changedProfile.parent, changedProfile.stringKey, app)
|
.createCustomMode(changedProfile.parent, changedProfile.stringKey, app)
|
||||||
.setIconResName(ProfileIcons.getResStringByResId(changedProfile.iconRes))
|
.setIconResName(ProfileIcons.getResStringByResId(changedProfile.iconRes))
|
||||||
.setUserProfileName(changedProfile.name.trim())
|
.setUserProfileName(changedProfile.name.trim())
|
||||||
.setRoutingProfile(changedProfile.routingProfile)
|
|
||||||
.setRouteService(changedProfile.routeService)
|
|
||||||
.setIconColor(changedProfile.color)
|
.setIconColor(changedProfile.color)
|
||||||
.setLocationIcon(changedProfile.locationIcon)
|
.setLocationIcon(changedProfile.locationIcon)
|
||||||
.setNavigationIcon(changedProfile.navigationIcon);
|
.setNavigationIcon(changedProfile.navigationIcon);
|
||||||
|
@ -683,13 +673,10 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
mode.setParentAppMode(changedProfile.parent);
|
mode.setParentAppMode(changedProfile.parent);
|
||||||
mode.setIconResName(ProfileIcons.getResStringByResId(changedProfile.iconRes));
|
mode.setIconResName(ProfileIcons.getResStringByResId(changedProfile.iconRes));
|
||||||
mode.setUserProfileName(changedProfile.name.trim());
|
mode.setUserProfileName(changedProfile.name.trim());
|
||||||
mode.setRoutingProfile(changedProfile.routingProfile);
|
|
||||||
mode.setRouteService(changedProfile.routeService);
|
|
||||||
mode.setIconColor(changedProfile.color);
|
mode.setIconColor(changedProfile.color);
|
||||||
mode.setLocationIcon(changedProfile.locationIcon);
|
mode.setLocationIcon(changedProfile.locationIcon);
|
||||||
mode.setNavigationIcon(changedProfile.navigationIcon);
|
mode.setNavigationIcon(changedProfile.navigationIcon);
|
||||||
}
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -712,7 +699,7 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
profileNameOtfb.setError(errorMessage, true);
|
profileNameOtfb.setError(errorMessage, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean isProfileAppearanceChanged(final MapActivity mapActivity) {
|
public boolean isProfileAppearanceChanged() {
|
||||||
hideKeyboard();
|
hideKeyboard();
|
||||||
if (isChanged()) {
|
if (isChanged()) {
|
||||||
AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(),
|
AlertDialog.Builder dismissDialog = createWarningDialog(getActivity(),
|
||||||
|
@ -782,8 +769,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
String name;
|
String name;
|
||||||
ProfileIconColors color;
|
ProfileIconColors color;
|
||||||
int iconRes;
|
int iconRes;
|
||||||
String routingProfile;
|
|
||||||
RouteProvider.RouteService routeService;
|
|
||||||
NavigationIcon navigationIcon;
|
NavigationIcon navigationIcon;
|
||||||
LocationIcon locationIcon;
|
LocationIcon locationIcon;
|
||||||
|
|
||||||
|
@ -800,9 +785,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
if (parent != null ? !parent.equals(that.parent) : that.parent != null) return false;
|
if (parent != null ? !parent.equals(that.parent) : that.parent != null) return false;
|
||||||
if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
if (name != null ? !name.equals(that.name) : that.name != null) return false;
|
||||||
if (color != that.color) return false;
|
if (color != that.color) return false;
|
||||||
if (routingProfile != null ? !routingProfile.equals(that.routingProfile) : that.routingProfile != null)
|
|
||||||
return false;
|
|
||||||
if (routeService != that.routeService) return false;
|
|
||||||
if (navigationIcon != that.navigationIcon) return false;
|
if (navigationIcon != that.navigationIcon) return false;
|
||||||
return locationIcon == that.locationIcon;
|
return locationIcon == that.locationIcon;
|
||||||
}
|
}
|
||||||
|
@ -814,8 +796,6 @@ public class ProfileAppearanceFragment extends BaseSettingsFragment {
|
||||||
result = 31 * result + (name != null ? name.hashCode() : 0);
|
result = 31 * result + (name != null ? name.hashCode() : 0);
|
||||||
result = 31 * result + (color != null ? color.hashCode() : 0);
|
result = 31 * result + (color != null ? color.hashCode() : 0);
|
||||||
result = 31 * result + iconRes;
|
result = 31 * result + iconRes;
|
||||||
result = 31 * result + (routingProfile != null ? routingProfile.hashCode() : 0);
|
|
||||||
result = 31 * result + (routeService != null ? routeService.hashCode() : 0);
|
|
||||||
result = 31 * result + (navigationIcon != null ? navigationIcon.hashCode() : 0);
|
result = 31 * result + (navigationIcon != null ? navigationIcon.hashCode() : 0);
|
||||||
result = 31 * result + (locationIcon != null ? locationIcon.hashCode() : 0);
|
result = 31 * result + (locationIcon != null ? locationIcon.hashCode() : 0);
|
||||||
return result;
|
return result;
|
||||||
|
|
Loading…
Reference in a new issue