Merge pull request #11297 from osmandapp/fix_10072

Fix_10072
This commit is contained in:
vshcherb 2021-03-31 16:24:17 +02:00 committed by GitHub
commit ca80f13d13
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 3 deletions

View file

@ -47,7 +47,7 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
public static final String TAG = SendGpxBottomSheetFragment.class.getSimpleName(); public static final String TAG = SendGpxBottomSheetFragment.class.getSimpleName();
private GpxInfo[] gpxInfos; private GpxInfo[] gpxInfos;
private UploadVisibility selectedUploadVisibility = UploadVisibility.PUBLIC; private UploadVisibility selectedUploadVisibility;
private TextInputEditText tagsField; private TextInputEditText tagsField;
private TextInputEditText messageField; private TextInputEditText messageField;
@ -59,12 +59,15 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
@Override @Override
public void createMenuItems(Bundle savedInstanceState) { public void createMenuItems(Bundle savedInstanceState) {
OsmandApplication app = requiredMyApplication(); OsmandApplication app = requiredMyApplication();
OsmandSettings settings = app.getSettings(); final OsmandSettings settings = app.getSettings();
LayoutInflater themedInflater = UiUtilities.getInflater(app, nightMode); LayoutInflater themedInflater = UiUtilities.getInflater(app, nightMode);
View sendGpxView = themedInflater.inflate(R.layout.send_gpx_fragment, null); View sendGpxView = themedInflater.inflate(R.layout.send_gpx_fragment, null);
sendGpxView.getViewTreeObserver().addOnGlobalLayoutListener(getShadowLayoutListener()); sendGpxView.getViewTreeObserver().addOnGlobalLayoutListener(getShadowLayoutListener());
if (selectedUploadVisibility == null) {
selectedUploadVisibility = settings.OSM_UPLOAD_VISIBILITY.get();
}
tagsField = sendGpxView.findViewById(R.id.tags_field); tagsField = sendGpxView.findViewById(R.id.tags_field);
messageField = sendGpxView.findViewById(R.id.message_field); messageField = sendGpxView.findViewById(R.id.message_field);
@ -96,8 +99,9 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment {
horizontalSelectionAdapter.setSelectedItemByTitle(getString(selectedUploadVisibility.getTitleId())); horizontalSelectionAdapter.setSelectedItemByTitle(getString(selectedUploadVisibility.getTitleId()));
horizontalSelectionAdapter.setListener(new HorizontalSelectionAdapterListener() { horizontalSelectionAdapter.setListener(new HorizontalSelectionAdapterListener() {
@Override @Override
public void onItemSelected(HorizontalSelectionAdapter.HorizontalSelectionItem item) { public void onItemSelected(HorizontalSelectionItem item) {
selectedUploadVisibility = (OsmEditingPlugin.UploadVisibility) item.getObject(); selectedUploadVisibility = (OsmEditingPlugin.UploadVisibility) item.getObject();
settings.OSM_UPLOAD_VISIBILITY.set(selectedUploadVisibility);
visibilityName.setText(selectedUploadVisibility.getTitleId()); visibilityName.setText(selectedUploadVisibility.getTitleId());
visibilityDescription.setText(selectedUploadVisibility.getDescriptionId()); visibilityDescription.setText(selectedUploadVisibility.getDescriptionId());
horizontalSelectionAdapter.notifyDataSetChanged(); horizontalSelectionAdapter.notifyDataSetChanged();

View file

@ -47,6 +47,7 @@ import net.osmand.plus.helpers.enums.SpeedConstants;
import net.osmand.plus.helpers.enums.TracksSortByMode; import net.osmand.plus.helpers.enums.TracksSortByMode;
import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format; import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format;
import net.osmand.plus.mapmarkers.MapMarkersMode; import net.osmand.plus.mapmarkers.MapMarkersMode;
import net.osmand.plus.osmedit.OsmEditingPlugin.UploadVisibility;
import net.osmand.plus.profiles.LocationIcon; import net.osmand.plus.profiles.LocationIcon;
import net.osmand.plus.profiles.NavigationIcon; import net.osmand.plus.profiles.NavigationIcon;
import net.osmand.plus.profiles.ProfileIconColors; import net.osmand.plus.profiles.ProfileIconColors;
@ -1135,6 +1136,7 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public final OsmandPreference<String> OSM_USER_NAME = new StringPreference(this, "user_name", "").makeGlobal().makeShared(); public final OsmandPreference<String> OSM_USER_NAME = new StringPreference(this, "user_name", "").makeGlobal().makeShared();
public final OsmandPreference<String> OSM_USER_DISPLAY_NAME = new StringPreference(this, "user_display_name", "").makeGlobal().makeShared(); public final OsmandPreference<String> OSM_USER_DISPLAY_NAME = new StringPreference(this, "user_display_name", "").makeGlobal().makeShared();
public final CommonPreference<UploadVisibility> OSM_UPLOAD_VISIBILITY = new EnumStringPreference<>(this, "upload_visibility", UploadVisibility.PUBLIC, UploadVisibility.values()).makeGlobal().makeShared();
public static final String BILLING_USER_DONATION_WORLD_PARAMETER = ""; public static final String BILLING_USER_DONATION_WORLD_PARAMETER = "";
public static final String BILLING_USER_DONATION_NONE_PARAMETER = "none"; public static final String BILLING_USER_DONATION_NONE_PARAMETER = "none";