diff options
author | Christian Schneppe <christian@pix-art.de> | 2018-10-04 13:45:58 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2018-10-04 13:45:58 +0200 |
commit | 34a0d167d040ca2e5dd442506c761d73cb819251 (patch) | |
tree | 8e1a9cb2b9c83e52dba41110a04aeb13aa851d85 /src/main/java | |
parent | c36d8b79113ab9d33e50323bb59e646d0664a688 (diff) |
make navigation working with google maps
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java | 34 |
1 files changed, 17 insertions, 17 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java index b3ff43d3d..a12d398f2 100644 --- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java @@ -34,9 +34,9 @@ import de.pixart.messenger.utils.MenuDoubleTabUtil; import static de.pixart.messenger.ui.SettingsActivity.USE_BUNDLED_EMOJIS; public class ShowLocationActivity extends XmppActivity { + FloatingActionButton fab; private Location location; private String mLocationName; - FloatingActionButton fab; private static String getAddress(Context context, Location location) { double longitude = location.getLongitude(); @@ -159,6 +159,22 @@ public class ShowLocationActivity extends XmppActivity { } } + private void navigate(Location location) { + if (location == null) { + Log.d(Config.LOGTAG, "No location given"); + return; + } + double longitude = location.getLongitude(); + double latitude = location.getLatitude(); + try { + Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("google.navigation:q=" + String.valueOf(latitude) + "," + String.valueOf(longitude))); + startActivity(intent); + overridePendingTransition(R.animator.fade_in, R.animator.fade_out); + } catch (ActivityNotFoundException e) { + Toast.makeText(this, R.string.no_application_found_to_display_location, Toast.LENGTH_SHORT).show(); + } + } + private class getAddressAsync extends AsyncTask<Void, Void, Void> { String address = null; @@ -186,20 +202,4 @@ public class ShowLocationActivity extends XmppActivity { showLocation(location, address); } } - - private void navigate (Location location) { - if (location == null) { - Log.d(Config.LOGTAG, "No location given"); - return; - } - double longitude = location.getLongitude(); - double latitude = location.getLatitude(); - try { - Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude))); - startActivity(intent); - overridePendingTransition(R.animator.fade_in, R.animator.fade_out); - } catch (ActivityNotFoundException e) { - Toast.makeText(this, R.string.no_application_found_to_display_location, Toast.LENGTH_SHORT).show(); - } - } }
\ No newline at end of file |