Logger uses perfs to log; make sure prefs is not null beforce log something (#32)

* update libs version

* Logger uses perfs to log; make sure prefs is not null beforce log something; format code;
This commit is contained in:
notly 2017-08-21 18:37:01 +08:00 committed by PeratX
parent ec3124066b
commit dd0bfbe36e
2 changed files with 14 additions and 11 deletions

View File

@ -49,12 +49,13 @@ dependencies {
compile 'com.android.support:percent:25.3.1'
compile 'com.android.support:cardview-v7:25.3.1'
compile 'org.pcap4j:pcap4j-core:1.7.0'
compile 'org.pcap4j:pcap4j-packetfactory-propertiesbased:1.7.0'
compile 'de.measite.minidns:minidns-core:0.2.1'
compile 'org.pcap4j:pcap4j-core:1.7.1'
compile 'org.pcap4j:pcap4j-packetfactory-propertiesbased:1.7.1'
compile 'de.measite.minidns:minidns-core:0.2.2'
compile 'com.google.code.gson:gson:2.8.1'
compile 'com.google.firebase:firebase-crash:10.2.6'
compile 'com.google.firebase:firebase-crash:11.0.4'
testCompile 'junit:junit:4.12'
}

View File

@ -12,11 +12,13 @@ import android.net.Uri;
import android.os.Build;
import android.preference.PreferenceManager;
import android.util.Log;
import com.google.firebase.crash.FirebaseCrash;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
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.Configurations;
@ -108,6 +110,13 @@ public class Daedalus extends Application {
mResolver = new Thread(new RulesResolver());
mResolver.start();
initData();
}
private void initData() {
PreferenceManager.setDefaultValues(this, R.xml.perf_settings, false);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (getExternalFilesDir(null) != null) {
rulesPath = getExternalFilesDir(null).getPath() + "/rules/";
configPath = getExternalFilesDir(null).getPath() + "/config.json";
@ -121,13 +130,6 @@ public class Daedalus extends Application {
}
}
initData();
}
private void initData() {
PreferenceManager.setDefaultValues(this, R.xml.perf_settings, false);
prefs = PreferenceManager.getDefaultSharedPreferences(this);
if (configPath != null) {
configurations = Configurations.load(new File(configPath));
} else {