|
|
@ -29,12 +29,14 @@ import org.json.JSONArray;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONException;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
import org.json.JSONObject;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
import java.io.BufferedOutputStream;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.File;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
import java.io.FileNotFoundException;
|
|
|
|
|
|
|
|
import java.io.FileOutputStream;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.IOException;
|
|
|
|
|
|
|
|
import java.io.OutputStream;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.net.URL;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.ArrayList;
|
|
|
|
import java.util.Date;
|
|
|
|
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.HashMap;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.Iterator;
|
|
|
|
import java.util.List;
|
|
|
|
import java.util.List;
|
|
|
@ -127,15 +129,13 @@ public class DisconnectBlacklist {
|
|
|
|
if (status != HttpsURLConnection.HTTP_OK)
|
|
|
|
if (status != HttpsURLConnection.HTTP_OK)
|
|
|
|
throw new FileNotFoundException("Error " + status + ": " + connection.getResponseMessage());
|
|
|
|
throw new FileNotFoundException("Error " + status + ": " + connection.getResponseMessage());
|
|
|
|
|
|
|
|
|
|
|
|
String response = Helper.readStream(connection.getInputStream());
|
|
|
|
try (OutputStream os = new BufferedOutputStream(new FileOutputStream(file))) {
|
|
|
|
Helper.writeText(file, response);
|
|
|
|
Helper.copy(connection.getInputStream(), os);
|
|
|
|
|
|
|
|
}
|
|
|
|
} finally {
|
|
|
|
} finally {
|
|
|
|
connection.disconnect();
|
|
|
|
connection.disconnect();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
|
|
|
|
|
|
|
prefs.edit().putLong("disconnect_last", new Date().getTime()).apply();
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
init(file);
|
|
|
|
init(file);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|