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

@ -1,10 +1,7 @@
package fr.free.nrw.commons.campaigns;
import android.content.Context;
import android.content.Intent;
import android.net.Uri;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import android.util.AttributeSet;
import android.view.View;
import android.widget.TextView;
@ -13,9 +10,12 @@ import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import butterknife.BindView;
import butterknife.ButterKnife;
import fr.free.nrw.commons.R;
import fr.free.nrw.commons.Utils;
import fr.free.nrw.commons.contributions.MainActivity;
import fr.free.nrw.commons.utils.SwipableCardView;
import fr.free.nrw.commons.utils.ViewUtil;
@ -66,21 +66,11 @@ public class CampaignView extends SwipableCardView {
viewHolder = new ViewHolder(rootView);
setOnClickListener(view -> {
if (campaign != null) {
showCampaignInBrowser(campaign.getLink());
Utils.handleWebUrl(getContext(), Uri.parse(campaign.getLink()));
}
});
}
/**
* open the url associated with the campaign in the system's default browser
*/
private void showCampaignInBrowser(String link) {
Intent view = new Intent();
view.setAction(Intent.ACTION_VIEW);
view.setData(Uri.parse(link));
getContext().startActivity(view);
}
public class ViewHolder {
@BindView(R.id.tv_title) TextView tvTitle;