mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-29 05:43:55 +01:00
Consistent handling of web and geo urls (#2750)
* Consistent handling of web and geo urls * Remove Google map intent
This commit is contained in:
parent
7c77530c2e
commit
2021baa080
11 changed files with 59 additions and 105 deletions
|
|
@ -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()));
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue