fix empty profile name on main settings screen

This commit is contained in:
nnngrach 2021-02-19 03:39:42 +03:00
parent e4b902c6f4
commit ffc5e1d83e
2 changed files with 9 additions and 3 deletions

View file

@ -15,6 +15,8 @@ import net.osmand.plus.profiles.ProfileIconColors;
import net.osmand.plus.routing.RouteProvider.RouteService;
import net.osmand.util.Algorithms;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
@ -330,8 +332,12 @@ public class ApplicationMode {
public String toHumanString() {
String userProfileName = getUserProfileName();
if (Algorithms.isEmpty(userProfileName) && keyName != -1) {
return app.getString(keyName);
if (Algorithms.isEmpty(userProfileName)) {
if (keyName != -1) {
return app.getString(keyName);
} else {
return StringUtils.capitalize(getStringKey());
}
} else {
return userProfileName;
}

View file

@ -465,7 +465,7 @@ public class ConfigureProfileFragment extends BaseSettingsFragment implements Co
bld.setTitle(R.string.profile_alert_delete_title);
bld.setMessage(String
.format(getString(R.string.profile_alert_delete_msg),
profile.getUserProfileName()));
profile.toHumanString()));
bld.setPositiveButton(R.string.shared_string_delete,
new DialogInterface.OnClickListener() {
@Override