Fixed crash when open external uri
This commit is contained in:
parent
8fdf99ca65
commit
d36eee1859
@ -254,8 +254,16 @@ public class Daedalus extends Application {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public static void donate() {
|
public static void donate() {
|
||||||
instance.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://qr.alipay.com/a6x07022gffiehykicipv1a"))
|
openUri("https://qr.alipay.com/a6x07022gffiehykicipv1a");
|
||||||
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
}
|
||||||
|
|
||||||
|
public static void openUri(String uri) {
|
||||||
|
try {
|
||||||
|
instance.startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(uri))
|
||||||
|
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
|
||||||
|
} catch (Exception e) {
|
||||||
|
Logger.logException(e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Daedalus getInstance() {
|
public static Daedalus getInstance() {
|
||||||
|
@ -5,7 +5,6 @@ import android.app.FragmentManager;
|
|||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.net.Uri;
|
|
||||||
import android.net.VpnService;
|
import android.net.VpnService;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.support.annotation.NonNull;
|
import android.support.annotation.NonNull;
|
||||||
@ -250,7 +249,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
|||||||
switchFragment(new DNSTestFragment());
|
switchFragment(new DNSTestFragment());
|
||||||
break;
|
break;
|
||||||
case R.id.nav_github:
|
case R.id.nav_github:
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus")));
|
Daedalus.openUri("https://github.com/iTXTech/Daedalus");
|
||||||
break;
|
break;
|
||||||
case R.id.nav_home:
|
case R.id.nav_home:
|
||||||
switchFragment(new HomeFragment());
|
switchFragment(new HomeFragment());
|
||||||
|
@ -1,7 +1,5 @@
|
|||||||
package org.itxtech.daedalus.fragment;
|
package org.itxtech.daedalus.fragment;
|
||||||
|
|
||||||
import android.content.Intent;
|
|
||||||
import android.net.Uri;
|
|
||||||
import android.os.Build;
|
import android.os.Build;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.preference.*;
|
import android.preference.*;
|
||||||
@ -104,7 +102,7 @@ public class GlobalConfigFragment extends PreferenceFragment {
|
|||||||
findPreference("settings_check_update").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
findPreference("settings_check_update").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus/releases")));
|
Daedalus.openUri("https://github.com/iTXTech/Daedalus/releases");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -112,7 +110,7 @@ public class GlobalConfigFragment extends PreferenceFragment {
|
|||||||
findPreference("settings_issue_tracker").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
findPreference("settings_issue_tracker").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus/issues")));
|
Daedalus.openUri("https://github.com/iTXTech/Daedalus/issues");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -120,7 +118,7 @@ public class GlobalConfigFragment extends PreferenceFragment {
|
|||||||
findPreference("settings_manual").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
findPreference("settings_manual").setOnPreferenceClickListener(new Preference.OnPreferenceClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus/wiki")));
|
Daedalus.openUri("https://github.com/iTXTech/Daedalus/wiki");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user