Search in sources :

Example 1 with MarkerSaveAsTrackFragmentListener

use of net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener in project Osmand by osmandapp.

the class MapMarkersDialogFragment method createSaveAsTrackFragmentListener.

private MarkerSaveAsTrackFragmentListener createSaveAsTrackFragmentListener() {
    return new MarkerSaveAsTrackFragmentListener() {

        final MapActivity mapActivity = getMapActivity();

        @Override
        public void saveGpx(final String fileName) {
            final String gpxPath = mapActivity.getMyApplication().getMapMarkersHelper().generateGpx(fileName);
            snackbar = Snackbar.make(viewPager, fileName + " " + getString(R.string.is_saved) + ".", Snackbar.LENGTH_LONG).setAction(R.string.shared_string_show, new View.OnClickListener() {

                @Override
                public void onClick(View view) {
                    Intent intent = new Intent(mapActivity, getMyApplication().getAppCustomization().getTrackActivity());
                    intent.putExtra(TrackActivity.TRACK_FILE_NAME, gpxPath);
                    intent.putExtra(TrackActivity.OPEN_POINTS_TAB, true);
                    intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP);
                    startActivity(intent);
                }
            });
            AndroidUtils.setSnackbarTextColor(snackbar, R.color.color_dialog_buttons_dark);
            snackbar.show();
        }
    };
}
Also used : MarkerSaveAsTrackFragmentListener(net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener) Intent(android.content.Intent) View(android.view.View) BottomNavigationView(android.support.design.widget.BottomNavigationView) MapActivity(net.osmand.plus.activities.MapActivity)

Aggregations

Intent (android.content.Intent)1 BottomNavigationView (android.support.design.widget.BottomNavigationView)1 View (android.view.View)1 MapActivity (net.osmand.plus.activities.MapActivity)1 MarkerSaveAsTrackFragmentListener (net.osmand.plus.mapmarkers.SaveAsTrackBottomSheetDialogFragment.MarkerSaveAsTrackFragmentListener)1