Revert "add default profile name for unnamed or missing improted profiles"

This reverts commit 56e8f85c04.
This commit is contained in:
nnngrach 2021-02-02 04:03:51 +03:00
parent c2a88ef523
commit 4b6fa3bbef
3 changed files with 3 additions and 16 deletions

View file

@ -26,7 +26,6 @@ import java.util.Iterator;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
import org.apache.commons.lang3.StringUtils;
public class ProfileSettingsItem extends OsmandSettingsItem { public class ProfileSettingsItem extends OsmandSettingsItem {
@ -125,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 = appMode.toHumanString(); modeBean.userProfileName = app.getString(appMode.getNameKeyResource());
} }
} }
int number = 0; int number = 0;

View file

@ -33,7 +33,6 @@ import net.osmand.plus.settings.backend.ApplicationMode;
import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean; import net.osmand.plus.settings.backend.ApplicationMode.ApplicationModeBean;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.io.File; import java.io.File;
@ -92,11 +91,7 @@ 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);
try { profileName = app.getString(appMode.getNameKeyResource());
profileName = app.getString(appMode.getNameKeyResource());
} catch (Exception e) {
profileName = StringUtils.capitalize(modeBean.stringKey);
}
} }
itemHolder.title.setText(profileName); itemHolder.title.setText(profileName);
String routingProfile = ""; String routingProfile = "";

View file

@ -61,7 +61,6 @@ import net.osmand.plus.settings.fragments.ExportSettingsAdapter.OnItemSelectedLi
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.view.ThreeStateCheckbox; import net.osmand.view.ThreeStateCheckbox;
import org.apache.commons.lang3.StringUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import java.io.File; import java.io.File;
@ -280,13 +279,7 @@ 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);
if (appMode != null) { profileName = appMode.toHumanString();
profileName = appMode.toHumanString();
} else {
String defaultProfileName = StringUtils.capitalize(modeBean.stringKey);
profileName = defaultProfileName;
modeBean.userProfileName = defaultProfileName;
}
} }
builder.setTitle(profileName); builder.setTitle(profileName);