mirror of
https://github.com/commons-app/apps-android-commons.git
synced 2025-10-28 21:33:53 +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
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue