diff --git a/app/build.gradle b/app/build.gradle index 88a5518..496d26a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,5 +1,7 @@ apply plugin: 'com.android.application' +def gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim() + android { compileSdkVersion 25 buildToolsVersion "25.0.2" @@ -26,7 +28,7 @@ android { variant.outputs.each { output -> def outputFile = output.outputFile if (outputFile != null && outputFile.name.endsWith('.apk')) { - def fileName = outputFile.name.replace("app", "${defaultConfig.applicationId}_${defaultConfig.versionName}_${System.currentTimeMillis()}") + def fileName = outputFile.name.replace("app", "${defaultConfig.applicationId}_${defaultConfig.versionName}_${gitSha}") output.outputFile = new File(outputFile.parent, fileName) } } diff --git a/app/src/main/assets/cutedns_logo.png b/app/src/main/assets/cutedns_logo.png new file mode 100644 index 0000000..4184006 Binary files /dev/null and b/app/src/main/assets/cutedns_logo.png differ diff --git a/app/src/main/assets/ic_launcher.png b/app/src/main/assets/ic_launcher.png new file mode 100644 index 0000000..bf7a9bf Binary files /dev/null and b/app/src/main/assets/ic_launcher.png differ diff --git a/app/src/main/assets/index.html b/app/src/main/assets/index.html new file mode 100644 index 0000000..cee1c60 --- /dev/null +++ b/app/src/main/assets/index.html @@ -0,0 +1,42 @@ + + + + + About iTXTech Daedalus + + + + + + + +
+
iTX Technologies
+
+
+ +
+
Daedalus
+
null
+
+
+ +
CuteDNS!
+
+
+
+
+ 使用者必须遵守当地法律法规。
+ 欢迎加入 CuteDNS! QQ群:625385297 。
+ 打开菜单探索更多功能。 +
+ + \ No newline at end of file diff --git a/app/src/main/assets/itxtech_logo.png b/app/src/main/assets/itxtech_logo.png new file mode 100644 index 0000000..beddd56 Binary files /dev/null and b/app/src/main/assets/itxtech_logo.png differ diff --git a/app/src/main/java/org/itxtech/daedalus/AboutActivity.java b/app/src/main/java/org/itxtech/daedalus/AboutActivity.java index 1c01de5..3a3473f 100644 --- a/app/src/main/java/org/itxtech/daedalus/AboutActivity.java +++ b/app/src/main/java/org/itxtech/daedalus/AboutActivity.java @@ -1,13 +1,104 @@ package org.itxtech.daedalus; -import android.support.v7.app.AppCompatActivity; +import android.annotation.SuppressLint; +import android.content.Intent; +import android.net.Uri; import android.os.Bundle; +import android.support.v7.app.AppCompatActivity; +import android.util.Log; +import android.view.Menu; +import android.view.MenuItem; +import android.webkit.WebView; +import android.webkit.WebViewClient; +import java.util.Locale; + +/** + * Daedalus Project + * + * @author iTXTech + * @link https://itxtech.org + *

+ * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, version 3. + */ public class AboutActivity extends AppCompatActivity { + @SuppressLint({"JavascriptInterface", "SetJavaScriptEnabled"}) @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about); + + WebView view = (WebView) findViewById(R.id.webView_about); + + view.getSettings().setJavaScriptEnabled(true); + view.addJavascriptInterface(this, "JavascriptInterface"); + + if (Locale.getDefault().getLanguage().equals("zh")) {//TODO: multi language + view.loadUrl("file:///android_asset/index.html"); + } else { + view.loadUrl("file:///android_asset/index.html"); + } + + view.setWebViewClient(new WebViewClient() { + @Override + public void onPageFinished(WebView view, String url) { + super.onPageFinished(view, url); + try { + view.loadUrl("javascript:changeVersion('" + getPackageManager().getPackageInfo(getPackageName(), 0).versionName + "')"); + } catch (Exception e) { + Log.e("Dvpn", e.toString()); + } + } + }); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + // Inflate the menu; this adds items to the action bar if it is present. + getMenuInflater().inflate(R.menu.menu_about, menu); + return true; + } + + @Override + public boolean onOptionsItemSelected(MenuItem item) { + // Handle action bar item clicks here. The action bar will + // automatically handle clicks on the Home/Up button, so long + // as you specify a parent activity in AndroidManifest.xml. + int id = item.getItemId(); + + //noinspection SimplifiableIfStatement + if (id == R.id.action_visit_itxtech) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://itxtech.org"))); + } + + if (id == R.id.action_visit_github) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus"))); + } + + if (id == R.id.action_visit_cutedns) { + startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://www.cutedns.cn"))); + } + + if (id == R.id.action_join_qqgroup) { + joinQQGroup("gg"); + } + + return super.onOptionsItemSelected(item); + } + + private boolean joinQQGroup(String key) { + Intent intent = new Intent(); + intent.setData(Uri.parse("mqqopensdkapi://bizAgent/qm/qr?url=http%3A%2F%2Fqm.qq.com%2Fcgi-bin%2Fqm%2Fqr%3Ffrom%3Dapp%26p%3Dandroid%26k%3D" + key)); + // 此Flag可根据具体产品需要自定义,如设置,则在加群界面按返回,返回手Q主界面,不设置,按返回会返回到呼起产品界面 //intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + try { + startActivity(intent); + return true; + } catch (Exception e) { + // 未安装手Q或安装的版本不支持 + return false; + } } } diff --git a/app/src/main/java/org/itxtech/daedalus/MainActivity.java b/app/src/main/java/org/itxtech/daedalus/MainActivity.java index 0ddf93d..85ff9fa 100644 --- a/app/src/main/java/org/itxtech/daedalus/MainActivity.java +++ b/app/src/main/java/org/itxtech/daedalus/MainActivity.java @@ -5,7 +5,6 @@ import android.app.NotificationManager; import android.content.Context; import android.content.Intent; import android.content.SharedPreferences; -import android.net.Uri; import android.net.VpnService; import android.os.Bundle; import android.preference.PreferenceManager; @@ -155,10 +154,6 @@ public class MainActivity extends AppCompatActivity { return true; } - if (id == R.id.action_project_home) { - startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus"))); - } - return super.onOptionsItemSelected(item); } } diff --git a/app/src/main/java/org/itxtech/daedalus/ServerTestActivity.java b/app/src/main/java/org/itxtech/daedalus/ServerTestActivity.java index 0ca23a5..c993420 100644 --- a/app/src/main/java/org/itxtech/daedalus/ServerTestActivity.java +++ b/app/src/main/java/org/itxtech/daedalus/ServerTestActivity.java @@ -61,6 +61,9 @@ public class ServerTestActivity extends AppCompatActivity { public void run() { try { String testUrl = textViewTestUrl.getText().toString(); + if (testUrl.equals("")) { + testUrl = getResources().getStringArray(R.array.default_test_urls)[0]; + } String testText = ""; String[] dnsServers = {DnsServers.getDnsServerAddress(String.valueOf(spinnerServerChoice.getSelectedItemId())), "114.114.114.114", "8.8.8.8"}; DNSClient client = new DNSClient(null); diff --git a/app/src/main/res/layout-land/content_main.xml b/app/src/main/res/layout-land/content_main.xml deleted file mode 100644 index c03aaf5..0000000 --- a/app/src/main/res/layout-land/content_main.xml +++ /dev/null @@ -1,31 +0,0 @@ - - -