Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
27385f2113
13 changed files with 82 additions and 31 deletions
BIN
OsmAnd/res/drawable-hdpi/ic_action_clear_all.png
Normal file
BIN
OsmAnd/res/drawable-hdpi/ic_action_clear_all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-mdpi/ic_action_clear_all.png
Normal file
BIN
OsmAnd/res/drawable-mdpi/ic_action_clear_all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1 KiB |
BIN
OsmAnd/res/drawable-xhdpi/ic_action_clear_all.png
Normal file
BIN
OsmAnd/res/drawable-xhdpi/ic_action_clear_all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
BIN
OsmAnd/res/drawable-xxhdpi/ic_action_clear_all.png
Normal file
BIN
OsmAnd/res/drawable-xxhdpi/ic_action_clear_all.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
|
@ -2,6 +2,7 @@
|
|||
<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="fill_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginBottom="5dp"
|
||||
|
@ -38,6 +39,22 @@
|
|||
|
||||
</LinearLayout>
|
||||
|
||||
<net.osmand.plus.widgets.TextViewEx
|
||||
android:id="@+id/text_button"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/selectableItemBackground"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLines="1"
|
||||
android:paddingLeft="16dp"
|
||||
android:paddingRight="16dp"
|
||||
android:text="@string/shared_string_options"
|
||||
android:visibility="gone"
|
||||
osmand:textAllCapsCompat="true"
|
||||
osmand:typeface="@string/font_roboto_medium"
|
||||
tools:textColor="?attr/color_dialog_buttons"/>
|
||||
|
||||
<ImageButton
|
||||
android:id="@+id/image_button"
|
||||
android:contentDescription="@string/shared_string_more"
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated).
|
||||
PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
|
||||
-->
|
||||
<string name="group_deleted">Group deleted</string>
|
||||
<string name="rendering_attr_whiteWaterSports_name">Whitewater sports</string>
|
||||
<string name="distance_farthest">Distance: farthest first</string>
|
||||
<string name="distance_nearest">Distance: nearest first</string>
|
||||
|
|
|
@ -17,6 +17,7 @@ import net.osmand.plus.GPXUtilities.Track;
|
|||
import net.osmand.plus.GPXUtilities.TrkSegment;
|
||||
import net.osmand.plus.GPXUtilities.WptPt;
|
||||
import net.osmand.plus.MapMarkersHelper.MarkersSyncGroup;
|
||||
import net.osmand.plus.MapMarkersHelper.OnGroupSyncedListener;
|
||||
import net.osmand.plus.OsmandSettings.MetricsConstants;
|
||||
import net.osmand.plus.activities.SavingTrackHelper;
|
||||
import net.osmand.plus.helpers.GpxUiHelper;
|
||||
|
@ -501,7 +502,7 @@ public class GpxSelectionHelper {
|
|||
}
|
||||
}
|
||||
if (syncGroup) {
|
||||
syncGpx(gpx, true);
|
||||
syncGpx(gpx, true, null);
|
||||
}
|
||||
return sf;
|
||||
}
|
||||
|
@ -538,10 +539,10 @@ public class GpxSelectionHelper {
|
|||
}
|
||||
|
||||
private void syncGpx(GPXFile gpxFile) {
|
||||
syncGpx(gpxFile, false);
|
||||
syncGpx(gpxFile, false, null);
|
||||
}
|
||||
|
||||
private void syncGpx(GPXFile gpxFile, boolean createOrDeleteGroup) {
|
||||
public void syncGpx(GPXFile gpxFile, boolean createOrDeleteGroup, @Nullable OnGroupSyncedListener callback) {
|
||||
File gpx = new File(gpxFile.path);
|
||||
if (gpx.exists()) {
|
||||
MapMarkersHelper mapMarkersHelper = app.getMapMarkersHelper();
|
||||
|
@ -556,7 +557,7 @@ public class GpxSelectionHelper {
|
|||
mapMarkersHelper.removeMarkersSyncGroup(gpx.getAbsolutePath(), true);
|
||||
}
|
||||
}
|
||||
mapMarkersHelper.syncGroupAsync(syncGroup, enabled);
|
||||
mapMarkersHelper.syncGroupAsync(syncGroup, enabled, callback);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -493,7 +493,7 @@ public class MapMarkersHelper {
|
|||
syncGroupAsync(group, true, groupSyncedListener);
|
||||
}
|
||||
|
||||
private void syncGroupAsync(@NonNull final MarkersSyncGroup group, final boolean enabled, @Nullable final OnGroupSyncedListener groupSyncedListener) {
|
||||
public void syncGroupAsync(@NonNull final MarkersSyncGroup group, final boolean enabled, @Nullable final OnGroupSyncedListener groupSyncedListener) {
|
||||
ctx.runInUIThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
|
|
|
@ -32,6 +32,7 @@ import net.osmand.plus.base.bottomsheetmenu.BottomSheetItemWithCompoundButton;
|
|||
import net.osmand.plus.base.bottomsheetmenu.SimpleBottomSheetItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.DividerHalfItem;
|
||||
import net.osmand.plus.base.bottomsheetmenu.simpleitems.TitleItem;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.helpers.ColorDialogs;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
||||
|
@ -106,7 +107,11 @@ public class EditFavoriteGroupDialogFragment extends MenuBottomSheetDialogFragme
|
|||
popup.setContentWidth(AndroidUtils.dpToPx(app, 200f));
|
||||
popup.setModal(true);
|
||||
popup.setDropDownGravity(Gravity.END | Gravity.TOP);
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
if (AndroidUiHelper.isOrientationPortrait(getActivity())) {
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, 48f));
|
||||
} else {
|
||||
popup.setVerticalOffset(AndroidUtils.dpToPx(app, -48f));
|
||||
}
|
||||
popup.setHorizontalOffset(AndroidUtils.dpToPx(app, -6f));
|
||||
final FavoriteColorAdapter colorAdapter = new FavoriteColorAdapter(getActivity());
|
||||
popup.setAdapter(colorAdapter);
|
||||
|
|
|
@ -44,6 +44,7 @@ import net.osmand.plus.poi.PoiUIFilter;
|
|||
import net.osmand.plus.views.controls.DynamicListView.DragIcon;
|
||||
import net.osmand.plus.views.controls.ListDividerShape;
|
||||
import net.osmand.plus.views.controls.StableArrayAdapter;
|
||||
import net.osmand.plus.widgets.TextViewEx;
|
||||
import net.osmand.util.Algorithms;
|
||||
import net.osmand.util.MapUtils;
|
||||
|
||||
|
@ -611,11 +612,12 @@ public class WaypointDialogHelper {
|
|||
|
||||
});
|
||||
|
||||
final ImageButton moreBtn = (ImageButton) v.findViewById(R.id.image_button);
|
||||
final TextViewEx optionsButton = (TextViewEx) v.findViewById(R.id.text_button);
|
||||
if (type == WaypointHelper.TARGETS) {
|
||||
moreBtn.setVisibility(View.VISIBLE);
|
||||
moreBtn.setImageDrawable(app.getIconsCache().getIcon(R.drawable.ic_overflow_menu_white, !nightMode));
|
||||
moreBtn.setOnClickListener(new View.OnClickListener() {
|
||||
optionsButton.setVisibility(View.VISIBLE);
|
||||
optionsButton.setTextColor(ContextCompat.getColor(ctx,
|
||||
nightMode ? R.color.color_dialog_buttons_dark : R.color.color_dialog_buttons_light));
|
||||
optionsButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
boolean hasActivePoints = false;
|
||||
|
@ -638,13 +640,13 @@ public class WaypointDialogHelper {
|
|||
}
|
||||
}
|
||||
|
||||
final PopupMenu optionsMenu = new PopupMenu(ctx, moreBtn);
|
||||
final PopupMenu optionsMenu = new PopupMenu(ctx, optionsButton);
|
||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||
MenuItem item;
|
||||
if (hasActivePoints) {
|
||||
item = optionsMenu.getMenu()
|
||||
.add(R.string.intermediate_items_sort_by_distance)
|
||||
.setIcon(app.getIconsCache().getThemedIcon(R.drawable.ic_sort_waypoint_dark));
|
||||
.setIcon(app.getIconsCache().getThemedIcon(R.drawable.ic_action_sort_door_to_door));
|
||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||
@Override
|
||||
public boolean onMenuItemClick(MenuItem item) {
|
||||
|
@ -673,7 +675,7 @@ public class WaypointDialogHelper {
|
|||
}
|
||||
});
|
||||
} else {
|
||||
moreBtn.setVisibility(View.GONE);
|
||||
optionsButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
TextView tv = (TextView) v.findViewById(R.id.header_text);
|
||||
|
|
|
@ -406,9 +406,7 @@ public class MapMarkersGroupsFragment extends Fragment implements OsmAndCompassL
|
|||
|
||||
void updateAdapter() {
|
||||
if (adapter != null) {
|
||||
adapter.createDisplayGroups();
|
||||
adapter.updateShowDirectionMarkers();
|
||||
adapter.notifyDataSetChanged();
|
||||
adapter.updateDisplayedData();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -903,9 +903,8 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
List<LatLon> selectedLatLon = markersHelper.getSelectedMarkersLatLon();
|
||||
|
||||
LatLon start = startFromLoc ? new LatLon(myLoc.getLatitude(), myLoc.getLongitude()) : selectedLatLon.remove(0);
|
||||
LatLon end = selectedLatLon.remove(selectedLatLon.size() - 1);
|
||||
|
||||
int[] sequence = new TspAnt().readGraph(selectedLatLon, start, end).solve();
|
||||
int[] sequence = new TspAnt().readGraph(selectedLatLon, start, null).solve();
|
||||
|
||||
List<MapMarker> res = new ArrayList<>();
|
||||
for (int i = 0; i < sequence.length; i++) {
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
package net.osmand.plus.mapmarkers.adapters;
|
||||
|
||||
import android.support.annotation.NonNull;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v4.content.ContextCompat;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -11,10 +12,14 @@ import android.widget.ImageView;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.data.LatLon;
|
||||
import net.osmand.plus.GPXUtilities.GPXFile;
|
||||
import net.osmand.plus.GpxSelectionHelper;
|
||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||
import net.osmand.plus.IconsCache;
|
||||
import net.osmand.plus.MapMarkersHelper.GroupHeader;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarkersGroup;
|
||||
import net.osmand.plus.MapMarkersHelper.OnGroupSyncedListener;
|
||||
import net.osmand.plus.MapMarkersHelper.ShowHideHistoryButton;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.R;
|
||||
|
@ -65,7 +70,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
createDisplayGroups();
|
||||
}
|
||||
|
||||
public void updateShowDirectionMarkers() {
|
||||
private void updateShowDirectionMarkers() {
|
||||
showDirectionEnabled = app.getSettings().MARKERS_DISTANCE_INDICATION_ENABLED.get();
|
||||
List<MapMarker> mapMarkers = app.getMapMarkersHelper().getMapMarkers();
|
||||
int markersCount = mapMarkers.size();
|
||||
|
@ -82,7 +87,7 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
return 0;
|
||||
}
|
||||
|
||||
public void createDisplayGroups() {
|
||||
private void createDisplayGroups() {
|
||||
items = new ArrayList<>();
|
||||
app.getMapMarkersHelper().updateGroups();
|
||||
List<MapMarkersGroup> groups = app.getMapMarkersHelper().getMapMarkersGroups();
|
||||
|
@ -186,6 +191,12 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
this.screenOrientation = screenOrientation;
|
||||
}
|
||||
|
||||
public void updateDisplayedData() {
|
||||
createDisplayGroups();
|
||||
updateShowDirectionMarkers();
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
if (viewType == MARKER_TYPE) {
|
||||
|
@ -302,18 +313,14 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
} else {
|
||||
app.getMapMarkersHelper().moveMapMarkerToHistory(marker);
|
||||
}
|
||||
createDisplayGroups();
|
||||
updateShowDirectionMarkers();
|
||||
notifyDataSetChanged();
|
||||
updateDisplayedData();
|
||||
if (!markerInHistory) {
|
||||
snackbar = Snackbar.make(itemViewHolder.itemView, R.string.marker_moved_to_history, Snackbar.LENGTH_LONG)
|
||||
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
mapActivity.getMyApplication().getMapMarkersHelper().restoreMarkerFromHistory(marker, 0);
|
||||
createDisplayGroups();
|
||||
updateShowDirectionMarkers();
|
||||
notifyDataSetChanged();
|
||||
updateDisplayedData();
|
||||
}
|
||||
});
|
||||
View snackBarView = snackbar.getView();
|
||||
|
@ -380,15 +387,25 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
public void onCheckedChanged(CompoundButton compoundButton, boolean enabled) {
|
||||
group.setDisabled(!enabled);
|
||||
app.getMapMarkersHelper().updateGroupDisabled(group, !enabled);
|
||||
createDisplayGroups();
|
||||
updateShowDirectionMarkers();
|
||||
notifyDataSetChanged();
|
||||
updateDisplayedData();
|
||||
if (!enabled) {
|
||||
snackbar = Snackbar.make(holder.itemView, app.getString(R.string.group_will_be_removed_after_restart), Snackbar.LENGTH_LONG)
|
||||
final GPXFile[] gpxFile = new GPXFile[1];
|
||||
SelectedGpxFile selectedGpxFile = app.getSelectedGpxHelper().getSelectedFileByPath(group.getGroupKey());
|
||||
if (selectedGpxFile != null) {
|
||||
gpxFile[0] = selectedGpxFile.getGpxFile();
|
||||
if (gpxFile[0] != null) {
|
||||
switchGpxVisibility(gpxFile[0], false);
|
||||
}
|
||||
}
|
||||
snackbar = Snackbar.make(holder.itemView, app.getString(R.string.group_deleted), Snackbar.LENGTH_LONG)
|
||||
.setAction(R.string.shared_string_undo, new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
headerViewHolder.disableGroupSwitch.setChecked(true);
|
||||
if (gpxFile[0] != null) {
|
||||
switchGpxVisibility(gpxFile[0], true);
|
||||
} else {
|
||||
headerViewHolder.disableGroupSwitch.setChecked(true);
|
||||
}
|
||||
}
|
||||
});
|
||||
View snackBarView = snackbar.getView();
|
||||
|
@ -427,6 +444,17 @@ public class MapMarkersGroupsAdapter extends RecyclerView.Adapter<RecyclerView.V
|
|||
}
|
||||
}
|
||||
|
||||
private void switchGpxVisibility(@NonNull GPXFile gpxFile, boolean visible) {
|
||||
GpxSelectionHelper gpxHelper = app.getSelectedGpxHelper();
|
||||
gpxHelper.selectGpxFile(gpxFile, visible, false, false);
|
||||
gpxHelper.syncGpx(gpxFile, true, new OnGroupSyncedListener() {
|
||||
@Override
|
||||
public void onSyncDone() {
|
||||
updateDisplayedData();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void hideSnackbar() {
|
||||
if (snackbar != null && snackbar.isShown()) {
|
||||
snackbar.dismiss();
|
||||
|
|
Loading…
Reference in a new issue