add default profile name for unnamed or missing improted profiles.

This commit is contained in:
nnngrach 2021-02-02 18:40:12 +03:00
parent 52bc6c02e7
commit e57404470d
3 changed files with 13 additions and 3 deletions

View file

@ -124,7 +124,7 @@ public class ProfileSettingsItem extends OsmandSettingsItem {
if (Algorithms.isEmpty(modeBean.userProfileName)) {
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
if (appMode != null) {
modeBean.userProfileName = app.getString(appMode.getNameKeyResource());
modeBean.userProfileName = appMode.toHumanString();
}
}
int number = 0;

View file

@ -34,6 +34,7 @@ import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.util.Algorithms;
import org.apache.commons.logging.Log;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.List;
@ -91,7 +92,11 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter<RecyclerView
String profileName = modeBean.userProfileName;
if (Algorithms.isEmpty(profileName)) {
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
profileName = app.getString(appMode.getNameKeyResource());
if (appMode != null) {
profileName = appMode.toHumanString();
} else {
profileName = StringUtils.capitalize(modeBean.stringKey);
}
}
itemHolder.title.setText(profileName);
String routingProfile = "";

View file

@ -62,6 +62,7 @@ import net.osmand.util.Algorithms;
import net.osmand.view.ThreeStateCheckbox;
import org.apache.commons.logging.Log;
import org.apache.commons.lang3.StringUtils;
import java.io.File;
import java.util.ArrayList;
@ -279,7 +280,11 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
String profileName = modeBean.userProfileName;
if (Algorithms.isEmpty(profileName)) {
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
if (appMode != null) {
profileName = appMode.toHumanString();
} else {
profileName = StringUtils.capitalize(modeBean.stringKey);
}
}
builder.setTitle(profileName);