From c7f7a9efdca4a93e2a1054f0c751242a8a4144ff Mon Sep 17 00:00:00 2001 From: simon Date: Mon, 23 Nov 2020 15:49:19 +0200 Subject: [PATCH] condition added --- .../plus/mapcontextmenu/MenuBuilder.java | 62 +++++++++---------- 1 file changed, 30 insertions(+), 32 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java index b0a5897ceb..0a6fa296d0 100644 --- a/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java +++ b/OsmAnd/src/net/osmand/plus/mapcontextmenu/MenuBuilder.java @@ -6,11 +6,7 @@ import android.content.Context; import android.content.DialogInterface; import android.content.Intent; import android.content.res.ColorStateList; -import android.graphics.Bitmap; -import android.graphics.BitmapFactory; -import android.graphics.Color; -import android.graphics.PorterDuff; -import android.graphics.Typeface; +import android.graphics.*; import android.graphics.drawable.Drawable; import android.graphics.drawable.GradientDrawable; import android.net.Uri; @@ -64,7 +60,6 @@ import net.osmand.plus.widgets.TextViewEx; import net.osmand.plus.widgets.tools.ClickableSpanTouchListener; import net.osmand.util.Algorithms; import net.osmand.util.MapUtils; - import org.apache.commons.logging.Log; import org.openplacereviews.opendb.util.exception.FailedVerificationException; @@ -72,7 +67,6 @@ import java.io.BufferedInputStream; import java.io.ByteArrayInputStream; import java.io.ByteArrayOutputStream; import java.io.InputStream; -import java.text.MessageFormat; import java.util.*; import static net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener; @@ -385,32 +379,36 @@ public class MenuBuilder { b.setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { - registerResultListener(view); - final String privateKey = OPRWebviewActivity.getPrivateKeyFromCookie(); - final String name = OPRWebviewActivity.getUsernameFromCookie(); - if (privateKey == null || privateKey.isEmpty()) { - OprStartFragment.showInstance(mapActivity.getSupportFragmentManager()); - return; - } - new Thread(new Runnable() { - @Override - public void run() { - if (openDBAPI.checkPrivateKeyValid(name, privateKey)) { - app.runInUIThread(new Runnable() { - @Override - public void run() { - Intent intent = new Intent(); - intent.setType("image/*"); - intent.setAction(Intent.ACTION_GET_CONTENT); - mapActivity.startActivityForResult(Intent.createChooser(intent, - mapActivity.getString(R.string.select_picture)), PICK_IMAGE); - } - }); - } else { - OprStartFragment.showInstance(mapActivity.getSupportFragmentManager()); - } + if (false) { + AddPhotosBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager()); + } else { + registerResultListener(view); + final String privateKey = OPRWebviewActivity.getPrivateKeyFromCookie(); + final String name = OPRWebviewActivity.getUsernameFromCookie(); + if (privateKey == null || privateKey.isEmpty()) { + OprStartFragment.showInstance(mapActivity.getSupportFragmentManager()); + return; } - }).start(); + new Thread(new Runnable() { + @Override + public void run() { + if (openDBAPI.checkPrivateKeyValid(name, privateKey)) { + app.runInUIThread(new Runnable() { + @Override + public void run() { + Intent intent = new Intent(); + intent.setType("image/*"); + intent.setAction(Intent.ACTION_GET_CONTENT); + mapActivity.startActivityForResult(Intent.createChooser(intent, + mapActivity.getString(R.string.select_picture)), PICK_IMAGE); + } + }); + } else { + OprStartFragment.showInstance(mapActivity.getSupportFragmentManager()); + } + } + }).start(); + } } }); //TODO feature under development