Improved settings
@ -60,6 +60,7 @@
|
||||
</activity>
|
||||
<activity
|
||||
android:name=".activity.AboutActivity"
|
||||
android:process=":remote"
|
||||
android:launchMode="singleTask"
|
||||
android:label="@string/action_about">
|
||||
</activity>
|
||||
|
@ -85,6 +85,8 @@ public class AboutActivity extends AppCompatActivity {
|
||||
mWebView.destroy();
|
||||
mWebView = null;
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -3,6 +3,7 @@ package org.itxtech.daedalus.activity;
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.net.VpnService;
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.FloatingActionButton;
|
||||
@ -241,12 +242,18 @@ public class MainActivity extends AppCompatActivity implements NavigationView.On
|
||||
|
||||
if (id == R.id.action_settings) {
|
||||
startActivity(new Intent(this, SettingsActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id == R.id.action_about) {
|
||||
startActivity(new Intent(this, AboutActivity.class));
|
||||
return true;
|
||||
}
|
||||
|
||||
if (id == R.id.action_check_update) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus/releases")));
|
||||
}
|
||||
|
||||
if (id == R.id.action_bug_report) {
|
||||
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse("https://github.com/iTXTech/Daedalus/issues")));
|
||||
}
|
||||
|
||||
DrawerLayout drawer = (DrawerLayout) findViewById(R.id.main_drawer_layout);
|
||||
|
@ -4,10 +4,7 @@ import android.content.Intent;
|
||||
import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.preference.ListPreference;
|
||||
import android.preference.Preference;
|
||||
import android.preference.PreferenceFragment;
|
||||
import android.preference.SwitchPreference;
|
||||
import android.preference.*;
|
||||
import android.support.design.widget.Snackbar;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@ -36,10 +33,36 @@ public class SettingsFragment extends PreferenceFragment {
|
||||
ListPreference primaryServer = (ListPreference) findPreference("primary_server");
|
||||
primaryServer.setEntries(DnsServer.getDnsServerNames(Daedalus.getInstance()));
|
||||
primaryServer.setEntryValues(DnsServer.getDnsServerIds());
|
||||
primaryServer.setSummary(DnsServer.getDnsServerById(primaryServer.getValue()).getStringDescription(Daedalus.getInstance()));
|
||||
primaryServer.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
preference.setSummary(DnsServer.getDnsServerById((String) newValue).getStringDescription(Daedalus.getInstance()));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
ListPreference secondaryServer = (ListPreference) findPreference("secondary_server");
|
||||
secondaryServer.setEntries(DnsServer.getDnsServerNames(Daedalus.getInstance()));
|
||||
secondaryServer.setEntryValues(DnsServer.getDnsServerIds());
|
||||
secondaryServer.setSummary(DnsServer.getDnsServerById(primaryServer.getValue()).getStringDescription(Daedalus.getInstance()));
|
||||
secondaryServer.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
preference.setSummary(DnsServer.getDnsServerById((String) newValue).getStringDescription(Daedalus.getInstance()));
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
EditTextPreference testDNSServers = (EditTextPreference) findPreference("dns_test_servers");
|
||||
testDNSServers.setSummary(testDNSServers.getText());
|
||||
testDNSServers.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
|
||||
@Override
|
||||
public boolean onPreferenceChange(Preference preference, Object newValue) {
|
||||
preference.setSummary((String) newValue);
|
||||
return true;
|
||||
}
|
||||
});
|
||||
|
||||
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.LOLLIPOP) {
|
||||
SwitchPreference countQueryTimes = (SwitchPreference) findPreference("settings_count_query_times");
|
||||
|
@ -77,4 +77,14 @@ public class DnsServer {
|
||||
String[] stringServers = new String[Daedalus.DNS_SERVERS.size()];
|
||||
return servers.toArray(stringServers);
|
||||
}
|
||||
|
||||
public static DnsServer getDnsServerById(String id) {
|
||||
for (DnsServer server : Daedalus.DNS_SERVERS) {
|
||||
if (server.getId().equals(id)) {
|
||||
return server;
|
||||
}
|
||||
}
|
||||
return Daedalus.DNS_SERVERS.get(0);
|
||||
|
||||
}
|
||||
}
|
||||
|
@ -17,4 +17,13 @@
|
||||
android:title="@string/action_about"
|
||||
android:icon="@mipmap/ic_info_grey600_36dp"/>
|
||||
</group>
|
||||
|
||||
<group android:id="@+id/nav_group_help_and_support">
|
||||
<item android:id="@+id/action_check_update"
|
||||
android:title="@string/settings_check_update"
|
||||
android:icon="@mipmap/ic_file_upload_grey600_36dp"/>
|
||||
<item android:id="@+id/action_bug_report"
|
||||
android:title="@string/settings_bug_report"
|
||||
android:icon="@mipmap/ic_bug_report_grey600_36dp"/>
|
||||
</group>
|
||||
</menu>
|
||||
|
BIN
app/src/main/res/mipmap-hdpi/ic_bug_report_grey600_36dp.png
Normal file
After Width: | Height: | Size: 515 B |
BIN
app/src/main/res/mipmap-hdpi/ic_file_upload_grey600_36dp.png
Normal file
After Width: | Height: | Size: 340 B |
BIN
app/src/main/res/mipmap-mdpi/ic_bug_report_grey600_36dp.png
Normal file
After Width: | Height: | Size: 360 B |
BIN
app/src/main/res/mipmap-mdpi/ic_file_upload_grey600_36dp.png
Normal file
After Width: | Height: | Size: 262 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_bug_report_grey600_36dp.png
Normal file
After Width: | Height: | Size: 681 B |
BIN
app/src/main/res/mipmap-xhdpi/ic_file_upload_grey600_36dp.png
Normal file
After Width: | Height: | Size: 339 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_bug_report_grey600_36dp.png
Normal file
After Width: | Height: | Size: 900 B |
BIN
app/src/main/res/mipmap-xxhdpi/ic_file_upload_grey600_36dp.png
Normal file
After Width: | Height: | Size: 425 B |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_bug_report_grey600_36dp.png
Normal file
After Width: | Height: | Size: 1.1 KiB |
BIN
app/src/main/res/mipmap-xxxhdpi/ic_file_upload_grey600_36dp.png
Normal file
After Width: | Height: | Size: 578 B |
@ -35,12 +35,13 @@
|
||||
<string name="settings_count_number_of_queries">统计 DNS 查询次数</string>
|
||||
<string name="notification_queries">DNS 查询次数:</string>
|
||||
<string name="notice_legacy_api">当前 Android API 无法支持所有功能。</string>
|
||||
<string name="settings_issue_tracker">提交反馈</string>
|
||||
<string name="settings_issue_summary">前往 GitHub 提交问题反馈。</string>
|
||||
<string name="settings_bug_report">提交一个 Bug</string>
|
||||
<string name="settings_issue_summary">前往 GitHub 提交 Bug 反馈。</string>
|
||||
<string name="settings_dns_test_servers">DNS 测试服务器</string>
|
||||
<string name="navigation_drawer_close">关闭导航栏</string>
|
||||
<string name="navigation_drawer_open">开启导航栏</string>
|
||||
<string name="action_home">主页</string>
|
||||
<string name="nav_version">版本:</string>
|
||||
<string name="nav_git_commit">Git commit:</string>
|
||||
<string name="settings_help_and_support">支持和帮助</string>
|
||||
</resources>
|
@ -35,7 +35,7 @@
|
||||
<string name="settings_count_number_of_queries">Count DNS query times</string>
|
||||
<string name="notification_queries">DNS query times:</string>
|
||||
<string name="notice_legacy_api">The current Android API can not support all the features.</string>
|
||||
<string name="settings_issue_tracker">Issue tracker</string>
|
||||
<string name="settings_bug_report">Report a bug</string>
|
||||
<string name="settings_issue_summary">Submit an issue in GitHub Issues page.</string>
|
||||
<string name="settings_dns_test_servers">DNS test servers</string>
|
||||
<string name="navigation_drawer_open">Open navigation drawer</string>
|
||||
@ -43,4 +43,5 @@
|
||||
<string name="action_home">Home</string>
|
||||
<string name="nav_version">Version:</string>
|
||||
<string name="nav_git_commit">Git commit:</string>
|
||||
<string name="settings_help_and_support">Help & Support</string>
|
||||
</resources>
|
||||
|
@ -39,13 +39,18 @@
|
||||
android:key="settings_notification"
|
||||
android:title="@string/settings_notification"
|
||||
android:defaultValue="true"/>
|
||||
</PreferenceCategory>
|
||||
|
||||
<PreferenceCategory
|
||||
android:key="settings_help"
|
||||
android:title="@string/settings_help_and_support">
|
||||
<org.itxtech.daedalus.view.ClickPreference
|
||||
android:key="settings_check_update"
|
||||
android:title="@string/settings_check_update"
|
||||
android:summary="@string/settings_update_summary"/>
|
||||
<org.itxtech.daedalus.view.ClickPreference
|
||||
android:key="settings_issue_tracker"
|
||||
android:title="@string/settings_issue_tracker"
|
||||
android:title="@string/settings_bug_report"
|
||||
android:summary="@string/settings_issue_summary"/>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|