condition added

This commit is contained in:
simon 2020-11-23 15:49:19 +02:00
parent 0462f635a8
commit c7f7a9efdc

View file

@ -6,11 +6,7 @@ import android.content.Context;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.res.ColorStateList; import android.content.res.ColorStateList;
import android.graphics.Bitmap; import android.graphics.*;
import android.graphics.BitmapFactory;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable; import android.graphics.drawable.Drawable;
import android.graphics.drawable.GradientDrawable; import android.graphics.drawable.GradientDrawable;
import android.net.Uri; import android.net.Uri;
@ -64,7 +60,6 @@ import net.osmand.plus.widgets.TextViewEx;
import net.osmand.plus.widgets.tools.ClickableSpanTouchListener; import net.osmand.plus.widgets.tools.ClickableSpanTouchListener;
import net.osmand.util.Algorithms; import net.osmand.util.Algorithms;
import net.osmand.util.MapUtils; import net.osmand.util.MapUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.openplacereviews.opendb.util.exception.FailedVerificationException; import org.openplacereviews.opendb.util.exception.FailedVerificationException;
@ -72,7 +67,6 @@ import java.io.BufferedInputStream;
import java.io.ByteArrayInputStream; import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream; import java.io.ByteArrayOutputStream;
import java.io.InputStream; import java.io.InputStream;
import java.text.MessageFormat;
import java.util.*; import java.util.*;
import static net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener; import static net.osmand.plus.mapcontextmenu.builders.cards.ImageCard.GetImageCardsTask.GetImageCardsListener;
@ -385,32 +379,36 @@ public class MenuBuilder {
b.setOnClickListener(new OnClickListener() { b.setOnClickListener(new OnClickListener() {
@Override @Override
public void onClick(final View view) { public void onClick(final View view) {
registerResultListener(view); if (false) {
final String privateKey = OPRWebviewActivity.getPrivateKeyFromCookie(); AddPhotosBottomSheetDialogFragment.showInstance(mapActivity.getSupportFragmentManager());
final String name = OPRWebviewActivity.getUsernameFromCookie(); } else {
if (privateKey == null || privateKey.isEmpty()) { registerResultListener(view);
OprStartFragment.showInstance(mapActivity.getSupportFragmentManager()); final String privateKey = OPRWebviewActivity.getPrivateKeyFromCookie();
return; final String name = OPRWebviewActivity.getUsernameFromCookie();
} if (privateKey == null || privateKey.isEmpty()) {
new Thread(new Runnable() { OprStartFragment.showInstance(mapActivity.getSupportFragmentManager());
@Override return;
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(); 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 //TODO feature under development