setup Tor at app start, and config immediately when pref is changed

This adds an Application subclass to get the onCreate() method, which is
called once at the first start up of the app, before any Activity starts.
Tor is configured there to ensure it is setup before anything happens.

This also moves the "Use Tor" pref listener to a more appropriate place.
This commit is contained in:
Hans-Christoph Steiner 2016-01-01 22:16:41 +01:00
parent 6bd2468d44
commit d3879a0398
6 changed files with 54 additions and 29 deletions

View file

@ -41,7 +41,6 @@ public class Downloader {
* @param language the language (usually a 2-character code) to set as the preferred language
* @return the contents of the specified text file*/
public static String download(String siteUrl, String language) {
NetCipher.useTor();
String ret = "";
try {
URL url = new URL(siteUrl);
@ -86,7 +85,6 @@ public class Downloader {
* @return the contents of the specified text file*/
public static String download(String siteUrl) {
String ret = "";
NetCipher.useTor();
try {
URL url = new URL(siteUrl);