Open links in a new task

This commit is contained in:
tonymanou 2018-08-05 20:34:01 +02:00 committed by John Wu
parent 9e72317302
commit ebb7a9fcda
2 changed files with 2 additions and 4 deletions

View File

@ -1,6 +1,5 @@
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 {
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();
} }

View File

@ -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);
} }