Added ServerTestActivity (TODO: test)
This commit is contained in:
parent
5d926b9fdf
commit
9329ac3da6
@ -23,6 +23,7 @@
|
||||
<receiver android:name=".BootBroadcastReceiver">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.BOOT_COMPLETED"/>
|
||||
|
||||
<category android:name="android.intent.category.LAUNCHER"/>
|
||||
</intent-filter>
|
||||
</receiver>
|
||||
@ -42,8 +43,13 @@
|
||||
android:name=".SettingsActivity"
|
||||
android:label="@string/action_settings">
|
||||
</activity>
|
||||
<activity android:name=".AboutActivity"
|
||||
android:label="@string/action_about">
|
||||
<activity
|
||||
android:name=".AboutActivity"
|
||||
android:label="@string/action_about">
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".ServerTestActivity"
|
||||
android:label="@string/action_server_test">
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
|
@ -1,20 +1,15 @@
|
||||
package org.itxtech.daedalus;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.app.Notification;
|
||||
import android.app.NotificationManager;
|
||||
import android.app.PendingIntent;
|
||||
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;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.app.NotificationCompat;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.View;
|
||||
import android.view.Menu;
|
||||
@ -49,19 +44,13 @@ public class MainActivity extends AppCompatActivity {
|
||||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab);
|
||||
fab.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Snackbar.make(view, R.string.fab_text, Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
|
||||
Intent intent = new Intent();
|
||||
intent.setAction("android.intent.action.VIEW");
|
||||
Uri siteURL = Uri.parse("http://www.cutedns.cn");
|
||||
intent.setData(siteURL);
|
||||
public void onClick(View v) {
|
||||
Intent intent = new Intent(v.getContext(), ServerTestActivity.class);
|
||||
startActivity(intent);
|
||||
}
|
||||
});
|
||||
|
||||
final Button but = (Button) findViewById(R.id.button);
|
||||
final Button but = (Button) findViewById(R.id.button_activate);
|
||||
if (serviceActivated) {
|
||||
but.setText(R.string.deactivate);
|
||||
} else {
|
||||
@ -82,6 +71,21 @@ public class MainActivity extends AppCompatActivity {
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
|
||||
final Button but = (Button) findViewById(R.id.button_activate);
|
||||
serviceActivated = isServiceActivated();
|
||||
if (serviceActivated) {
|
||||
but.setText(R.string.deactivate);
|
||||
} else {
|
||||
but.setText(R.string.activate);
|
||||
NotificationManager notificationManager = (NotificationManager) this.getSystemService(Context.NOTIFICATION_SERVICE);
|
||||
notificationManager.cancelAll();
|
||||
}
|
||||
}
|
||||
|
||||
private void initConfig() {
|
||||
PreferenceManager.setDefaultValues(this, R.xml.perf_settings, false);
|
||||
prefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
|
@ -0,0 +1,32 @@
|
||||
package org.itxtech.daedalus;
|
||||
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.Button;
|
||||
|
||||
public class ServerTestActivity extends AppCompatActivity {
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.activity_server_test);
|
||||
|
||||
final Button startTestBut = (Button) findViewById(R.id.button_start_test);
|
||||
startTestBut.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
Snackbar.make(v, R.string.start_test, Snackbar.LENGTH_LONG)
|
||||
.setAction("Action", null).show();
|
||||
startTestBut.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onRestart() {
|
||||
super.onRestart();
|
||||
}
|
||||
}
|
@ -18,7 +18,7 @@
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button"
|
||||
android:id="@+id/button_activate"
|
||||
android:layout_centerVertical="true" android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:text="@string/notice"
|
||||
|
@ -28,7 +28,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="bottom|end"
|
||||
android:layout_margin="@dimen/fab_margin"
|
||||
app:srcCompat="@android:drawable/ic_search_category_default"/>
|
||||
app:srcCompat="@mipmap/ic_verified_user_grey600_36dp"/>
|
||||
<include layout="@layout/content_main"/>
|
||||
|
||||
</android.support.design.widget.CoordinatorLayout>
|
||||
|
25
app/src/main/res/layout/activity_server_test.xml
Normal file
25
app/src/main/res/layout/activity_server_test.xml
Normal file
@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RelativeLayout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/activity_server_test"
|
||||
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.ServerTestActivity">
|
||||
|
||||
<Spinner
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/spinner" android:layout_alignParentTop="true"
|
||||
android:entries="@array/dns_server_options"/>
|
||||
<Button
|
||||
android:text="@string/action_start_test"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" android:layout_below="@+id/spinner"
|
||||
android:layout_alignParentStart="true" android:layout_marginTop="20dp" android:id="@+id/button_start_test"
|
||||
android:layout_alignParentEnd="true"/>
|
||||
</RelativeLayout>
|
@ -18,7 +18,7 @@
|
||||
android:textSize="15sp"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/button"
|
||||
android:id="@+id/button_activate"
|
||||
android:layout_centerVertical="true" android:layout_centerHorizontal="true"/>
|
||||
<TextView
|
||||
android:text="@string/notice"
|
||||
@ -26,7 +26,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/textView"
|
||||
android:textAppearance="@android:style/TextAppearance.Material" android:fontFamily="sans-serif"
|
||||
android:layout_above="@+id/button"
|
||||
android:layout_above="@+id/button_activate"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:layout_marginBottom="50dp"/>
|
||||
<ImageView
|
||||
@ -35,7 +35,6 @@
|
||||
android:layout_height="wrap_content" app:srcCompat="@mipmap/ic_launcher"
|
||||
android:id="@+id/imageView"
|
||||
android:clickable="false"
|
||||
android:layout_marginTop="30dp"
|
||||
android:minHeight="120dp" android:minWidth="150dp" android:layout_alignParentTop="true"
|
||||
android:layout_centerHorizontal="true"/>
|
||||
android:minHeight="120dp" android:minWidth="150dp"
|
||||
android:layout_alignParentTop="true" android:layout_centerHorizontal="true"/>
|
||||
</RelativeLayout>
|
||||
|
BIN
app/src/main/res/mipmap-hdpi/ic_verified_user_grey600_36dp.png
Normal file
BIN
app/src/main/res/mipmap-hdpi/ic_verified_user_grey600_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 668 B |
BIN
app/src/main/res/mipmap-mdpi/ic_verified_user_grey600_36dp.png
Normal file
BIN
app/src/main/res/mipmap-mdpi/ic_verified_user_grey600_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 513 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_verified_user_grey600_36dp.png
Normal file
BIN
app/src/main/res/mipmap-xhdpi/ic_verified_user_grey600_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 810 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_verified_user_grey600_36dp.png
Normal file
BIN
app/src/main/res/mipmap-xxhdpi/ic_verified_user_grey600_36dp.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 1.1 KiB |
Binary file not shown.
After Width: | Height: | Size: 1.7 KiB |
@ -10,11 +10,11 @@
|
||||
<string name="settings_system">系统设置</string>
|
||||
<string name="settings_boot">开机自动启动</string>
|
||||
<string name="about">作者:iTX Technologies\n网站:https://itxtech.org\n\nDaedalus 是一个运行在 Android 上的 DNS 代理程序。\n它基于
|
||||
CuteDNS(http://www.cutedns.cn) 的 DNS 服务器。\n\n你可以通过此程序直连:Google, Google Play, Twitter, Facebook, Gmail, Youtube,
|
||||
CuteDNS(http://www.cutedns.cn) 的 DNS 服务器。\n\n你可以通过此程序通过 https 协议直连:Google, Google Play, Twitter, Facebook, Gmail, Youtube,
|
||||
Google Drive, Tumblr, Mega, Dropbox, Apkpure, ccFox.info, ProjectH, Battle.NET, WordPress, Microsoft Live,
|
||||
Github, Amazon, Archive, Box.com, Disqus, SoundCloud, inoreader, Feedly, FlipBoard, Flickr, imgur, Instagram,
|
||||
DuckDuckGo, Ixquick, Yahoo, Google Services, Google apis, Android, UpLoad, Appspot, Googl eusercontent, Gstatic,
|
||||
Google other, Google research, Wikipedia, xda-developer and so on via https.\n\n此外,你还可以在中国大陆访问 Google Play 应用程序。
|
||||
Google other, Google research, Wikipedia, xda-developer 等。\n\n此外,你还可以在中国大陆访问 Google Play 应用程序。
|
||||
</string>
|
||||
<string name="settings_server">服务器设置</string>
|
||||
<string name="primary_server">首选 DNS 服务器</string>
|
||||
@ -22,5 +22,7 @@
|
||||
<string name="server_east_china">华东</string>
|
||||
<string name="server_north_china">华北</string>
|
||||
<string name="secondary_server">备用 DNS 服务器</string>
|
||||
<string name="fab_text">正在前往 CuteDNS 网站。</string>
|
||||
<string name="start_test">正在开始测试 DNS 服务器</string>
|
||||
<string name="action_server_test">测试服务器</string>
|
||||
<string name="action_start_test">开始测试</string>
|
||||
</resources>
|
@ -23,5 +23,7 @@
|
||||
<string name="server_east_china">East China</string>
|
||||
<string name="server_north_china">North China</string>
|
||||
<string name="secondary_server">Secondary DNS server</string>
|
||||
<string name="fab_text">Loading CuteDNS website...</string>
|
||||
<string name="start_test">Starting to test DNS server</string>
|
||||
<string name="action_server_test">Server test</string>
|
||||
<string name="action_start_test">Start test</string>
|
||||
</resources>
|
||||
|
Loading…
x
Reference in New Issue
Block a user