Show toast when intent to open a link is not resolved

This commit is contained in:
tonymanou 2018-08-05 20:38:27 +02:00 committed by John Wu
parent ebb7a9fcda
commit 2fbfeacb87
2 changed files with 4 additions and 0 deletions

View File

@ -15,6 +15,7 @@ import android.widget.Toast;
import com.topjohnwu.magisk.Const;
import com.topjohnwu.magisk.Data;
import com.topjohnwu.magisk.MagiskManager;
import com.topjohnwu.magisk.R;
import com.topjohnwu.magisk.container.Module;
import com.topjohnwu.magisk.container.ValueSortedMap;
import com.topjohnwu.magisk.services.UpdateCheckService;
@ -94,6 +95,8 @@ public class Utils {
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
if (intent.resolveActivity(context.getPackageManager()) != null) {
context.startActivity(intent);
} else {
toast(R.string.open_link_failed_toast, Toast.LENGTH_SHORT);
}
}

View File

@ -96,6 +96,7 @@
<string name="hide_manager_toast">Hiding Magisk Manager…</string>
<string name="hide_manager_toast2">This might take a while…</string>
<string name="hide_manager_fail_toast">Hide Magisk Manager failed…</string>
<string name="open_link_failed_toast">No application found to open the link…</string>
<string name="download_zip_only">Download Zip Only</string>
<string name="patch_boot_file">Patch Boot Image File</string>
<string name="direct_install">Direct Install (Recommended)</string>