Consistent handling of web and geo urls (#2750)

* Consistent handling of web and geo urls

* Remove Google map intent
This commit is contained in:
Vivek Maskara 2019-03-28 18:23:36 +05:30 committed by Ashish Kumar
parent 7c77530c2e
commit 2021baa080
11 changed files with 59 additions and 105 deletions

View file

@ -847,13 +847,7 @@ public class NearbyMapFragment extends DaggerFragment {
wikidataButton.setVisibility(place.hasWikidataLink()?View.VISIBLE:View.GONE);
wikidataButton.setOnClickListener(view -> openWebView(this.place.siteLinks.getWikidataLink()));
directionsButton.setOnClickListener(view -> {
//Open map app at given position
Intent mapIntent = new Intent(Intent.ACTION_VIEW, this.place.location.getGmmIntentUri());
if (mapIntent.resolveActivity(getActivity().getPackageManager()) != null) {
startActivity(mapIntent);
}
});
directionsButton.setOnClickListener(view -> Utils.handleGeoCoordinates(getActivity(), this.place.getLocation()));
commonsButton.setVisibility(this.place.hasCommonsLink()?View.VISIBLE:View.GONE);
commonsButton.setOnClickListener(view -> openWebView(this.place.siteLinks.getCommonsLink()));

View file

@ -2,12 +2,6 @@ package fr.free.nrw.commons.nearby;
import android.content.Intent;
import android.net.Uri;
import androidx.transition.TransitionManager;
import androidx.fragment.app.Fragment;
import androidx.appcompat.app.AlertDialog;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.appcompat.widget.PopupMenu;
import androidx.recyclerview.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
@ -24,6 +18,12 @@ import java.util.ArrayList;
import javax.inject.Inject;
import javax.inject.Named;
import androidx.appcompat.app.AlertDialog;
import androidx.appcompat.widget.PopupMenu;
import androidx.fragment.app.Fragment;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import androidx.transition.TransitionManager;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
@ -223,13 +223,7 @@ public class PlaceRenderer extends Renderer<Place> {
icon.setImageResource(place.getLabel().getIcon());
directionsButton.setOnClickListener(view -> {
//Open map app at given position
Intent mapIntent = new Intent(Intent.ACTION_VIEW, place.location.getGmmIntentUri());
if (mapIntent.resolveActivity(view.getContext().getPackageManager()) != null) {
view.getContext().startActivity(mapIntent);
}
});
directionsButton.setOnClickListener(view -> Utils.handleGeoCoordinates(getContext(), this.place.getLocation()));
iconOverflow.setVisibility(showMenu() ? View.VISIBLE : View.GONE);
iconOverflow.setOnClickListener(v -> popupMenuListener());