Add snackbar

This commit is contained in:
Alexander Sytnyk 2017-11-20 16:19:13 +02:00
parent 5e21aaf8b4
commit 1856bc24c1
2 changed files with 15 additions and 1 deletions

View file

@ -9,6 +9,7 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 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="marker_activated">Marker %s activated.</string>
<string name="one_tap_active_descr">Tap on marker on the map, move it to the first place in active markers, without opening context menu.</string> <string name="one_tap_active_descr">Tap on marker on the map, move it to the first place in active markers, without opening context menu.</string>
<string name="one_tap_active">One tap active</string> <string name="one_tap_active">One tap active</string>
<string name="looking_for_tracks_with_waypoints">Looking for tracks with waypoints</string> <string name="looking_for_tracks_with_waypoints">Looking for tracks with waypoints</string>

View file

@ -14,9 +14,11 @@ import android.os.Handler;
import android.os.Message; import android.os.Message;
import android.support.annotation.NonNull; import android.support.annotation.NonNull;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.view.GestureDetector; import android.view.GestureDetector;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View;
import net.osmand.Location; import net.osmand.Location;
import net.osmand.data.LatLon; import net.osmand.data.LatLon;
@ -487,7 +489,18 @@ public class MapMarkersLayer extends OsmandMapLayer implements IContextMenuProvi
|| !map.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) { || !map.getMyApplication().getSettings().SELECT_MARKER_ON_SINGLE_TAP.get()) {
return false; return false;
} }
map.getMyApplication().getMapMarkersHelper().moveMarkerToTop((MapMarker) o); final MapMarkersHelper helper = map.getMyApplication().getMapMarkersHelper();
final MapMarker old = helper.getMapMarkers().get(0);
helper.moveMarkerToTop((MapMarker) o);
String title = map.getString(R.string.marker_activated, helper.getMapMarkers().get(0).getName(map));
Snackbar.make(map.findViewById(R.id.bottomFragmentContainer), title, Snackbar.LENGTH_LONG)
.setAction(R.string.shared_string_cancel, new View.OnClickListener() {
@Override
public void onClick(View v) {
helper.moveMarkerToTop(old);
}
})
.show();
return true; return true;
} }