Added import for rules

This commit is contained in:
PeratX 2017-05-19 23:15:52 +08:00
parent 0830b34edb
commit 3ab62768fe
16 changed files with 312 additions and 190 deletions

View File

@ -21,7 +21,10 @@ import com.google.gson.JsonParseException;
import com.google.gson.stream.JsonReader;
import org.itxtech.daedalus.activity.MainActivity;
import org.itxtech.daedalus.service.DaedalusVpnService;
import org.itxtech.daedalus.util.*;
import org.itxtech.daedalus.util.Configurations;
import org.itxtech.daedalus.util.DnsServer;
import org.itxtech.daedalus.util.Rule;
import org.itxtech.daedalus.util.RulesResolver;
import java.io.File;
import java.util.ArrayList;
@ -54,15 +57,20 @@ public class Daedalus extends Application {
add(new DnsServer("123.206.21.48", R.string.server_aixyz_south_china));
}};
public static final List<RulesProvider> HOSTS_PROVIDERS = new ArrayList<RulesProvider>() {{
add(new RulesProvider("racaljk/hosts", "https://coding.net/u/scaffrey/p/hosts/git/raw/master/hosts"));
add(new RulesProvider("fengixng/google-hosts", "https://raw.githubusercontent.com/fengixng/google-hosts/master/hosts"));
add(new RulesProvider("sy618/hosts", "https://raw.githubusercontent.com/sy618/hosts/master/ADFQ"));
}};
public static final List<Rule> RULES = new ArrayList<Rule>() {{
//Build-in Hosts rule providers
add(new Rule("racaljk/hosts", "racaljk.hosts", Rule.TYPE_HOSTS,
"https://coding.net/u/scaffrey/p/hosts/git/raw/master/hosts", false));
add(new Rule("fengixng/google-hosts", "fengixng.hosts", Rule.TYPE_HOSTS,
"https://raw.githubusercontent.com/fengixng/google-hosts/master/hosts", false));
add(new Rule("sy618/hosts", "sy618.hosts", Rule.TYPE_HOSTS,
"https://raw.githubusercontent.com/sy618/hosts/master/ADFQ", false));
//Build-in DNSMasq rule providers
add(new Rule("sy618/hosts/dnsad", "dnsad.dnsmasq", Rule.TYPE_DNAMASQ,
"https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsad", false));
add(new Rule("sy618/hosts/dnsfq", "dnsfq.dnsmasq", Rule.TYPE_DNAMASQ,
"https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq", false));
public static final List<RulesProvider> DNSMASQ_PROVIDERS = new ArrayList<RulesProvider>() {{
add(new RulesProvider("sy618/hosts/dnsad", "https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsad", "dnsad"));
add(new RulesProvider("sy618/hosts/dnsfq", "https://raw.githubusercontent.com/sy618/hosts/master/dnsmasq/dnsfq", "dnsfq"));
}};
public static final String[] DEFAULT_TEST_DOMAINS = new String[]{

View File

@ -40,7 +40,7 @@ public class RuleConfigFragment extends ConfigFragment {
private Thread mThread = null;
private RuleConfigHandler mHandler = null;
private View view;
private int index;
private int id;
public void setIntent(Intent intent) {
this.intent = intent;
@ -77,7 +77,7 @@ public class RuleConfigFragment extends ConfigFragment {
mHandler = new RuleConfigHandler().setView(view);
EditTextPreference ruleName = (EditTextPreference) findPreference("ruleName");
final EditTextPreference ruleName = (EditTextPreference) findPreference("ruleName");
ruleName.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
@ -86,7 +86,7 @@ public class RuleConfigFragment extends ConfigFragment {
}
});
ListPreference ruleType = (ListPreference) findPreference("ruleType");
final ListPreference ruleType = (ListPreference) findPreference("ruleType");
final String[] entries = {"hosts", "DNSMasq"};
String[] values = {"0", "1"};
ruleType.setEntries(entries);
@ -158,9 +158,31 @@ public class RuleConfigFragment extends ConfigFragment {
}
});
index = intent.getIntExtra(ConfigActivity.LAUNCH_ACTION_ID, ConfigActivity.ID_NONE);
if (index != ConfigActivity.ID_NONE) {
Rule rule = Daedalus.configurations.getRules().get(index);
ListPreference ruleImportBuildIn = (ListPreference) findPreference("ruleImportBuildIn");
ruleImportBuildIn.setEntries(Rule.getBuildInRuleNames());
ruleImportBuildIn.setEntryValues(Rule.getBuildInRuleEntries());
ruleImportBuildIn.setOnPreferenceChangeListener(new Preference.OnPreferenceChangeListener() {
@Override
public boolean onPreferenceChange(Preference preference, Object newValue) {
Rule rule = Daedalus.RULES.get(Integer.parseInt((String) newValue));
ruleName.setText(rule.getName());
ruleName.setSummary(rule.getName());
ruleType.setValue(String.valueOf(rule.getType()));
ruleType.setSummary(Rule.getTypeById(rule.getType()));
ruleFilename.setText(rule.getFileName());
ruleFilename.setSummary(rule.getFileName());
ruleDownloadUrl.setText(rule.getDownloadUrl());
ruleDownloadUrl.setSummary(rule.getDownloadUrl());
return true;
}
});
ruleImportBuildIn.setValue("0");
id = intent.getIntExtra(ConfigActivity.LAUNCH_ACTION_ID, ConfigActivity.ID_NONE);
Rule rule;
if (id != ConfigActivity.ID_NONE && (rule = Rule.getRuleById(String.valueOf(id))) != null) {
Rule.getRuleById(String.valueOf(id));
ruleName.setText(rule.getName());
ruleName.setSummary(rule.getName());
int type = rule.getType();
@ -180,6 +202,7 @@ public class RuleConfigFragment extends ConfigFragment {
ruleDownloadUrl.setText("");
ruleDownloadUrl.setSummary("");
}
return view;
}
@ -195,14 +218,18 @@ public class RuleConfigFragment extends ConfigFragment {
return;
}
if (index == ConfigActivity.ID_NONE) {
Daedalus.configurations.getRules().add(new Rule(ruleName, ruleFilename, Integer.parseInt(ruleType), ruleDownloadUrl));
if (id == ConfigActivity.ID_NONE) {
Rule rule = new Rule(ruleName, ruleFilename, Integer.parseInt(ruleType), ruleDownloadUrl);
Daedalus.configurations.getRules().add(rule);
id = Integer.parseInt(rule.getId());
} else {
Rule rule = Daedalus.configurations.getRules().get(index);
rule.setName(ruleName);
rule.setType(Integer.parseInt(ruleType));
rule.setFileName(ruleFilename);
rule.setDownloadUrl(ruleDownloadUrl);
Rule rule = Rule.getRuleById(String.valueOf(id));
if (rule != null) {
rule.setName(ruleName);
rule.setType(Integer.parseInt(ruleType));
rule.setFileName(ruleFilename);
rule.setDownloadUrl(ruleDownloadUrl);
}
}
}
@ -216,13 +243,13 @@ public class RuleConfigFragment extends ConfigFragment {
getActivity().finish();
break;
case R.id.action_delete:
if (index != ConfigActivity.ID_NONE) {
if (this.id != ConfigActivity.ID_NONE) {
new AlertDialog.Builder(getActivity())
.setTitle(R.string.notice_delete_confirm_prompt)
.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Daedalus.configurations.getRules().remove(index);
Daedalus.configurations.getRules().remove(RuleConfigFragment.this.id);
getActivity().finish();
}
})

View File

@ -50,7 +50,8 @@ public class RulesFragment extends Fragment {
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
if (viewHolder instanceof RulesFragment.ViewHolder) {
if (Daedalus.configurations.getRules().get(((ViewHolder) viewHolder).getIndex()).isUsing()) {
Rule rule = Rule.getRuleById(((ViewHolder) viewHolder).getId());
if (rule != null && rule.isServiceAndUsing()) {
return 0;
}
}
@ -121,7 +122,7 @@ public class RulesFragment extends Fragment {
@Override
public void onBindViewHolder(ViewHolder holder, int position) {
Rule rule = Daedalus.configurations.getRules().get(position);
holder.setIndex(position);
holder.setId(rule.getId());
holder.textViewName.setText(rule.getName());
holder.textViewAddress.setText(rule.getFileName());
@ -145,14 +146,23 @@ public class RulesFragment extends Fragment {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.card_rule, parent, false);
return new ViewHolder(view);
}
void checkType(Rule rule) {
for (Rule check : Daedalus.configurations.getRules()) {
if (check.getType() != rule.getType()) {
check.setUsing(false);
}
}
notifyDataSetChanged();
}
}
private static class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private class ViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener, View.OnLongClickListener {
private final TextView textViewName;
private final TextView textViewAddress;
private final TextView textViewSize;
private final View view;
private int index;
private String id;
ViewHolder(View view) {
super(view);
@ -162,29 +172,37 @@ public class RulesFragment extends Fragment {
textViewSize = (TextView) view.findViewById(R.id.textView_rule_size);
view.setOnClickListener(this);
view.setOnLongClickListener(this);
view.setBackgroundResource(R.drawable.background_selectable);
view.findViewById(R.id.cardView_indicator).setBackgroundResource(R.drawable.background_selectable);
}
void setIndex(int index) {
this.index = index;
view.setSelected(Daedalus.configurations.getRules().get(index).isUsing());
void setId(String id) {
this.id = id;
Rule rule = Rule.getRuleById(id);
if (rule != null) {
view.setSelected(rule.isUsing());
}
}
int getIndex() {
return index;
String getId() {
return id;
}
@Override
public void onClick(View v) {
Daedalus.configurations.getRules().get(index).setUsing(!v.isSelected());
v.setSelected(!v.isSelected());
Rule rule = Rule.getRuleById(id);
if (rule != null) {
rule.setUsing(!v.isSelected());
v.setSelected(!v.isSelected());
adapter.checkType(rule);
}
}
@Override
public boolean onLongClick(View v) {
if (!Daedalus.configurations.getRules().get(index).isUsing()) {
Rule rule = Rule.getRuleById(id);
if (rule != null && rule.isServiceAndUsing()) {
Daedalus.getInstance().startActivity(new Intent(Daedalus.getInstance(), ConfigActivity.class)
.putExtra(ConfigActivity.LAUNCH_ACTION_ID, index)
.putExtra(ConfigActivity.LAUNCH_ACTION_ID, Integer.parseInt(id))
.putExtra(ConfigActivity.LAUNCH_ACTION_FRAGMENT, ConfigActivity.LAUNCH_FRAGMENT_RULE)
.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK));
}

View File

@ -22,7 +22,7 @@ import java.util.ArrayList;
* (at your option) any later version.
*/
public class Configurations {
private static final int CUSTOM_DNS_ID_START = 32;
private static final int CUSTOM_ID_START = 32;
private static File file;
@ -30,15 +30,23 @@ public class Configurations {
private ArrayList<Rule> rules;
private int totalId;
private int totalDnsId;
private int totalRuleId;
private long activateCounter;
int getNextId() {
if (totalId < CUSTOM_DNS_ID_START) {
totalId = CUSTOM_DNS_ID_START;
int getNextDnsId() {
if (totalDnsId < CUSTOM_ID_START) {
totalDnsId = CUSTOM_ID_START;
}
return totalId++;
return totalDnsId++;
}
int getNextRuleId() {
if (totalRuleId < 0) {
totalRuleId = 0;
}
return totalRuleId++;
}
public long getActivateCounter() {

View File

@ -23,7 +23,7 @@ public class CustomDnsServer {
this.name = name;
this.address = address;
this.port = port;
this.id = String.valueOf(Daedalus.configurations.getNextId());
this.id = String.valueOf(Daedalus.configurations.getNextDnsId());
}
public String getId() {

View File

@ -1,5 +1,9 @@
package org.itxtech.daedalus.util;
import org.itxtech.daedalus.Daedalus;
import java.util.ArrayList;
/**
* Daedalus Project
*
@ -20,13 +24,29 @@ public class Rule {
private int type;
private String downloadUrl;
private boolean using;
private String id;
public Rule(String name, String fileName, int type, String downloadUrl) {
public Rule(String name, String fileName, int type, String downloadUrl, boolean withId) {
this.name = name;
this.fileName = fileName;
this.type = type;
this.downloadUrl = downloadUrl;
this.using = false;
if (withId) {
this.id = String.valueOf(Daedalus.configurations.getNextRuleId());
}
}
public Rule(String name, String fileName, int type, String downloadUrl) {
this(name, fileName, type, downloadUrl, true);
}
public void setId(String id) {
this.id = id;
}
public String getId() {
return id;
}
public void setUsing(boolean using) {
@ -68,4 +88,48 @@ public class Rule {
public void setDownloadUrl(String downloadUrl) {
this.downloadUrl = downloadUrl;
}
public boolean isServiceAndUsing() {
return Daedalus.getInstance().isServiceActivated() && isUsing();
}
//STATIC METHODS
public static String[] getBuildInRuleNames() {
ArrayList<String> names = new ArrayList<>(Daedalus.RULES.size());
for (Rule rule : Daedalus.RULES) {
names.add(rule.getName() + " - " + getTypeById(rule.getType()));
}
String[] strings = new String[names.size()];
return names.toArray(strings);
}
public static String[] getBuildInRuleEntries() {
ArrayList<String> entries = new ArrayList<>(Daedalus.RULES.size());
for (int i = 0; i < Daedalus.RULES.size(); i++) {
entries.add(String.valueOf(i));
}
String[] strings = new String[entries.size()];
return entries.toArray(strings);
}
public static Rule getRuleById(String id) {
for (Rule rule : Daedalus.configurations.getRules()) {
if (rule.getId().equals(id)) {
return rule;
}
}
return null;
}
public static String getTypeById(int id) {
switch (id) {
case TYPE_HOSTS:
return "Hosts";
case TYPE_DNAMASQ:
return "DNSMasq";
default:
return "Unknown";
}
}
}

View File

@ -1,91 +0,0 @@
package org.itxtech.daedalus.util;
import org.itxtech.daedalus.Daedalus;
import java.util.ArrayList;
/**
* Daedalus Project
*
* @author iTX Technologies
* @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, either version 3 of the License, or
* (at your option) any later version.
*/
public class RulesProvider {
private String name;
private String downloadURL;
private String fileName;
private String data;
public RulesProvider(String name, String downloadURL) {
this(name, downloadURL, "Unknown");
}
public RulesProvider(String name, String downloadURL, String fileName) {
this.name = name;
this.downloadURL = downloadURL;
this.fileName = fileName;
}
public String getName() {
return name;
}
public String getDownloadURL() {
return downloadURL;
}
public String getFileName() {
return fileName;
}
public void setData(String data) {
this.data = data;
}
public String getData() {
String temp = data;
data = null;
return temp;
}
public static String[] getHostsProviderNames() {
ArrayList<String> servers = new ArrayList<>(Daedalus.HOSTS_PROVIDERS.size());
for (RulesProvider provider : Daedalus.HOSTS_PROVIDERS) {
servers.add(provider.getName());
}
String[] stringServers = new String[Daedalus.HOSTS_PROVIDERS.size()];
return servers.toArray(stringServers);
}
public static String[] getDnsmasqProviderNames() {
ArrayList<String> servers = new ArrayList<>(Daedalus.DNSMASQ_PROVIDERS.size());
for (RulesProvider provider : Daedalus.DNSMASQ_PROVIDERS) {
servers.add(provider.getName());
}
String[] stringServers = new String[Daedalus.DNSMASQ_PROVIDERS.size()];
return servers.toArray(stringServers);
}
public static String getDownloadUrlByName(String name) {
for (RulesProvider provider : Daedalus.HOSTS_PROVIDERS) {
if (provider.getName().equals(name)) {
return provider.getDownloadURL();
}
}
return null;
}
public static RulesProvider getProviderByName(String name) {
for (RulesProvider provider : Daedalus.DNSMASQ_PROVIDERS) {
if (provider.getName().equals(name)) {
return provider;
}
}
return null;
}
}

View File

@ -138,7 +138,7 @@ public class RulesResolver implements Runnable {
data[1] = data[1].substring(1, data[1].length());
}
rules.put(data[1], data[2]);
Log.d(TAG, "Putting " + data[1] + " " + data[2]);
//Log.d(TAG, "Putting " + data[1] + " " + data[2]);
}
}
}

View File

@ -0,0 +1,54 @@
package org.itxtech.daedalus.widget;
import android.content.Context;
import android.content.res.TypedArray;
import android.support.v7.widget.CardView;
import android.util.AttributeSet;
import org.itxtech.daedalus.R;
/**
* Daedalus Project
*
* @author iTX Technologies & MrFuFuFu
* @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, either version 3 of the License, or
* (at your option) any later version.
*/
public class BoundedCardView extends CardView {
public BoundedCardView(Context context) {
super(context);
}
public BoundedCardView(Context context, AttributeSet attrs) {
super(context, attrs);
initAttrs(context, attrs);
}
public BoundedCardView(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
}
private int boundedWidth;
private int boundedHeight;
private void initAttrs(Context context, AttributeSet attrs) {
TypedArray arr = context.obtainStyledAttributes(attrs, R.styleable.BoundedView);
boundedWidth = arr.getDimensionPixelSize(R.styleable.BoundedView_bounded_width, 0);
boundedHeight = arr.getDimensionPixelSize(R.styleable.BoundedView_bounded_height, 0);
arr.recycle();
}
@Override
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
if (boundedWidth > 0 && boundedWidth < MeasureSpec.getSize(widthMeasureSpec)) {
MeasureSpec.makeMeasureSpec(boundedWidth, MeasureSpec.getMode(widthMeasureSpec));
}
if (boundedHeight > 0 && boundedHeight < MeasureSpec.getSize(heightMeasureSpec)) {
MeasureSpec.makeMeasureSpec(boundedHeight, MeasureSpec.getMode(heightMeasureSpec));
}
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
}
}

View File

@ -3,6 +3,9 @@
android:enterFadeDuration="@android:integer/config_mediumAnimTime"
android:exitFadeDuration="@android:integer/config_mediumAnimTime">
<item android:state_selected="true">
<color android:color="@color/colorPrimaryDark"/>
<color android:color="#ddff00"/>
</item>
<item android:state_selected="false">
<color android:color="@android:color/white"/>
</item>
</selector>

View File

@ -1,53 +1,64 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:clickable="true"
android:foreground="?attr/selectableItemBackgroundBorderless"
android:focusable="true"
app:cardBackgroundColor="@android:color/white"
app:cardCornerRadius="10dp"
app:cardPreventCornerOverlap="true"
app:cardUseCompatPadding="true">
<RelativeLayout
android:layout_width="match_parent"
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<android.support.v7.widget.CardView
android:layout_height="wrap_content"
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin">
android:layout_width="match_parent"
android:layout_gravity="center_horizontal"
android:layout_marginTop="@dimen/margin_small"
android:layout_marginStart="@dimen/margin_small"
android:layout_marginEnd="@dimen/margin_small"
app:cardCornerRadius="10dp"
app:cardPreventCornerOverlap="true"
android:id="@+id/cardView_indicator">
<TextView
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/margin_small"
android:paddingBottom="@dimen/margin_small"
android:id="@+id/textView_rule_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView_rule_name"
android:paddingTop="@dimen/margin_small"
android:paddingBottom="@dimen/margin_small"
android:id="@+id/textView_rule_detail"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView android:id="@+id/textView_rule_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingBottom="@dimen/margin_small"
android:paddingRight="@dimen/margin_small"
android:paddingEnd="@dimen/margin_small"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</RelativeLayout>
</android.support.v7.widget.CardView>
android:focusable="true"
android:orientation="vertical"
android:padding="@dimen/margin_small"
android:background="?android:attr/selectableItemBackground">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/margin_small">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/margin_small"
android:paddingBottom="@dimen/margin_small"
android:id="@+id/textView_rule_name"
android:textAppearance="?android:attr/textAppearanceLarge"
android:layout_alignParentTop="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/textView_rule_name"
android:paddingTop="@dimen/margin_small"
android:paddingBottom="@dimen/margin_small"
android:id="@+id/textView_rule_detail"
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_alignParentBottom="true"
android:layout_alignParentLeft="true"
android:layout_alignParentStart="true"/>
<TextView android:id="@+id/textView_rule_size"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:paddingBottom="@dimen/margin_small"
android:paddingRight="@dimen/margin_small"
android:paddingEnd="@dimen/margin_small"
android:layout_alignParentEnd="true"
android:layout_alignParentRight="true"
android:ellipsize="end"
android:textAppearance="?android:attr/textAppearanceSmall"/>
</RelativeLayout>
</LinearLayout>
</android.support.v7.widget.CardView>
</FrameLayout>

View File

@ -77,5 +77,7 @@
<string name="settings_rule">规则设置</string>
<string name="settings_rule_download_url">规则下载地址</string>
<string name="settings_rule_sync">同步规则</string>
<string name="settings_rule_filename" translatable="false">规则文件名</string>
<string name="settings_rule_filename">规则文件名</string>
<string name="settings_rule_import">导入</string>
<string name="settings_rule_import_build_in">从内置规则导入</string>
</resources>

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<declare-styleable name="BoundedView">
<attr name="bounded_width" format="dimension"/>
<attr name="bounded_height" format="dimension"/>
</declare-styleable>
</resources>

View File

@ -8,4 +8,6 @@
<!-- Default screen margins, per the Android Design guidelines. -->
<dimen name="nav_header_vertical_spacing">16dp</dimen>
<dimen name="nav_header_height">180dp</dimen>
<dimen name="config_item_max_width">480dp</dimen>
</resources>

View File

@ -77,5 +77,7 @@
<string name="settings_rule">Rule Settings</string>
<string name="settings_rule_download_url">Rule Download Url</string>
<string name="settings_rule_sync">Sync Rule</string>
<string name="settings_rule_filename">Rule File Name</string>
<string name="settings_rule_filename">Rule Filename</string>
<string name="settings_rule_import">Import</string>
<string name="settings_rule_import_build_in">Import from build in rules</string>
</resources>

View File

@ -6,7 +6,7 @@
android:singleLine="true"
android:title="@string/settings_rule_name"/>
<PreferenceCategory
android:key="Rule Settings"
android:key="rulSettings"
android:title="@string/settings_rule">
<ListPreference
android:key="ruleType"
@ -27,4 +27,11 @@
android:key="ruleSync"
android:title="@string/settings_rule_sync"/>
</PreferenceCategory>
<PreferenceCategory
android:key="Import"
android:title="@string/settings_rule_import">
<ListPreference
android:key="ruleImportBuildIn"
android:title="@string/settings_rule_import_build_in"/>
</PreferenceCategory>
</PreferenceScreen>