mirror of
https://github.com/M66B/NetGuard.git
synced 2025-03-11 14:44:54 +00:00
Direct StevenBlack's hosts file download
This commit is contained in:
parent
0fc9b51933
commit
785a425b8c
1 changed files with 6 additions and 1 deletions
|
@ -359,9 +359,14 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
|
||||||
public boolean onPreferenceClick(Preference preference) {
|
public boolean onPreferenceClick(Preference preference) {
|
||||||
final File tmp = new File(getFilesDir(), "hosts.tmp");
|
final File tmp = new File(getFilesDir(), "hosts.tmp");
|
||||||
final File hosts = new File(getFilesDir(), "hosts.txt");
|
final File hosts = new File(getFilesDir(), "hosts.txt");
|
||||||
|
|
||||||
EditTextPreference pref_hosts_url = (EditTextPreference) screen.findPreference("hosts_url");
|
EditTextPreference pref_hosts_url = (EditTextPreference) screen.findPreference("hosts_url");
|
||||||
|
String hosts_url = pref_hosts_url.getText();
|
||||||
|
if ("https://www.netguard.me/hosts".equals(hosts_url))
|
||||||
|
hosts_url = "https://raw.githubusercontent.com/StevenBlack/hosts/master/hosts";
|
||||||
|
|
||||||
try {
|
try {
|
||||||
new DownloadTask(ActivitySettings.this, new URL(pref_hosts_url.getText()), tmp, new DownloadTask.Listener() {
|
new DownloadTask(ActivitySettings.this, new URL(hosts_url), tmp, new DownloadTask.Listener() {
|
||||||
@Override
|
@Override
|
||||||
public void onCompleted() {
|
public void onCompleted() {
|
||||||
if (hosts.exists())
|
if (hosts.exists())
|
||||||
|
|
Loading…
Add table
Reference in a new issue