diff options
author | Christian Schneppe <christian@pix-art.de> | 2016-11-08 22:57:38 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-11-08 22:57:38 +0100 |
commit | 3b371f54713ba051764f90a56860d57678fa4d20 (patch) | |
tree | 81bfbb1d5be852d7145f60aa2f4ed65dcdd05ca2 /src/main/java/de | |
parent | 189ff88932eb846cd4be2876f2b90a202337e58a (diff) |
introduced new feature to navigate directly to a received location
Diffstat (limited to 'src/main/java/de')
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java index 1eac42936..d7e29e018 100644 --- a/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java +++ b/src/main/java/de/pixart/messenger/ui/ShowLocationActivity.java @@ -7,9 +7,12 @@ import android.content.Intent; import android.content.pm.PackageManager; import android.location.Address; import android.location.Geocoder; +import android.net.Uri; import android.os.AsyncTask; import android.os.Build; import android.os.Bundle; +import android.view.Menu; +import android.view.MenuInflater; import android.view.MenuItem; import android.view.View; import android.widget.TextView; @@ -81,10 +84,23 @@ public class ShowLocationActivity extends Activity implements OnMapReadyCallback case android.R.id.home: finish(); return true; + case R.id.action_navigate: + double longitude = mLocation.longitude; + double latitude = mLocation.latitude; + Intent intent = new Intent(android.content.Intent.ACTION_VIEW, Uri.parse("geo:" + String.valueOf(latitude) + "," + String.valueOf(longitude))); + startActivity(intent); + return true; } return super.onOptionsItemSelected(item); } + @Override + public boolean onCreateOptionsMenu(Menu menu) { + MenuInflater inflater = getMenuInflater(); + inflater.inflate(R.menu.showlocation, menu); + return true; + } + @Override protected void onResume() { super.onResume(); |