Updated README

This commit is contained in:
PeratX 2017-06-13 22:08:00 +08:00
parent 14e6797d79
commit ffae7c9646
4 changed files with 17 additions and 11 deletions

View File

@ -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' 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) height="80">](https://play.google.com/store/apps/details?id=org.itxtech.daedalus)
Manual
-------------
[Wiki](https://github.com/iTXTech/Daedalus/wiki)
Introduction Introduction
------------- -------------
This application can create a VPN tunnel to modify the DNS settings on Android.<br> This application can create a VPN tunnel to modify the DNS settings on Android.<br>

View File

@ -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 String LAUNCH_FRAGMENT = "org.itxtech.daedalus.activity.MainActivity.LAUNCH_FRAGMENT";
public static final int FRAGMENT_NONE = -1; 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_DNS_TEST = 1;
public static final int FRAGMENT_SETTINGS = 2; public static final int FRAGMENT_SETTINGS = 2;
public static final int FRAGMENT_ABOUT = 3; 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); DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_drawer_layout);
if (drawer.isDrawerOpen(GravityCompat.START)) { if (drawer.isDrawerOpen(GravityCompat.START)) {
drawer.closeDrawer(GravityCompat.START); drawer.closeDrawer(GravityCompat.START);
} else if (!(currentFragment instanceof MainFragment)) { } else if (!(currentFragment instanceof HomeFragment)) {
switchFragment(new MainFragment()); switchFragment(new HomeFragment());
} else { } else {
super.onBackPressed(); super.onBackPressed();
} }
@ -187,7 +187,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
} }
private void updateMainButton(int id) { private void updateMainButton(int id) {
if (currentFragment instanceof MainFragment) { if (currentFragment instanceof HomeFragment) {
Button button = (Button) currentFragment.getView().findViewById(R.id.button_activate); Button button = (Button) currentFragment.getView().findViewById(R.id.button_activate);
button.setText(id); button.setText(id);
} }
@ -216,8 +216,8 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
case FRAGMENT_DNS_TEST: case FRAGMENT_DNS_TEST:
switchFragment(new DNSTestFragment()); switchFragment(new DNSTestFragment());
break; break;
case FRAGMENT_MAIN: case FRAGMENT_HOME:
switchFragment(new MainFragment()); switchFragment(new HomeFragment());
break; break;
case FRAGMENT_RULES: case FRAGMENT_RULES:
switchFragment(new RulesFragment()); switchFragment(new RulesFragment());
@ -230,7 +230,7 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
break; break;
} }
if (currentFragment == null) { 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"))); startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus")));
break; break;
case R.id.nav_home: case R.id.nav_home:
switchFragment(new MainFragment()); switchFragment(new HomeFragment());
break; break;
case R.id.nav_rules: case R.id.nav_rules:
switchFragment(new RulesFragment()); switchFragment(new RulesFragment());

View File

@ -22,7 +22,7 @@ import org.itxtech.daedalus.activity.MainActivity;
* the Free Software Foundation, either version 3 of the License, or * the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version. * (at your option) any later version.
*/ */
public class MainFragment extends ToolbarFragment { public class HomeFragment extends ToolbarFragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
@ -33,7 +33,8 @@ public class MainFragment extends ToolbarFragment {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (Daedalus.getInstance().isServiceActivated()) { if (Daedalus.getInstance().isServiceActivated()) {
Daedalus.getInstance().deactivateService(); startActivity(new Intent(getActivity(), MainActivity.class)
.putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_DEACTIVATE));
} else { } else {
startActivity(new Intent(getActivity(), MainActivity.class) startActivity(new Intent(getActivity(), MainActivity.class)
.putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_ACTIVATE)); .putExtra(MainActivity.LAUNCH_ACTION, MainActivity.LAUNCH_ACTION_ACTIVATE));

View File

@ -11,7 +11,7 @@
android:paddingTop="@dimen/activity_vertical_margin" android:paddingTop="@dimen/activity_vertical_margin"
android:paddingBottom="@dimen/activity_vertical_margin" android:paddingBottom="@dimen/activity_vertical_margin"
app:layout_behavior="@string/appbar_scrolling_view_behavior" app:layout_behavior="@string/appbar_scrolling_view_behavior"
tools:context="org.itxtech.daedalus.fragment.MainFragment"> tools:context="org.itxtech.daedalus.fragment.HomeFragment">
<ImageView <ImageView
android:contentDescription="icon" android:contentDescription="icon"
android:id="@+id/imageView_icon" android:id="@+id/imageView_icon"