From 7db744aa751650835298a21eec334e001af28dff Mon Sep 17 00:00:00 2001 From: PeratX <1215714524@qq.com> Date: Wed, 17 May 2017 22:28:32 +0800 Subject: [PATCH] Fixed configActivity startActivity fail on Android 6.x --- .../org/itxtech/daedalus/fragment/DnsServersFragment.java | 7 +++++-- .../java/org/itxtech/daedalus/fragment/RulesFragment.java | 6 ++++-- .../java/org/itxtech/daedalus/fragment/RulesFragment1.java | 7 +++++++ 3 files changed, 16 insertions(+), 4 deletions(-) create mode 100644 app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment1.java diff --git a/app/src/main/java/org/itxtech/daedalus/fragment/DnsServersFragment.java b/app/src/main/java/org/itxtech/daedalus/fragment/DnsServersFragment.java index d792636..6a86d6a 100644 --- a/app/src/main/java/org/itxtech/daedalus/fragment/DnsServersFragment.java +++ b/app/src/main/java/org/itxtech/daedalus/fragment/DnsServersFragment.java @@ -75,7 +75,8 @@ public class DnsServersFragment extends Fragment { public void onClick(View v) { startActivity(new Intent(getActivity(), ConfigActivity.class) .putExtra(ConfigActivity.LAUNCH_ACTION_ID, ConfigActivity.ID_NONE) - .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_DNS_SERVER)); + .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_DNS_SERVER) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } }); return view; @@ -156,7 +157,9 @@ public class DnsServersFragment extends Fragment { public void onClick(View v) { if (!DnsServerHelper.isInUsing(Daedalus.configurations.getCustomDnsServers().get(index))) { Daedalus.getInstance().startActivity(new Intent(Daedalus.getInstance(), ConfigActivity.class) - .putExtra(ConfigActivity.LAUNCH_ACTION_ID, index)); + .putExtra(ConfigActivity.LAUNCH_ACTION_ID, index) + .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_DNS_SERVER) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } } } diff --git a/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment.java b/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment.java index d0174e4..089fcbf 100644 --- a/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment.java +++ b/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment.java @@ -80,7 +80,8 @@ public class RulesFragment extends Fragment { public void onClick(View v) { startActivity(new Intent(getActivity(), ConfigActivity.class) .putExtra(ConfigActivity.LAUNCH_ACTION_ID, ConfigActivity.ID_NONE) - .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_RULE)); + .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_RULE) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } }); return view; @@ -184,7 +185,8 @@ public class RulesFragment extends Fragment { if (!Daedalus.configurations.getRules().get(index).isUsing()) { Daedalus.getInstance().startActivity(new Intent(Daedalus.getInstance(), ConfigActivity.class) .putExtra(ConfigActivity.LAUNCH_ACTION_ID, index) - .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_RULE)); + .putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_RULE) + .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK)); } return true; } diff --git a/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment1.java b/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment1.java new file mode 100644 index 0000000..c218f1b --- /dev/null +++ b/app/src/main/java/org/itxtech/daedalus/fragment/RulesFragment1.java @@ -0,0 +1,7 @@ +package org.itxtech.daedalus.fragment; + +/** + * @author PeratX + */ +public class RulesFragment1 { +}