add default profile name for unnamed or missing improted profiles.
This commit is contained in:
parent
52bc6c02e7
commit
e57404470d
3 changed files with 13 additions and 3 deletions
|
@ -124,7 +124,7 @@ public class ProfileSettingsItem extends OsmandSettingsItem {
|
||||||
if (Algorithms.isEmpty(modeBean.userProfileName)) {
|
if (Algorithms.isEmpty(modeBean.userProfileName)) {
|
||||||
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
|
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
|
||||||
if (appMode != null) {
|
if (appMode != null) {
|
||||||
modeBean.userProfileName = app.getString(appMode.getNameKeyResource());
|
modeBean.userProfileName = appMode.toHumanString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
int number = 0;
|
int number = 0;
|
||||||
|
|
|
@ -34,6 +34,7 @@ import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
@ -91,7 +92,11 @@ public class DuplicatesSettingsAdapter extends RecyclerView.Adapter<RecyclerView
|
||||||
String profileName = modeBean.userProfileName;
|
String profileName = modeBean.userProfileName;
|
||||||
if (Algorithms.isEmpty(profileName)) {
|
if (Algorithms.isEmpty(profileName)) {
|
||||||
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
|
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);
|
itemHolder.title.setText(profileName);
|
||||||
String routingProfile = "";
|
String routingProfile = "";
|
||||||
|
|
|
@ -62,6 +62,7 @@ import net.osmand.util.Algorithms;
|
||||||
import net.osmand.view.ThreeStateCheckbox;
|
import net.osmand.view.ThreeStateCheckbox;
|
||||||
|
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
@ -279,7 +280,11 @@ public class ExportItemsBottomSheet extends MenuBottomSheetDialogFragment {
|
||||||
String profileName = modeBean.userProfileName;
|
String profileName = modeBean.userProfileName;
|
||||||
if (Algorithms.isEmpty(profileName)) {
|
if (Algorithms.isEmpty(profileName)) {
|
||||||
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
|
ApplicationMode appMode = ApplicationMode.valueOfStringKey(modeBean.stringKey, null);
|
||||||
profileName = appMode.toHumanString();
|
if (appMode != null) {
|
||||||
|
profileName = appMode.toHumanString();
|
||||||
|
} else {
|
||||||
|
profileName = StringUtils.capitalize(modeBean.stringKey);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
builder.setTitle(profileName);
|
builder.setTitle(profileName);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue