Direct StevenBlack's hosts file download

This commit is contained in:
M66B 2020-08-16 21:35:36 +02:00
parent 0fc9b51933
commit 785a425b8c
1 changed files with 6 additions and 1 deletions

View File

@ -359,9 +359,14 @@ public class ActivitySettings extends AppCompatActivity implements SharedPrefere
public boolean onPreferenceClick(Preference preference) {
final File tmp = new File(getFilesDir(), "hosts.tmp");
final File hosts = new File(getFilesDir(), "hosts.txt");
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 {
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
public void onCompleted() {
if (hosts.exists())