Updated AboutActivity & improved test domain input
This commit is contained in:
parent
132a90b181
commit
3194ffdc7b
@ -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)
|
||||
}
|
||||
}
|
||||
|
BIN
app/src/main/assets/cutedns_logo.png
Normal file
BIN
app/src/main/assets/cutedns_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 14 KiB |
BIN
app/src/main/assets/ic_launcher.png
Normal file
BIN
app/src/main/assets/ic_launcher.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.1 KiB |
42
app/src/main/assets/index.html
Normal file
42
app/src/main/assets/index.html
Normal file
@ -0,0 +1,42 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en" xmlns="http://www.w3.org/1999/html">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>About iTXTech Daedalus</title>
|
||||
<style>
|
||||
body {
|
||||
text-align: center;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<script type="text/javascript">
|
||||
function changeVersion(softwareVersion) {
|
||||
document.getElementById("version").innerHTML = "Version: " + softwareVersion;
|
||||
}
|
||||
</script>
|
||||
|
||||
<body>
|
||||
<img width="128" height="128" src="itxtech_logo.png"/>
|
||||
<br>
|
||||
<div style="font-size:25px">iTX Technologies</div>
|
||||
<br>
|
||||
<br>
|
||||
<img width="92" height="70" src="ic_launcher.png">
|
||||
<br>
|
||||
<div style="font-size: 25px;">Daedalus</div>
|
||||
<div id="version" style="font-size: 20px;">null</div>
|
||||
<br>
|
||||
<br>
|
||||
<img width="185" height="55" src="cutedns_logo.png">
|
||||
<div style="font-size: 25px;">CuteDNS!</div>
|
||||
<br>
|
||||
<br>
|
||||
<br>
|
||||
<div style="font-size: 10px; color: gray;">
|
||||
使用者必须遵守当地法律法规。<br>
|
||||
欢迎加入 CuteDNS! QQ群:625385297 。<br>
|
||||
打开菜单探索更多功能。
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
BIN
app/src/main/assets/itxtech_logo.png
Normal file
BIN
app/src/main/assets/itxtech_logo.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 6.6 KiB |
@ -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
|
||||
* <p>
|
||||
* 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,31 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/content_main"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:showIn="@layout/activity_main"
|
||||
tools:context="org.itxtech.daedalus.MainActivity">
|
||||
<Button
|
||||
android:text="@string/activate"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button_activate"
|
||||
android:layout_centerVertical="true" android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:text="@string/notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView_notice"
|
||||
android:textSize="15sp"
|
||||
android:layout_marginTop="100dp"
|
||||
android:layout_alignParentTop="true" android:layout_centerHorizontal="true"/>
|
||||
</RelativeLayout>
|
@ -7,19 +7,20 @@
|
||||
android:layout_height="wrap_content">
|
||||
<RelativeLayout
|
||||
android:id="@+id/activity_about"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:paddingLeft="@dimen/activity_horizontal_margin"
|
||||
android:paddingRight="@dimen/activity_horizontal_margin"
|
||||
android:paddingTop="@dimen/activity_vertical_margin"
|
||||
android:paddingBottom="@dimen/activity_vertical_margin"
|
||||
tools:context="org.itxtech.daedalus.AboutActivity">
|
||||
|
||||
<TextView
|
||||
android:text="@string/about"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView_about"
|
||||
android:textSize="20sp" android:layout_alignParentTop="true" android:layout_alignParentStart="true"/>
|
||||
<WebView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:id="@+id/webView_about"
|
||||
android:overScrollMode="never"
|
||||
android:scrollbars="none"
|
||||
android:layout_alignParentStart="true" android:layout_alignParentTop="true"/>
|
||||
</RelativeLayout>
|
||||
</ScrollView>
|
@ -34,10 +34,9 @@
|
||||
android:id="@+id/textView_test_info"
|
||||
android:textSize="18sp"/>
|
||||
<AutoCompleteTextView
|
||||
android:text="www.google.com"
|
||||
android:completionThreshold="3"
|
||||
android:completionThreshold="1"
|
||||
android:singleLine="true"
|
||||
android:dropDownWidth="wrap_content"
|
||||
android:hint="@string/test_test_url"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/autoCompleteTextView_test_url" android:layout_below="@+id/spinner_server_choice"
|
||||
|
@ -13,22 +13,6 @@
|
||||
app:layout_behavior="@string/appbar_scrolling_view_behavior"
|
||||
tools:showIn="@layout/activity_main"
|
||||
tools:context="org.itxtech.daedalus.MainActivity">
|
||||
<Button
|
||||
android:text="@string/activate"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button_activate"
|
||||
android:layout_centerVertical="true" android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:text="@string/notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView_notice"
|
||||
android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif"
|
||||
android:layout_above="@+id/button_activate"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="50dp"/>
|
||||
<ImageView
|
||||
android:contentDescription="icon"
|
||||
android:layout_width="wrap_content"
|
||||
@ -37,4 +21,20 @@
|
||||
android:clickable="false"
|
||||
android:minHeight="120dp" android:minWidth="150dp"
|
||||
android:layout_alignParentTop="true" android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:text="@string/notice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView_notice"
|
||||
android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif"
|
||||
android:layout_marginTop="46dp"
|
||||
android:layout_below="@+id/imageView" android:layout_centerHorizontal="true"/>
|
||||
<Button
|
||||
android:text="@string/activate"
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button_activate"
|
||||
android:layout_marginTop="60dp"
|
||||
android:layout_alignTop="@+id/textView_notice" android:layout_centerHorizontal="true"/>
|
||||
</RelativeLayout>
|
||||
|
21
app/src/main/res/menu/menu_about.xml
Normal file
21
app/src/main/res/menu/menu_about.xml
Normal file
@ -0,0 +1,21 @@
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:context="org.itxtech.daedalus.AboutActivity">
|
||||
<item android:id="@+id/action_visit_itxtech"
|
||||
android:title="@string/action_visit_itxtech"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="never"/>
|
||||
<item android:id="@+id/action_visit_github"
|
||||
android:title="@string/action_visit_github"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="never"/>
|
||||
<item android:id="@+id/action_visit_cutedns"
|
||||
android:title="@string/action_visit_cutedns"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="never"/>
|
||||
<item android:id="@+id/action_join_qqgroup"
|
||||
android:title="@string/action_join_qqgroup"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="never"/>
|
||||
</menu>
|
@ -9,8 +9,4 @@
|
||||
android:title="@string/action_about"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="never"/>
|
||||
<item android:id="@+id/action_project_home"
|
||||
android:title="@string/action_project_home"
|
||||
android:orderInCategory="100"
|
||||
app:showAsAction="never"/>
|
||||
</menu>
|
||||
|
@ -30,5 +30,9 @@
|
||||
<string name="test_dns_server">DNS 服务器:</string>
|
||||
<string name="test_resolved_address">解析的地址:</string>
|
||||
<string name="test_failed">查询失败。超时或未知的主机。</string>
|
||||
<string name="action_project_home">项目主页</string>
|
||||
<string name="test_test_url">google.com</string>
|
||||
<string name="action_visit_cutedns">访问 CuteDNS!</string>
|
||||
<string name="action_visit_github">访问 项目主页</string>
|
||||
<string name="action_visit_itxtech">访问 iTXTech</string>
|
||||
<string name="action_join_qqgroup">加入 CuteDNS! QQ群</string>
|
||||
</resources>
|
@ -10,9 +10,10 @@
|
||||
<item>2</item>
|
||||
</string-array>
|
||||
<string-array name="default_test_urls">
|
||||
<item>www.google.com</item>
|
||||
<item>google.com</item>
|
||||
<item>twitter.com</item>
|
||||
<item>youtube.com</item>
|
||||
<item>facebook.com</item>
|
||||
<item>wikipedia.org</item>
|
||||
</string-array>
|
||||
</resources>
|
@ -31,5 +31,9 @@
|
||||
<string name="test_dns_server">DNS server:</string>
|
||||
<string name="test_resolved_address">Resolved address:</string>
|
||||
<string name="test_failed">Query failed. Timeout or unknown hostname.</string>
|
||||
<string name="action_project_home">Project home</string>
|
||||
<string name="test_test_url">google.com</string>
|
||||
<string name="action_visit_itxtech">Visit iTXTech</string>
|
||||
<string name="action_visit_cutedns">Visit CuteDNS!</string>
|
||||
<string name="action_visit_github">Visit Project home</string>
|
||||
<string name="action_join_qqgroup">Join QQ group</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user