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

View File

@ -12,19 +12,17 @@
<script type="text/javascript">
function changeVersionInfo(version, time, gitCommit) {
document.getElementById("version").innerHTML = "版本: " + version;
document.getElementById("version").innerHTML = "版本" + version;
document.getElementById("build_time").innerHTML = "构建时间:" + time;
document.getElementById("git_commit").innerHTML = "Git commit" + gitCommit;
}
</script>
<body>
<img width="100" height="100" src="itxtech_logo.png"/>
<br>
<img width="100" height="100" src="itxtech_logo.png"/><br>
<div style="font-size:25px">iTX Technologies</div>
<br>
<img width="92" height="70" src="ic_launcher.png">
<br>
<img width="92" height="70" src="ic_launcher.png"><br>
<div style="font-size: 25px;">Daedalus</div>
<div id="version" 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">
<div style="font-size: 25px;">CuteDNS!</div>
<br>
<div style="font-size: 10px; color: gray;">
<br>
<div style="font-size: 12px; color: gray;">
使用者必须遵守当地法律法规。<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")) {
view.loadUrl("file:///android_asset/index_zh.html");
view.loadUrl("file:///android_asset/about_html/index_zh.html");
} else {
view.loadUrl("file:///android_asset/index.html");
view.loadUrl("file:///android_asset/about_html/index.html");
}
view.setWebViewClient(new WebViewClient() {

View File

@ -27,7 +27,6 @@ import android.widget.Button;
* the Free Software Foundation, version 3.
*/
public class MainActivity extends AppCompatActivity {
private boolean serviceActivated = false;
private SharedPreferences prefs;
@Override
@ -36,7 +35,6 @@ public class MainActivity extends AppCompatActivity {
initConfig();
serviceActivated = isServiceActivated();
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
@ -51,21 +49,19 @@ public class MainActivity extends AppCompatActivity {
});
final Button but = (Button) findViewById(R.id.button_activate);
if (serviceActivated) {
but.setText(R.string.deactivate);
if (isServiceActivated()) {
but.setText(R.string.button_text_deactivate);
} else {
but.setText(R.string.activate);
but.setText(R.string.button_text_activate);
}
but.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
serviceActivated = isServiceActivated();
if (serviceActivated) {
if (isServiceActivated()) {
but.setText(R.string.button_text_activate);
deactivateService();
but.setText(R.string.activate);
} else {
activateService();
but.setText(R.string.deactivate);
}
}
});
@ -76,11 +72,10 @@ public class MainActivity extends AppCompatActivity {
super.onRestart();
final Button but = (Button) findViewById(R.id.button_activate);
serviceActivated = isServiceActivated();
if (serviceActivated) {
but.setText(R.string.deactivate);
if (isServiceActivated()) {
but.setText(R.string.button_text_deactivate);
} else {
but.setText(R.string.activate);
but.setText(R.string.button_text_activate);
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
notificationManager.cancelAll();
}
@ -126,6 +121,9 @@ public class MainActivity extends AppCompatActivity {
DaedalusVpnService.secondaryServer = DnsServers.getDnsServerAddress(prefs.getString("secondary_server", "1"));
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:layout_centerHorizontal="true" android:id="@+id/textView_app_name"/>
<TextView
android:text="@string/notice"
android:text="@string/notice_main"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/textView_notice"
@ -42,7 +42,7 @@
android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif"
android:layout_below="@+id/textView_app_name" android:layout_centerHorizontal="true"/>
<Button
android:text="@string/activate"
android:text="@string/button_text_activate"
android:textSize="15sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"

View File

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

View File

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