Search in sources :

Example 1 with R

use of net.osmand.plus.R in project Osmand by osmandapp.

the class OsmBugsLayer method getHandleBugListener.

HandleBugListener getHandleBugListener(@NonNull MapActivity mapActivity) {
    return (obj, action, bug, point, text) -> {
        if (mapActivity.isFinishing()) {
            return;
        }
        if (obj != null && obj.warning == null) {
            if (local == getOsmBugsUtil(bug)) {
                Toast.makeText(ctx, R.string.osm_changes_added_to_local_edits, Toast.LENGTH_LONG).show();
                if (obj.local != null) {
                    PointDescription pd = new PointDescription(PointDescription.POINT_TYPE_OSM_BUG, obj.local.getText());
                    mapActivity.getContextMenu().show(new LatLon(obj.local.getLatitude(), obj.local.getLongitude()), pd, obj.local);
                    mapActivity.getMapLayers().getContextMenuLayer().updateContextMenu();
                }
            } else {
                if (action == Action.REOPEN) {
                    Toast.makeText(ctx, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
                } else if (action == Action.MODIFY) {
                    Toast.makeText(ctx, R.string.osb_comment_dialog_success, Toast.LENGTH_LONG).show();
                } else if (action == Action.DELETE) {
                    Toast.makeText(ctx, R.string.osn_close_dialog_success, Toast.LENGTH_LONG).show();
                } else if (action == Action.CREATE) {
                    Toast.makeText(ctx, R.string.osn_add_dialog_success, Toast.LENGTH_LONG).show();
                }
            }
            clearCache();
        } else {
            int r = R.string.osb_comment_dialog_error;
            if (action == Action.REOPEN) {
                r = R.string.osn_add_dialog_error;
                reopenBug(mapActivity, bug, text);
            } else if (action == Action.DELETE) {
                r = R.string.osn_close_dialog_error;
                closeBug(mapActivity, bug, text);
            } else if (action == Action.CREATE) {
                r = R.string.osn_add_dialog_error;
                openBug(mapActivity, bug.getLatitude(), bug.getLongitude(), text, false);
            } else if (action == null) {
                r = R.string.osn_modify_dialog_error;
                modifyBug(mapActivity, point);
            } else {
                commentBug(mapActivity, bug, text);
            }
            Toast.makeText(ctx, ctx.getResources().getString(r) + "\n" + obj, Toast.LENGTH_LONG).show();
        }
    };
}
Also used : Context(android.content.Context) PointF(android.graphics.PointF) OsmPoint(net.osmand.plus.plugins.osmedit.data.OsmPoint) QuadRect(net.osmand.data.QuadRect) NonNull(androidx.annotation.NonNull) OsmandMapTileView(net.osmand.plus.views.OsmandMapTileView) R(net.osmand.plus.R) ArrayList(java.util.ArrayList) LatLon(net.osmand.data.LatLon) OsmBugsUtil(net.osmand.plus.plugins.osmedit.helpers.OsmBugsUtil) URLConnection(java.net.URLConnection) Toast(android.widget.Toast) SendOsmNoteBottomSheetFragment(net.osmand.plus.plugins.osmedit.dialogs.SendOsmNoteBottomSheetFragment) View(android.view.View) Canvas(android.graphics.Canvas) PlatformUtil(net.osmand.PlatformUtil) ContextCompat(androidx.core.content.ContextCompat) XmlPullParser(org.xmlpull.v1.XmlPullParser) IContextMenuProvider(net.osmand.plus.views.layers.ContextMenuLayer.IContextMenuProvider) OsmandMapLayer(net.osmand.plus.views.layers.base.OsmandMapLayer) DEFAULT_UI_ICON_ID(net.osmand.data.FavouritePoint.DEFAULT_UI_ICON_ID) Xml(android.util.Xml) OsmandSettings(net.osmand.plus.settings.backend.OsmandSettings) HandleOsmNoteAsyncTask(net.osmand.plus.plugins.osmedit.asynctasks.HandleOsmNoteAsyncTask) IOException(java.io.IOException) RotatedTileBox(net.osmand.data.RotatedTileBox) InputStreamReader(java.io.InputStreamReader) PointDescription(net.osmand.data.PointDescription) OsmandApplication(net.osmand.plus.OsmandApplication) BugBottomSheetDialog(net.osmand.plus.plugins.osmedit.dialogs.BugBottomSheetDialog) Serializable(java.io.Serializable) XmlPullParserException(org.xmlpull.v1.XmlPullParserException) List(java.util.List) Nullable(androidx.annotation.Nullable) OsmNotesPoint(net.osmand.plus.plugins.osmedit.data.OsmNotesPoint) Action(net.osmand.plus.plugins.osmedit.data.OsmPoint.Action) HandleBugListener(net.osmand.plus.plugins.osmedit.asynctasks.HandleOsmNoteAsyncTask.HandleBugListener) OsmBugsLocalUtil(net.osmand.plus.plugins.osmedit.helpers.OsmBugsLocalUtil) Log(org.apache.commons.logging.Log) BufferedReader(java.io.BufferedReader) PointImageDrawable(net.osmand.plus.views.PointImageDrawable) BackgroundType(net.osmand.data.FavouritePoint.BackgroundType) EditText(android.widget.EditText) QuadTree(net.osmand.data.QuadTree) NetworkUtils(net.osmand.osm.io.NetworkUtils) MapActivity(net.osmand.plus.activities.MapActivity) LatLon(net.osmand.data.LatLon) PointDescription(net.osmand.data.PointDescription)

Aggregations

Context (android.content.Context)1 Canvas (android.graphics.Canvas)1 PointF (android.graphics.PointF)1 Xml (android.util.Xml)1 View (android.view.View)1 EditText (android.widget.EditText)1 Toast (android.widget.Toast)1 NonNull (androidx.annotation.NonNull)1 Nullable (androidx.annotation.Nullable)1 ContextCompat (androidx.core.content.ContextCompat)1 BufferedReader (java.io.BufferedReader)1 IOException (java.io.IOException)1 InputStreamReader (java.io.InputStreamReader)1 Serializable (java.io.Serializable)1 URLConnection (java.net.URLConnection)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 PlatformUtil (net.osmand.PlatformUtil)1 BackgroundType (net.osmand.data.FavouritePoint.BackgroundType)1 DEFAULT_UI_ICON_ID (net.osmand.data.FavouritePoint.DEFAULT_UI_ICON_ID)1