From ccdb122afb8d93217d1f592f85dd7ca84b40a96c Mon Sep 17 00:00:00 2001 From: Christian Schneppe Date: Thu, 2 Jan 2020 15:14:19 +0100 Subject: rework map view and update leaflet to 1.6.0 --- .../java/de/pixart/messenger/ui/ShowLocationActivity.java | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) (limited to 'src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java') diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java index 3cf0da9e9..aba15eb43 100644 --- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java @@ -66,7 +66,7 @@ public class ShowLocationActivity extends XmppActivity { setTitle(getString(R.string.show_location)); setSupportActionBar(findViewById(R.id.toolbar)); configureActionBar(getSupportActionBar()); - + showLocation(null, ""); Intent intent = getIntent(); this.mLocationName = intent != null ? intent.getStringExtra("name") : null; @@ -136,12 +136,8 @@ public class ShowLocationActivity extends XmppActivity { super.onSaveInstanceState(outState); } - private void showLocation(@Nullable Location location, @Nullable String address) { - if (location == null && TextUtils.isEmpty(address)) { // no location and no address available - final WebView webView = findViewById(R.id.webView); - webView.getSettings().setJavaScriptEnabled(true); - webView.loadUrl("file:///android_asset/map.html"); - } else if (location != null && TextUtils.isEmpty(address)) { // location but no address available + private void showLocation(Location location, String address) { + if (location != null && TextUtils.isEmpty(address)) { // location but no address available String LocationName = "" + mLocationName + ""; final WebView webView = findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); @@ -150,7 +146,7 @@ public class ShowLocationActivity extends XmppActivity { String LocationName = "" + mLocationName + "
" + address; final WebView webView = findViewById(R.id.webView); webView.getSettings().setJavaScriptEnabled(true); - webView.loadUrl("file:///android_asset/map.html?lat=" + location.getLatitude() + "&lon=" + location.getLongitude() + "&name=" + LocationName); + webView.loadUrl("javascript:toCoordinates(" + location.getLatitude() + "," + location.getLongitude() + "," + "'" + LocationName + "'" +");"); } } @@ -182,7 +178,7 @@ public class ShowLocationActivity extends XmppActivity { @Override protected void onPreExecute() { super.onPreExecute(); - showLocation(location, null); + showLocation(location, ""); } @Override -- cgit v1.2.3