From ffae7c964659ba01563704cf8261b16c33057db9 Mon Sep 17 00:00:00 2001
From: PeratX <1215714524@qq.com>
Date: Tue, 13 Jun 2017 22:08:00 +0800
Subject: [PATCH] Updated README
---
README.md | 5 +++++
.../itxtech/daedalus/activity/MainActivity.java | 16 ++++++++--------
.../{MainFragment.java => HomeFragment.java} | 5 +++--
app/src/main/res/layout/fragment_main.xml | 2 +-
4 files changed, 17 insertions(+), 11 deletions(-)
rename app/src/main/java/org/itxtech/daedalus/fragment/{MainFragment.java => HomeFragment.java} (89%)
diff --git a/README.md b/README.md
index ab4ba9c..b146cf0 100644
--- a/README.md
+++ b/README.md
@@ -12,6 +12,11 @@ __[Releases](https://github.com/iTXTech/Daedalus/releases)__
src='https://play.google.com/intl/en_us/badges/images/generic/en_badge_web_generic.png'
height="80">](https://play.google.com/store/apps/details?id=org.itxtech.daedalus)
+Manual
+-------------
+[Wiki](https://github.com/iTXTech/Daedalus/wiki)
+
+
Introduction
-------------
This application can create a VPN tunnel to modify the DNS settings on Android.
diff --git a/app/src/main/java/org/itxtech/daedalus/activity/MainActivity.java b/app/src/main/java/org/itxtech/daedalus/activity/MainActivity.java
index c557e67..9678249 100644
--- a/app/src/main/java/org/itxtech/daedalus/activity/MainActivity.java
+++ b/app/src/main/java/org/itxtech/daedalus/activity/MainActivity.java
@@ -50,7 +50,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
public static final String LAUNCH_FRAGMENT = "org.itxtech.daedalus.activity.MainActivity.LAUNCH_FRAGMENT";
public static final int FRAGMENT_NONE = -1;
- public static final int FRAGMENT_MAIN = 0;
+ public static final int FRAGMENT_HOME = 0;
public static final int FRAGMENT_DNS_TEST = 1;
public static final int FRAGMENT_SETTINGS = 2;
public static final int FRAGMENT_ABOUT = 3;
@@ -111,8 +111,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START);
- } else if (!(currentFragment instanceof MainFragment)) {
- switchFragment(new MainFragment());
+ } else if (!(currentFragment instanceof HomeFragment)) {
+ switchFragment(new HomeFragment());
} else {
super.onBackPressed();
}
@@ -187,7 +187,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
}
private void updateMainButton(int id) {
- if (currentFragment instanceof MainFragment) {
+ if (currentFragment instanceof HomeFragment) {
Button button = (Button) currentFragment.getView().findViewById(R.id.button_activate);
button.setText(id);
}
@@ -216,8 +216,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case FRAGMENT_DNS_TEST:
switchFragment(new DNSTestFragment());
break;
- case FRAGMENT_MAIN:
- switchFragment(new MainFragment());
+ case FRAGMENT_HOME:
+ switchFragment(new HomeFragment());
break;
case FRAGMENT_RULES:
switchFragment(new RulesFragment());
@@ -230,7 +230,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
break;
}
if (currentFragment == null) {
- switchFragment(new MainFragment());
+ switchFragment(new HomeFragment());
}
}
@@ -253,7 +253,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus")));
break;
case R.id.nav_home:
- switchFragment(new MainFragment());
+ switchFragment(new HomeFragment());
break;
case R.id.nav_rules:
switchFragment(new RulesFragment());
diff --git a/app/src/main/java/org/itxtech/daedalus/fragment/MainFragment.java b/app/src/main/java/org/itxtech/daedalus/fragment/HomeFragment.java
similarity index 89%
rename from app/src/main/java/org/itxtech/daedalus/fragment/MainFragment.java
rename to app/src/main/java/org/itxtech/daedalus/fragment/HomeFragment.java
index 3b6002b..82e124b 100644
--- a/app/src/main/java/org/itxtech/daedalus/fragment/MainFragment.java
+++ b/app/src/main/java/org/itxtech/daedalus/fragment/HomeFragment.java
@@ -22,7 +22,7 @@ import org.itxtech.daedalus.activity.MainActivity;
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*/
-public class MainFragment extends ToolbarFragment {
+public class HomeFragment extends ToolbarFragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@@ -33,7 +33,8 @@ public class MainFragment extends ToolbarFragment {
@Override
public void onClick(View v) {
if (Daedalus.getInstance().isServiceActivated()) {
- Daedalus.getInstance().deactivateService();
+ startActivity(new Intent(getActivity(), MainActivity.class)
+ .putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_DEACTIVATE));
} else {
startActivity(new Intent(getActivity(), MainActivity.class)
.putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_ACTIVATE));
diff --git a/app/src/main/res/layout/fragment_main.xml b/app/src/main/res/layout/fragment_main.xml
index 5f1dc43..dfe48fd 100644
--- a/app/src/main/res/layout/fragment_main.xml
+++ b/app/src/main/res/layout/fragment_main.xml
@@ -11,7 +11,7 @@
android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior"
- tools:context="org.itxtech.daedalus.fragment.MainFragment">
+ tools:context="org.itxtech.daedalus.fragment.HomeFragment">