diff --git a/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml b/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml index fd88a16090..8f6905a59c 100644 --- a/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml +++ b/OsmAnd/res/layout/fragment_data_storage_place_dialog.xml @@ -62,7 +62,6 @@ android:id="@+id/description" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_gravity="fill_horizontal" android:layout_marginTop="4dp" android:layout_marginBottom="24dp" android:text="@string/application_dir_description" diff --git a/OsmAnd/res/layout/wpt_list_item.xml b/OsmAnd/res/layout/wpt_list_item.xml index 1c018bd5d7..8269cc01ef 100644 --- a/OsmAnd/res/layout/wpt_list_item.xml +++ b/OsmAnd/res/layout/wpt_list_item.xml @@ -1,157 +1,158 @@ - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index e871969042..620224d466 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -939,12 +939,10 @@ public class GpxUiHelper { @Nullable public static GPXInfo getGpxInfoByFileName(@NonNull OsmandApplication app, @NonNull String fileName) { - final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); - List infoList = getSortedGPXFilesInfo(dir, null, false); - for (GPXInfo info : infoList) { - if (Algorithms.objectEquals(info.getFileName(), fileName)) { - return info; - } + File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR); + File file = new File(dir, fileName); + if (file.exists() && file.getName().endsWith(GPX_FILE_EXT)) { + return new GPXInfo(fileName, file.lastModified(), file.length()); } return null; } diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java index 45d0e348f2..3907bb69dd 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/builders/AmenityMenuBuilder.java @@ -13,6 +13,9 @@ import android.widget.ImageView; import android.widget.LinearLayout; import android.widget.TextView; +import androidx.annotation.NonNull; +import androidx.core.content.ContextCompat; + import net.osmand.AndroidUtils; import net.osmand.PlatformUtil; import net.osmand.data.Amenity; @@ -60,9 +63,6 @@ import java.util.Locale; import java.util.Map; import java.util.Set; -import androidx.annotation.NonNull; -import androidx.core.content.ContextCompat; - public class AmenityMenuBuilder extends MenuBuilder { private static final String WIKI_LINK = ".wikipedia.org/w"; @@ -346,7 +346,7 @@ public class AmenityMenuBuilder extends MenuBuilder { boolean isWiki = false; boolean isText = false; boolean isDescription = false; - boolean needLinks = !("population".equals(key) || "height".equals(key)); + boolean needLinks = !("population".equals(key) || "height".equals(key) || Amenity.OPENING_HOURS.equals(key)); boolean needIntFormatting = "population".equals(key); boolean isPhoneNumber = false; boolean isUrl = false; @@ -371,7 +371,7 @@ public class AmenityMenuBuilder extends MenuBuilder { if (vl.startsWith("http://") || vl.startsWith("https://") || vl.startsWith("HTTP://") || vl.startsWith("HTTPS://")) { isUrl = true; - } else { + } else if (needLinks) { socialMediaUrl = getSocialMediaUrl(key, vl); if (socialMediaUrl != null) { isUrl = true; diff --git a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendGpxBottomSheetFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendGpxBottomSheetFragment.java index 2e66d01970..ae3871547e 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendGpxBottomSheetFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/dialogs/SendGpxBottomSheetFragment.java @@ -47,7 +47,7 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment { public static final String TAG = SendGpxBottomSheetFragment.class.getSimpleName(); private GpxInfo[] gpxInfos; - private UploadVisibility selectedUploadVisibility = UploadVisibility.PUBLIC; + private UploadVisibility selectedUploadVisibility; private TextInputEditText tagsField; private TextInputEditText messageField; @@ -59,12 +59,15 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment { @Override public void createMenuItems(Bundle savedInstanceState) { OsmandApplication app = requiredMyApplication(); - OsmandSettings settings = app.getSettings(); + final OsmandSettings settings = app.getSettings(); LayoutInflater themedInflater = UiUtilities.getInflater(app, nightMode); View sendGpxView = themedInflater.inflate(R.layout.send_gpx_fragment, null); sendGpxView.getViewTreeObserver().addOnGlobalLayoutListener(getShadowLayoutListener()); + if (selectedUploadVisibility == null) { + selectedUploadVisibility = settings.OSM_UPLOAD_VISIBILITY.get(); + } tagsField = sendGpxView.findViewById(R.id.tags_field); messageField = sendGpxView.findViewById(R.id.message_field); @@ -96,8 +99,9 @@ public class SendGpxBottomSheetFragment extends MenuBottomSheetDialogFragment { horizontalSelectionAdapter.setSelectedItemByTitle(getString(selectedUploadVisibility.getTitleId())); horizontalSelectionAdapter.setListener(new HorizontalSelectionAdapterListener() { @Override - public void onItemSelected(HorizontalSelectionAdapter.HorizontalSelectionItem item) { + public void onItemSelected(HorizontalSelectionItem item) { selectedUploadVisibility = (OsmEditingPlugin.UploadVisibility) item.getObject(); + settings.OSM_UPLOAD_VISIBILITY.set(selectedUploadVisibility); visibilityName.setText(selectedUploadVisibility.getTitleId()); visibilityDescription.setText(selectedUploadVisibility.getDescriptionId()); horizontalSelectionAdapter.notifyDataSetChanged(); diff --git a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java index d1cd8fd622..39f3cf3d92 100644 --- a/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/settings/backend/OsmandSettings.java @@ -47,6 +47,7 @@ import net.osmand.plus.helpers.enums.SpeedConstants; import net.osmand.plus.helpers.enums.TracksSortByMode; import net.osmand.plus.mapmarkers.CoordinateInputFormats.Format; import net.osmand.plus.mapmarkers.MapMarkersMode; +import net.osmand.plus.osmedit.OsmEditingPlugin.UploadVisibility; import net.osmand.plus.profiles.LocationIcon; import net.osmand.plus.profiles.NavigationIcon; import net.osmand.plus.profiles.ProfileIconColors; @@ -1135,6 +1136,7 @@ public class OsmandSettings { // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference OSM_USER_NAME = new StringPreference(this, "user_name", "").makeGlobal().makeShared(); public final OsmandPreference OSM_USER_DISPLAY_NAME = new StringPreference(this, "user_display_name", "").makeGlobal().makeShared(); + public final CommonPreference 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_NONE_PARAMETER = "none"; diff --git a/OsmAnd/src/net/osmand/plus/track/OptionsCard.java b/OsmAnd/src/net/osmand/plus/track/OptionsCard.java index fef9f34f0b..44596ff8cf 100644 --- a/OsmAnd/src/net/osmand/plus/track/OptionsCard.java +++ b/OsmAnd/src/net/osmand/plus/track/OptionsCard.java @@ -10,6 +10,7 @@ import androidx.annotation.NonNull; import net.osmand.AndroidUtils; import net.osmand.GPXUtilities.GPXFile; +import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile; import net.osmand.plus.OsmandPlugin; import net.osmand.plus.R; import net.osmand.plus.UiUtilities; @@ -47,13 +48,15 @@ public class OptionsCard extends BaseCard { public static final int DELETE_BUTTON_INDEX = 11; private TrackDisplayHelper displayHelper; + private SelectedGpxFile selectedGpxFile; private GPXFile gpxFile; private List items = new ArrayList<>(); - public OptionsCard(@NonNull MapActivity mapActivity, TrackDisplayHelper displayHelper) { + public OptionsCard(@NonNull MapActivity mapActivity, TrackDisplayHelper displayHelper, SelectedGpxFile selectedGpxFile) { super(mapActivity); this.displayHelper = displayHelper; this.gpxFile = displayHelper.getGpx(); + this.selectedGpxFile = selectedGpxFile; } @Override @@ -254,7 +257,7 @@ public class OptionsCard extends BaseCard { private BaseBottomSheetItem createUploadOsmItem() { OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class); - if (osmEditingPlugin != null) { + if (osmEditingPlugin != null && selectedGpxFile.getTrackAnalysis(app).isTimeMoving()) { return new SimpleBottomSheetItem.Builder() .setIcon(getActiveIcon(R.drawable.ic_action_export)) .setTitle(app.getString(R.string.upload_to_openstreetmap)) diff --git a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java index ef2bd196a7..18d35953a0 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackMenuFragment.java @@ -242,7 +242,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card loadSelectedGpxFile(mapActivity, path, showCurrentTrack, new CallbackWithObject() { @Override public boolean processResult(SelectedGpxFile result) { - selectedGpxFile = result; + setSelectedGpxFile(result); setupDisplayHelper(); if (getView() != null) { initContent(getView()); @@ -514,7 +514,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card } cardsContainer.addView(optionsCard.getView()); } else { - optionsCard = new OptionsCard(mapActivity, displayHelper); + optionsCard = new OptionsCard(mapActivity, displayHelper, selectedGpxFile); optionsCard.setListener(this); cardsContainer.addView(optionsCard.build(mapActivity)); }