Skip to content

Commit

Permalink
Improved service listening & updated about page
Browse files Browse the repository at this point in the history
  • Loading branch information
PeratX committed Apr 8, 2017
1 parent f8b82fd commit 7a422e5
Show file tree
Hide file tree
Showing 10 changed files with 34 additions and 38 deletions.
File renamed without changes
File renamed without changes
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand All @@ -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>
打开菜单探索更多功能。
Expand Down
File renamed without changes
4 changes: 2 additions & 2 deletions app/src/main/java/org/itxtech/daedalus/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,9 @@ public boolean onLongClick(View view) {
});

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() {
Expand Down
24 changes: 11 additions & 13 deletions app/src/main/java/org/itxtech/daedalus/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
* the Free Software Foundation, version 3.
*/
public class MainActivity extends AppCompatActivity {
private boolean serviceActivated = false;
private SharedPreferences prefs;

@Override
Expand All @@ -36,7 +35,6 @@ protected void onCreate(Bundle savedInstanceState) {

initConfig();

serviceActivated = isServiceActivated();
setContentView(R.layout.activity_main);
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
setSupportActionBar(toolbar);
Expand All @@ -51,21 +49,19 @@ public void onClick(View v) {
});

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);
}
}
});
Expand All @@ -76,11 +72,10 @@ protected void onRestart() {
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();
}
Expand Down Expand Up @@ -126,6 +121,9 @@ protected void onActivityResult(int request, int result, Intent data) {
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);
}
}

Expand Down
4 changes: 2 additions & 2 deletions app/src/main/res/layout/content_main.xml
Original file line number Diff line number Diff line change
Expand Up @@ -34,15 +34,15 @@
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"
app:layout_marginTopPercent="5%"
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"
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values-zh/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
@@ -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>
Expand Down

0 comments on commit 7a422e5

Please sign in to comment.