Commit 22eeddeb authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Use the dialog for refreshing the sources

parent 3015ac1b
......@@ -2,6 +2,7 @@ package com.frostnerd.smokescreen.dialog
import android.content.Context
import android.content.DialogInterface
import androidx.annotation.Keep
import androidx.appcompat.app.AlertDialog
import com.frostnerd.smokescreen.R
import com.frostnerd.smokescreen.getPreferences
......@@ -57,6 +58,7 @@ class HostSourceRefreshDialog(context:Context,
}
}
@Keep
enum class TimeUnit {
HOURS, DAYS, WEEKS
}
......
......@@ -23,6 +23,7 @@ import com.frostnerd.smokescreen.database.entities.HostSource
import com.frostnerd.smokescreen.database.getDatabase
import com.frostnerd.smokescreen.dialog.DnsRuleDialog
import com.frostnerd.smokescreen.dialog.ExportDnsRulesDialog
import com.frostnerd.smokescreen.dialog.HostSourceRefreshDialog
import com.frostnerd.smokescreen.dialog.NewHostSourceDialog
import com.frostnerd.smokescreen.service.RuleExportService
import com.frostnerd.smokescreen.service.RuleImportService
......@@ -118,13 +119,15 @@ class DnsRuleFragment : Fragment() {
}).show()
}
refresh.setOnClickListener {
if(context!!.isServiceRunning(RuleImportService::class.java)) {
context!!.startService(Intent(context!!, RuleImportService::class.java).putExtra("abort", true))
} else {
context!!.startService(Intent(context!!, RuleImportService::class.java))
refreshProgress.show()
refreshProgressShown = true
}
HostSourceRefreshDialog(context!!) {
if(context!!.isServiceRunning(RuleImportService::class.java)) {
context!!.startService(Intent(context!!, RuleImportService::class.java).putExtra("abort", true))
} else {
context!!.startService(Intent(context!!, RuleImportService::class.java))
refreshProgress.show()
refreshProgressShown = true
}
}.show()
}
export.setOnClickListener {
if (context!!.isServiceRunning(RuleExportService::class.java)) {
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment