Improved service listening & updated about page

This commit is contained in:
PeratX 2017-04-08 13:51:20 +08:00
parent f8b82fd71d
commit 7a422e53b0
10 changed files with 34 additions and 38 deletions

View File

Before

Width:  |  Height:  |  Size: 14 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

Before

Width:  |  Height:  |  Size: 6.1 KiB

After

Width:  |  Height:  |  Size: 6.1 KiB

View File

@ -12,19 +12,17 @@
<script type="text/javascript"> <script type="text/javascript">
function changeVersionInfo(version, time, gitCommit) { function changeVersionInfo(version, time, gitCommit) {
document.getElementById("version").innerHTML = "版本: " + version; document.getElementById("version").innerHTML = "Version: " + version;
document.getElementById("build_time").innerHTML = "构建时间:" + time; document.getElementById("build_time").innerHTML = "Build time: " + time;
document.getElementById("git_commit").innerHTML = "Git commit" + gitCommit; document.getElementById("git_commit").innerHTML = "Git commit: " + gitCommit;
} }
</script> </script>
<body> <body>
<img width="100" height="100" src="itxtech_logo.png"/> <img width="100" height="100" src="itxtech_logo.png"/><br>
<br>
<div style="font-size:25px">iTX Technologies</div> <div style="font-size:25px">iTX Technologies</div>
<br> <br>
<img width="92" height="70" src="ic_launcher.png"> <img width="92" height="70" src="ic_launcher.png"><br>
<br>
<div style="font-size: 25px;">Daedalus</div> <div style="font-size: 25px;">Daedalus</div>
<div id="version" style="font-size: 10px;">null</div> <div id="version" style="font-size: 10px;">null</div>
<div id="build_time" style="font-size: 10px;">null</div> <div id="build_time" style="font-size: 10px;">null</div>
@ -33,8 +31,9 @@
<img width="185" height="55" src="cutedns_logo.png"> <img width="185" height="55" src="cutedns_logo.png">
<div style="font-size: 25px;">CuteDNS!</div> <div style="font-size: 25px;">CuteDNS!</div>
<br> <br>
<div style="font-size: 10px; color: gray;"> <br>
Users must comply with local laws and regulations。<br> <div style="font-size: 12px; color: gray;">
Users must comply with local laws and regulations.<br>
Welcome to CuteDNS! QQ Group: 625385297.<br> Welcome to CuteDNS! QQ Group: 625385297.<br>
Open the menu to explore more features. Open the menu to explore more features.
</div> </div>

View File

@ -12,19 +12,17 @@
<script type="text/javascript"> <script type="text/javascript">
function changeVersionInfo(version, time, gitCommit) { function changeVersionInfo(version, time, gitCommit) {
document.getElementById("version").innerHTML = "版本: " + version; document.getElementById("version").innerHTML = "版本" + version;
document.getElementById("build_time").innerHTML = "构建时间:" + time; document.getElementById("build_time").innerHTML = "构建时间:" + time;
document.getElementById("git_commit").innerHTML = "Git commit" + gitCommit; document.getElementById("git_commit").innerHTML = "Git commit" + gitCommit;
} }
</script> </script>
<body> <body>
<img width="100" height="100" src="itxtech_logo.png"/> <img width="100" height="100" src="itxtech_logo.png"/><br>
<br>
<div style="font-size:25px">iTX Technologies</div> <div style="font-size:25px">iTX Technologies</div>
<br> <br>
<img width="92" height="70" src="ic_launcher.png"> <img width="92" height="70" src="ic_launcher.png"><br>
<br>
<div style="font-size: 25px;">Daedalus</div> <div style="font-size: 25px;">Daedalus</div>
<div id="version" style="font-size: 10px;">null</div> <div id="version" style="font-size: 10px;">null</div>
<div id="build_time" style="font-size: 10px;">null</div> <div id="build_time" style="font-size: 10px;">null</div>
@ -33,7 +31,8 @@
<img width="185" height="55" src="cutedns_logo.png"> <img width="185" height="55" src="cutedns_logo.png">
<div style="font-size: 25px;">CuteDNS!</div> <div style="font-size: 25px;">CuteDNS!</div>
<br> <br>
<div style="font-size: 10px; color: gray;"> <br>
<div style="font-size: 12px; color: gray;">
使用者必须遵守当地法律法规。<br> 使用者必须遵守当地法律法规。<br>
欢迎加入 CuteDNS! QQ群625385297 。<br> 欢迎加入 CuteDNS! QQ群625385297 。<br>
打开菜单探索更多功能。 打开菜单探索更多功能。

View File

Before

Width:  |  Height:  |  Size: 6.6 KiB

After

Width:  |  Height:  |  Size: 6.6 KiB

View File

@ -47,9 +47,9 @@ public class AboutActivity extends AppCompatActivity {
}); });
if (Locale.getDefault().getLanguage().equals("zh")) { if (Locale.getDefault().getLanguage().equals("zh")) {
view.loadUrl("file:///android_asset/index_zh.html"); view.loadUrl("file:///android_asset/about_html/index_zh.html");
} else { } else {
view.loadUrl("file:///android_asset/index.html"); view.loadUrl("file:///android_asset/about_html/index.html");
} }
view.setWebViewClient(new WebViewClient() { view.setWebViewClient(new WebViewClient() {

View File

@ -27,7 +27,6 @@ import android.widget.Button;
* the Free Software Foundation, version 3. * the Free Software Foundation, version 3.
*/ */
public class MainActivity extends AppCompatActivity { public class MainActivity extends AppCompatActivity {
private boolean serviceActivated = false;
private SharedPreferences prefs; private SharedPreferences prefs;
@Override @Override
@ -36,7 +35,6 @@ public class MainActivity extends AppCompatActivity {
initConfig(); initConfig();
serviceActivated = isServiceActivated();
setContentView(R.layout.activity_main); setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar); setSupportActionBar(toolbar);
@ -51,21 +49,19 @@ public class MainActivity extends AppCompatActivity {
}); });
final Button but = (Button) findViewById(R.id.button_activate); final Button but = (Button) findViewById(R.id.button_activate);
if (serviceActivated) { if (isServiceActivated()) {
but.setText(R.string.deactivate); but.setText(R.string.button_text_deactivate);
} else { } else {
but.setText(R.string.activate); but.setText(R.string.button_text_activate);
} }
but.setOnClickListener(new View.OnClickListener() { but.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
serviceActivated = isServiceActivated(); if (isServiceActivated()) {
if (serviceActivated) { but.setText(R.string.button_text_activate);
deactivateService(); deactivateService();
but.setText(R.string.activate);
} else { } else {
activateService(); activateService();
but.setText(R.string.deactivate);
} }
} }
}); });
@ -76,11 +72,10 @@ public class MainActivity extends AppCompatActivity {
super.onRestart(); super.onRestart();
final Button but = (Button) findViewById(R.id.button_activate); final Button but = (Button) findViewById(R.id.button_activate);
serviceActivated = isServiceActivated(); if (isServiceActivated()) {
if (serviceActivated) { but.setText(R.string.button_text_deactivate);
but.setText(R.string.deactivate);
} else { } else {
but.setText(R.string.activate); but.setText(R.string.button_text_activate);
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE); NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll(); notificationManager.cancelAll();
} }
@ -126,6 +121,9 @@ public class MainActivity extends AppCompatActivity {
DaedalusVpnService.secondaryServer = DnsServers.getDnsServerAddress(prefs.getString("secondary_server", "1")); DaedalusVpnService.secondaryServer = DnsServers.getDnsServerAddress(prefs.getString("secondary_server", "1"));
startService(getServiceIntent().setAction(DaedalusVpnService.ACTION_ACTIVATE)); startService(getServiceIntent().setAction(DaedalusVpnService.ACTION_ACTIVATE));
((Button) findViewById(R.id.button_activate)).setText(R.string.button_text_deactivate);
} }
} }

View File

@ -34,7 +34,7 @@
android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif" android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif"
android:layout_centerHorizontal="true" android:id="@+id/textView_app_name"/> android:layout_centerHorizontal="true" android:id="@+id/textView_app_name"/>
<TextView <TextView
android:text="@string/notice" android:text="@string/notice_main"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:id="@+id/textView_notice" android:id="@+id/textView_notice"
@ -42,7 +42,7 @@
android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif" android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif"
android:layout_below="@+id/textView_app_name" android:layout_centerHorizontal="true"/> android:layout_below="@+id/textView_app_name" android:layout_centerHorizontal="true"/>
<Button <Button
android:text="@string/activate" android:text="@string/button_text_activate"
android:textSize="15sp" android:textSize="15sp"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"

View File

@ -2,9 +2,9 @@
<resources> <resources>
<string name="app_name">Daedalus</string> <string name="app_name">Daedalus</string>
<string name="action_settings">设置</string> <string name="action_settings">设置</string>
<string name="notice">方便易用的基于 CuteDNS 的科学上网工具</string> <string name="notice_main">通过 CuteDNS! 去看看外面的世界</string>
<string name="activate">启用</string> <string name="button_text_activate">启用</string>
<string name="deactivate">停用</string> <string name="button_text_deactivate">停用</string>
<string name="action_about">关于</string> <string name="action_about">关于</string>
<string name="notification_activated">点击回到 Daedalus</string> <string name="notification_activated">点击回到 Daedalus</string>
<string name="settings_system">系统设置</string> <string name="settings_system">系统设置</string>

View File

@ -1,9 +1,9 @@
<resources> <resources>
<string name="app_name">Daedalus</string> <string name="app_name">Daedalus</string>
<string name="action_settings">Settings</string> <string name="action_settings">Settings</string>
<string name="notice">The CuteDNS implementation on Android.</string> <string name="notice_main">Through CuteDNS! to see the world outside.</string>
<string name="activate">Activate</string> <string name="button_text_activate">Activate</string>
<string name="deactivate">Deactivate</string> <string name="button_text_deactivate">Deactivate</string>
<string name="action_about">About</string> <string name="action_about">About</string>
<string name="notification_activated">Click to back to Daedalus</string> <string name="notification_activated">Click to back to Daedalus</string>
<string name="settings_system">System settings</string> <string name="settings_system">System settings</string>