Replace toast with snackbar

This commit is contained in:
Alex 2017-10-13 12:16:59 +03:00
parent 1579b4c58c
commit 7cbbe99166
2 changed files with 11 additions and 4 deletions

View file

@ -9,8 +9,9 @@
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="show_map">Show map</string>
<string name="route_is_calculated">Route is calculated</string>
<string name="round_trip">Round trip</string> <string name="round_trip">Round trip</string>
<string name="route_calculated_toast">Route is calculated: Show map</string>
<string name="plan_route_no_markers_toast">You must add at least one marker to use this function.</string> <string name="plan_route_no_markers_toast">You must add at least one marker to use this function.</string>
<string name="osn_modify_dialog_error">Exception occurred: note was not modified</string> <string name="osn_modify_dialog_error">Exception occurred: note was not modified</string>
<string name="osn_modify_dialog_title">Modify note</string> <string name="osn_modify_dialog_title">Modify note</string>

View file

@ -7,6 +7,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.support.annotation.DrawableRes; import android.support.annotation.DrawableRes;
import android.support.annotation.Nullable; import android.support.annotation.Nullable;
import android.support.design.widget.Snackbar;
import android.support.v4.app.Fragment; import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
@ -24,7 +25,6 @@ import android.widget.ImageView;
import android.widget.LinearLayout; import android.widget.LinearLayout;
import android.widget.ProgressBar; import android.widget.ProgressBar;
import android.widget.TextView; import android.widget.TextView;
import android.widget.Toast;
import net.osmand.AndroidUtils; import net.osmand.AndroidUtils;
import net.osmand.Location; import net.osmand.Location;
@ -114,8 +114,14 @@ public class PlanRouteFragment extends Fragment implements OsmAndLocationListene
mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE); mainView.findViewById(R.id.snap_to_road_progress_bar).setVisibility(View.GONE);
planRouteContext.setProgressBarVisible(false); planRouteContext.setProgressBarVisible(false);
if (!canceled && portrait && planRouteContext.isMarkersListOpened()) { if (!canceled && portrait && planRouteContext.isMarkersListOpened()) {
Toast.makeText(mapActivity, getString(R.string.route_calculated_toast), Toast.LENGTH_SHORT).show(); Snackbar.make(mainView, getString(R.string.route_is_calculated) + ":", Snackbar.LENGTH_LONG)
showHideMarkersList(); .setAction(R.string.show_map, new View.OnClickListener() {
@Override
public void onClick(View view) {
showHideMarkersList();
}
})
.show();
} }
} }