Commit ebb7a9fc authored by tonymanou's avatar tonymanou Committed by John Wu

Open links in a new task

parent 9e723173
package com.topjohnwu.magisk.components; package com.topjohnwu.magisk.components;
import android.content.Intent;
import android.net.Uri; import android.net.Uri;
import android.text.TextUtils; import android.text.TextUtils;
...@@ -42,9 +41,7 @@ public class MagiskInstallDialog extends CustomAlertDialog { ...@@ -42,9 +41,7 @@ public class MagiskInstallDialog extends CustomAlertDialog {
setNeutralButton(R.string.release_notes, (d, i) -> { setNeutralButton(R.string.release_notes, (d, i) -> {
if (Data.magiskNoteLink.contains("forum.xda-developers")) { if (Data.magiskNoteLink.contains("forum.xda-developers")) {
// Open forum links in browser // Open forum links in browser
Intent openLink = new Intent(Intent.ACTION_VIEW, Uri.parse(Data.magiskNoteLink)); Utils.openLink(activity, Uri.parse(Data.magiskNoteLink));
openLink.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
mm.startActivity(openLink);
} else { } else {
new MarkDownWindow(activity, null, Data.magiskNoteLink).exec(); new MarkDownWindow(activity, null, Data.magiskNoteLink).exec();
} }
......
...@@ -91,6 +91,7 @@ public class Utils { ...@@ -91,6 +91,7 @@ public class Utils {
public static void openLink(Context context, Uri link) { public static void openLink(Context context, Uri link) {
Intent intent = new Intent(Intent.ACTION_VIEW, link); Intent intent = new Intent(Intent.ACTION_VIEW, link);
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (intent.resolveActivity(context.getPackageManager()) != null) { if (intent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(intent); context.startActivity(intent);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment