Merge pull request #10747 from osmandapp/add_default_profile_name2

Add default name for imported profiles
This commit is contained in:
Vitaliy 2021-02-02 15:43:36 +00:00 committed by GitHub
commit 53d30621cd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
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);
profileName = appMode.toHumanString();
if (appMode != null) {
profileName = appMode.toHumanString();
} else {
profileName = StringUtils.capitalize(modeBean.stringKey);
}
}
builder.setTitle(profileName);