commit
3b2608cdec
8 changed files with 159 additions and 152 deletions
|
@ -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"
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:osmand="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -36,46 +35,48 @@
|
|||
android:id="@+id/list_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="64dp"
|
||||
android:layout_marginLeft="64dp"
|
||||
android:background="?attr/dashboard_divider"
|
||||
android:visibility="gone"
|
||||
android:layout_marginStart="64dp" />
|
||||
android:visibility="gone" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="center_vertical"
|
||||
android:paddingLeft="@dimen/list_content_padding"
|
||||
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
|
||||
android:id="@+id/toggle_item"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/favorites_icon_right_margin"
|
||||
android:layout_marginRight="@dimen/favorites_icon_right_margin"
|
||||
android:focusable="false"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
android:layout_marginEnd="@dimen/favorites_icon_right_margin" />
|
||||
tools:visibility="visible" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/icon"
|
||||
android:layout_width="@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
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:paddingBottom="8dp"
|
||||
android:paddingRight="@dimen/list_content_padding"
|
||||
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
|
||||
android:id="@+id/bold_label"
|
||||
|
@ -84,10 +85,10 @@
|
|||
android:layout_gravity="center_vertical"
|
||||
android:textColor="?attr/wikivoyage_primary_text_color"
|
||||
android:textSize="@dimen/text_button_text_size"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
android:visibility="gone"
|
||||
tools:visibility="visible"
|
||||
tools:text="Category name"/>
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:text="Category name"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/label"
|
||||
|
@ -135,8 +136,8 @@
|
|||
android:layout_width="@dimen/acceptable_touch_radius"
|
||||
android:layout_height="@dimen/acceptable_touch_radius"
|
||||
android:scaleType="center"
|
||||
osmand:srcCompat="@drawable/ic_action_arrow_up"
|
||||
android:visibility="gone"
|
||||
osmand:srcCompat="@drawable/ic_action_arrow_up"
|
||||
tools:visibility="visible" />
|
||||
|
||||
<ImageButton
|
||||
|
@ -145,8 +146,8 @@
|
|||
android:layout_height="@dimen/acceptable_touch_radius"
|
||||
android:background="?attr/dashboard_button"
|
||||
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>
|
||||
|
||||
|
|
|
@ -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<GPXInfo> 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;
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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();
|
||||
|
|
|
@ -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<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 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_NONE_PARAMETER = "none";
|
||||
|
|
|
@ -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<BaseBottomSheetItem> 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))
|
||||
|
|
|
@ -242,7 +242,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
|||
loadSelectedGpxFile(mapActivity, path, showCurrentTrack, new CallbackWithObject<SelectedGpxFile>() {
|
||||
@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));
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue