diff --git a/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java b/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java index 368e5e671..bb3475f0b 100644 --- a/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java +++ b/app/src/full/java/com/topjohnwu/magisk/AboutActivity.java @@ -1,6 +1,5 @@ package com.topjohnwu.magisk; -import android.content.Intent; import android.net.Uri; import android.os.Bundle; import android.support.annotation.Nullable; @@ -12,6 +11,7 @@ import android.view.View; import com.topjohnwu.magisk.asyncs.MarkDownWindow; import com.topjohnwu.magisk.components.AboutCardRow; import com.topjohnwu.magisk.components.BaseActivity; +import com.topjohnwu.magisk.utils.Utils; import java.util.Locale; @@ -65,13 +65,13 @@ public class AboutActivity extends BaseActivity { } appSourceCode.removeSummary(); - appSourceCode.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Const.Url.SOURCE_CODE_URL)))); + appSourceCode.setOnClickListener(view -> Utils.openLink(this, Uri.parse(Const.Url.SOURCE_CODE_URL))); supportThread.removeSummary(); - supportThread.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Const.Url.XDA_THREAD)))); + supportThread.setOnClickListener(view -> Utils.openLink(this, Uri.parse(Const.Url.XDA_THREAD))); donation.removeSummary(); - donation.setOnClickListener(view -> startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(Const.Url.DONATION_URL)))); + donation.setOnClickListener(view -> Utils.openLink(this, Uri.parse(Const.Url.DONATION_URL))); setFloating(); } diff --git a/app/src/full/java/com/topjohnwu/magisk/utils/Utils.java b/app/src/full/java/com/topjohnwu/magisk/utils/Utils.java index 62b0b312c..fbdbd882c 100644 --- a/app/src/full/java/com/topjohnwu/magisk/utils/Utils.java +++ b/app/src/full/java/com/topjohnwu/magisk/utils/Utils.java @@ -4,6 +4,7 @@ import android.app.job.JobInfo; import android.app.job.JobScheduler; import android.content.ComponentName; import android.content.Context; +import android.content.Intent; import android.content.SharedPreferences; import android.database.Cursor; import android.net.Uri; @@ -88,6 +89,13 @@ public class Utils { } } + public static void openLink(Context context, Uri link) { + Intent intent = new Intent(Intent.ACTION_VIEW, link); + if (intent.resolveActivity(context.getPackageManager()) != null) { + context.startActivity(intent); + } + } + public static void toast(CharSequence msg, int duration) { Data.mainHandler.post(() -> Toast.makeText(Data.MM(), msg, duration).show()); }