Improved permalink/portal link

Now shows a dialog from which you can:
* share the permalink using the standard android share feature
* copy the link to the clipboard
* open the intel map link with an installed browser
* show the map with an installed map application (that supports geo: URIs)
This commit is contained in:
fkloft
2013-07-21 00:51:21 +02:00
parent 663a8f0dbc
commit 2b7ac5605b
14 changed files with 229 additions and 18 deletions

View File

@ -1,5 +1,11 @@
package com.cradle.iitc_mobile;
import java.util.HashMap;
import org.json.JSONArray;
import org.json.JSONException;
import android.app.Activity;
import android.app.AlertDialog;
import android.content.ClipData;
import android.content.ClipboardManager;
@ -7,17 +13,11 @@ import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.content.DialogInterface.OnMultiChoiceClickListener;
import android.content.Intent;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.webkit.JavascriptInterface;
import android.widget.Toast;
import org.json.JSONArray;
import org.json.JSONException;
import java.util.HashMap;
// provide communication between IITC script and android app
public class IITC_JSInterface {
@ -35,13 +35,18 @@ public class IITC_JSInterface {
context = c;
}
// send geo intent for navigation apps like gmaps or waze etc...
// open dialog to send geo intent for navigation apps like gmaps or waze etc...
@JavascriptInterface
public void intentPosLink(String lat, String lng, String portal_name) {
String uri = "geo:" + lat + "," + lng + "?q=" + lat + "," + lng;
Intent intent = new Intent(android.content.Intent.ACTION_VIEW,
Uri.parse(uri));
context.startActivity(intent);
public void intentPosLink(double lat, double lng, int zoom, String portalName) {
Bundle args = new Bundle();
args.putDouble("lat", lat);
args.putDouble("lng", lng);
args.putInt("zoom", zoom);
args.putString("title", portalName);
IITC_ShareDialog dialog = new IITC_ShareDialog();
dialog.setArguments(args);
dialog.show(((Activity) context).getFragmentManager(), "ShareDialog");
}
// disable javascript injection while spinner is enabled