commit
3b2608cdec
8 changed files with 159 additions and 152 deletions
|
@ -62,7 +62,6 @@
|
||||||
android:id="@+id/description"
|
android:id="@+id/description"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="fill_horizontal"
|
|
||||||
android:layout_marginTop="4dp"
|
android:layout_marginTop="4dp"
|
||||||
android:layout_marginBottom="24dp"
|
android:layout_marginBottom="24dp"
|
||||||
android:text="@string/application_dir_description"
|
android:text="@string/application_dir_description"
|
||||||
|
|
|
@ -1,6 +1,5 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
|
||||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||||
xmlns:tools="http://schemas.android.com/tools"
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -36,46 +35,48 @@
|
||||||
android:id="@+id/list_divider"
|
android:id="@+id/list_divider"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
|
android:layout_marginStart="64dp"
|
||||||
android:layout_marginLeft="64dp"
|
android:layout_marginLeft="64dp"
|
||||||
android:background="?attr/dashboard_divider"
|
android:background="?attr/dashboard_divider"
|
||||||
android:visibility="gone"
|
android:visibility="gone" />
|
||||||
android:layout_marginStart="64dp" />
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:gravity="center_vertical"
|
android:gravity="center_vertical"
|
||||||
android:paddingLeft="@dimen/list_content_padding"
|
|
||||||
android:orientation="horizontal"
|
android:orientation="horizontal"
|
||||||
android:paddingStart="@dimen/list_content_padding">
|
android:paddingStart="@dimen/list_content_padding"
|
||||||
|
android:paddingLeft="@dimen/list_content_padding"
|
||||||
|
android:paddingEnd="0dp"
|
||||||
|
android:paddingRight="0dp">
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatCheckBox
|
<androidx.appcompat.widget.AppCompatCheckBox
|
||||||
android:id="@+id/toggle_item"
|
android:id="@+id/toggle_item"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
|
||||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||||
android:focusable="false"
|
android:focusable="false"
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
tools:visibility="visible" />
|
||||||
android:layout_marginEnd="@dimen/favorites_icon_right_margin" />
|
|
||||||
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/icon"
|
android:id="@+id/icon"
|
||||||
android:layout_width="@dimen/standard_icon_size"
|
android:layout_width="@dimen/standard_icon_size"
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
|
||||||
android:layout_marginEnd="@dimen/favorites_icon_right_margin" />
|
android:layout_marginRight="@dimen/favorites_icon_right_margin" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_weight="1"
|
android:layout_weight="1"
|
||||||
android:orientation="vertical"
|
android:orientation="vertical"
|
||||||
android:paddingBottom="8dp"
|
|
||||||
android:paddingRight="@dimen/list_content_padding"
|
|
||||||
android:paddingTop="8dp"
|
android:paddingTop="8dp"
|
||||||
android:paddingEnd="@dimen/list_content_padding">
|
android:paddingEnd="@dimen/list_content_padding"
|
||||||
|
android:paddingRight="@dimen/list_content_padding"
|
||||||
|
android:paddingBottom="8dp">
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/bold_label"
|
android:id="@+id/bold_label"
|
||||||
|
@ -84,10 +85,10 @@
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:textColor="?attr/wikivoyage_primary_text_color"
|
android:textColor="?attr/wikivoyage_primary_text_color"
|
||||||
android:textSize="@dimen/text_button_text_size"
|
android:textSize="@dimen/text_button_text_size"
|
||||||
osmand:typeface="@string/font_roboto_medium"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"
|
osmand:typeface="@string/font_roboto_medium"
|
||||||
tools:text="Category name"/>
|
tools:text="Category name"
|
||||||
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<net.osmand.plus.widgets.TextViewEx
|
<net.osmand.plus.widgets.TextViewEx
|
||||||
android:id="@+id/label"
|
android:id="@+id/label"
|
||||||
|
@ -135,8 +136,8 @@
|
||||||
android:layout_width="@dimen/acceptable_touch_radius"
|
android:layout_width="@dimen/acceptable_touch_radius"
|
||||||
android:layout_height="@dimen/acceptable_touch_radius"
|
android:layout_height="@dimen/acceptable_touch_radius"
|
||||||
android:scaleType="center"
|
android:scaleType="center"
|
||||||
osmand:srcCompat="@drawable/ic_action_arrow_up"
|
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
|
osmand:srcCompat="@drawable/ic_action_arrow_up"
|
||||||
tools:visibility="visible" />
|
tools:visibility="visible" />
|
||||||
|
|
||||||
<ImageButton
|
<ImageButton
|
||||||
|
@ -145,8 +146,8 @@
|
||||||
android:layout_height="@dimen/acceptable_touch_radius"
|
android:layout_height="@dimen/acceptable_touch_radius"
|
||||||
android:background="?attr/dashboard_button"
|
android:background="?attr/dashboard_button"
|
||||||
android:contentDescription="@string/shared_string_more"
|
android:contentDescription="@string/shared_string_more"
|
||||||
osmand:srcCompat="@drawable/ic_overflow_menu_white"
|
android:visibility="visible"
|
||||||
android:visibility="visible"/>
|
osmand:srcCompat="@drawable/ic_overflow_menu_white" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
|
@ -939,12 +939,10 @@ public class GpxUiHelper {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
public static GPXInfo getGpxInfoByFileName(@NonNull OsmandApplication app, @NonNull String fileName) {
|
public static GPXInfo getGpxInfoByFileName(@NonNull OsmandApplication app, @NonNull String fileName) {
|
||||||
final File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
File dir = app.getAppPath(IndexConstants.GPX_INDEX_DIR);
|
||||||
List<GPXInfo> infoList = getSortedGPXFilesInfo(dir, null, false);
|
File file = new File(dir, fileName);
|
||||||
for (GPXInfo info : infoList) {
|
if (file.exists() && file.getName().endsWith(GPX_FILE_EXT)) {
|
||||||
if (Algorithms.objectEquals(info.getFileName(), fileName)) {
|
return new GPXInfo(fileName, file.lastModified(), file.length());
|
||||||
return info;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,6 +13,9 @@ import android.widget.ImageView;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import androidx.annotation.NonNull;
|
||||||
|
import androidx.core.content.ContextCompat;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.PlatformUtil;
|
import net.osmand.PlatformUtil;
|
||||||
import net.osmand.data.Amenity;
|
import net.osmand.data.Amenity;
|
||||||
|
@ -60,9 +63,6 @@ import java.util.Locale;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
|
||||||
import androidx.annotation.NonNull;
|
|
||||||
import androidx.core.content.ContextCompat;
|
|
||||||
|
|
||||||
public class AmenityMenuBuilder extends MenuBuilder {
|
public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
|
|
||||||
private static final String WIKI_LINK = ".wikipedia.org/w";
|
private static final String WIKI_LINK = ".wikipedia.org/w";
|
||||||
|
@ -346,7 +346,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
|
||||||
boolean isWiki = false;
|
boolean isWiki = false;
|
||||||
boolean isText = false;
|
boolean isText = false;
|
||||||
boolean isDescription = 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 needIntFormatting = "population".equals(key);
|
||||||
boolean isPhoneNumber = false;
|
boolean isPhoneNumber = false;
|
||||||
boolean isUrl = 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://")) {
|
if (vl.startsWith("http://") || vl.startsWith("https://") || vl.startsWith("HTTP://") || vl.startsWith("HTTPS://")) {
|
||||||
isUrl = true;
|
isUrl = true;
|
||||||
} else {
|
} else if (needLinks) {
|
||||||
socialMediaUrl = getSocialMediaUrl(key, vl);
|
socialMediaUrl = getSocialMediaUrl(key, vl);
|
||||||
if (socialMediaUrl != null) {
|
if (socialMediaUrl != null) {
|
||||||
isUrl = true;
|
isUrl = true;
|
||||||
|
|
|
@ -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();
|
||||||
|
|
|
@ -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";
|
||||||
|
|
|
@ -10,6 +10,7 @@ import androidx.annotation.NonNull;
|
||||||
|
|
||||||
import net.osmand.AndroidUtils;
|
import net.osmand.AndroidUtils;
|
||||||
import net.osmand.GPXUtilities.GPXFile;
|
import net.osmand.GPXUtilities.GPXFile;
|
||||||
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.UiUtilities;
|
import net.osmand.plus.UiUtilities;
|
||||||
|
@ -47,13 +48,15 @@ public class OptionsCard extends BaseCard {
|
||||||
public static final int DELETE_BUTTON_INDEX = 11;
|
public static final int DELETE_BUTTON_INDEX = 11;
|
||||||
|
|
||||||
private TrackDisplayHelper displayHelper;
|
private TrackDisplayHelper displayHelper;
|
||||||
|
private SelectedGpxFile selectedGpxFile;
|
||||||
private GPXFile gpxFile;
|
private GPXFile gpxFile;
|
||||||
private List<BaseBottomSheetItem> items = new ArrayList<>();
|
private List<BaseBottomSheetItem> items = new ArrayList<>();
|
||||||
|
|
||||||
public OptionsCard(@NonNull MapActivity mapActivity, TrackDisplayHelper displayHelper) {
|
public OptionsCard(@NonNull MapActivity mapActivity, TrackDisplayHelper displayHelper, SelectedGpxFile selectedGpxFile) {
|
||||||
super(mapActivity);
|
super(mapActivity);
|
||||||
this.displayHelper = displayHelper;
|
this.displayHelper = displayHelper;
|
||||||
this.gpxFile = displayHelper.getGpx();
|
this.gpxFile = displayHelper.getGpx();
|
||||||
|
this.selectedGpxFile = selectedGpxFile;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -254,7 +257,7 @@ public class OptionsCard extends BaseCard {
|
||||||
|
|
||||||
private BaseBottomSheetItem createUploadOsmItem() {
|
private BaseBottomSheetItem createUploadOsmItem() {
|
||||||
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
OsmEditingPlugin osmEditingPlugin = OsmandPlugin.getEnabledPlugin(OsmEditingPlugin.class);
|
||||||
if (osmEditingPlugin != null) {
|
if (osmEditingPlugin != null && selectedGpxFile.getTrackAnalysis(app).isTimeMoving()) {
|
||||||
return new SimpleBottomSheetItem.Builder()
|
return new SimpleBottomSheetItem.Builder()
|
||||||
.setIcon(getActiveIcon(R.drawable.ic_action_export))
|
.setIcon(getActiveIcon(R.drawable.ic_action_export))
|
||||||
.setTitle(app.getString(R.string.upload_to_openstreetmap))
|
.setTitle(app.getString(R.string.upload_to_openstreetmap))
|
||||||
|
|
|
@ -242,7 +242,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
loadSelectedGpxFile(mapActivity, path, showCurrentTrack, new CallbackWithObject<SelectedGpxFile>() {
|
loadSelectedGpxFile(mapActivity, path, showCurrentTrack, new CallbackWithObject<SelectedGpxFile>() {
|
||||||
@Override
|
@Override
|
||||||
public boolean processResult(SelectedGpxFile result) {
|
public boolean processResult(SelectedGpxFile result) {
|
||||||
selectedGpxFile = result;
|
setSelectedGpxFile(result);
|
||||||
setupDisplayHelper();
|
setupDisplayHelper();
|
||||||
if (getView() != null) {
|
if (getView() != null) {
|
||||||
initContent(getView());
|
initContent(getView());
|
||||||
|
@ -514,7 +514,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
cardsContainer.addView(optionsCard.getView());
|
cardsContainer.addView(optionsCard.getView());
|
||||||
} else {
|
} else {
|
||||||
optionsCard = new OptionsCard(mapActivity, displayHelper);
|
optionsCard = new OptionsCard(mapActivity, displayHelper, selectedGpxFile);
|
||||||
optionsCard.setListener(this);
|
optionsCard.setListener(this);
|
||||||
cardsContainer.addView(optionsCard.build(mapActivity));
|
cardsContainer.addView(optionsCard.build(mapActivity));
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue