Commit fa1f309b authored by Daniel Wolf's avatar Daniel Wolf
Browse files

Added minute as time unit

parent 03df59d1
...@@ -48,10 +48,6 @@ class HostSourceRefreshDialog(context:Context, ...@@ -48,10 +48,6 @@ class HostSourceRefreshDialog(context:Context,
view.automaticRefresh.setOnCheckedChangeListener { _, isChecked -> view.automaticRefresh.setOnCheckedChangeListener { _, isChecked ->
changeAutomaticRefreshStatus(isChecked) changeAutomaticRefreshStatus(isChecked)
} }
view.automaticRefresh.isChecked = context.getPreferences().automaticHostRefresh
view.refreshWifiOnly.isChecked = context.getPreferences().automaticHostRefreshWifiOnly
view.timeAmount.setText(context.getPreferences().automaticHostRefreshTimeAmount.toString())
view.timeUnit.setSelection(context.getPreferences().automaticHostRefreshTimeUnit.ordinal)
changeAutomaticRefreshStatus(view.automaticRefresh.isChecked) changeAutomaticRefreshStatus(view.automaticRefresh.isChecked)
val adapter: ArrayAdapter<CharSequence> = ArrayAdapter.createFromResource( val adapter: ArrayAdapter<CharSequence> = ArrayAdapter.createFromResource(
context, context,
...@@ -60,6 +56,10 @@ class HostSourceRefreshDialog(context:Context, ...@@ -60,6 +56,10 @@ class HostSourceRefreshDialog(context:Context,
) )
adapter.setDropDownViewResource(R.layout.item_tasker_action_spinner_dropdown_item) adapter.setDropDownViewResource(R.layout.item_tasker_action_spinner_dropdown_item)
view.timeUnit.adapter = adapter view.timeUnit.adapter = adapter
view.automaticRefresh.isChecked = context.getPreferences().automaticHostRefresh
view.refreshWifiOnly.isChecked = context.getPreferences().automaticHostRefreshWifiOnly
view.timeAmount.setText(context.getPreferences().automaticHostRefreshTimeAmount.toString())
view.timeUnit.setSelection(context.getPreferences().automaticHostRefreshTimeUnit.ordinal)
setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(android.R.string.cancel)) { dialog, _ -> setButton(DialogInterface.BUTTON_NEUTRAL, context.getString(android.R.string.cancel)) { dialog, _ ->
dialog.dismiss() dialog.dismiss()
} }
...@@ -75,6 +75,6 @@ class HostSourceRefreshDialog(context:Context, ...@@ -75,6 +75,6 @@ class HostSourceRefreshDialog(context:Context,
@Keep @Keep
enum class TimeUnit { enum class TimeUnit {
HOURS, DAYS, WEEKS MINUTES, HOURS, DAYS, WEEKS
} }
} }
\ No newline at end of file
...@@ -151,6 +151,7 @@ class DnsRuleFragment : Fragment() { ...@@ -151,6 +151,7 @@ class DnsRuleFragment : Fragment() {
HostSourceRefreshDialog.TimeUnit.WEEKS -> TimeUnit.DAYS HostSourceRefreshDialog.TimeUnit.WEEKS -> TimeUnit.DAYS
HostSourceRefreshDialog.TimeUnit.DAYS -> TimeUnit.DAYS HostSourceRefreshDialog.TimeUnit.DAYS -> TimeUnit.DAYS
HostSourceRefreshDialog.TimeUnit.HOURS -> TimeUnit.HOURS HostSourceRefreshDialog.TimeUnit.HOURS -> TimeUnit.HOURS
HostSourceRefreshDialog.TimeUnit.MINUTES -> TimeUnit.MINUTES
} }
} }
val workRequest = PeriodicWorkRequest.Builder(RuleImportStartWorker::class.java, val workRequest = PeriodicWorkRequest.Builder(RuleImportStartWorker::class.java,
......
...@@ -163,10 +163,12 @@ ...@@ -163,10 +163,12 @@
<string name="dialog_hostsourcerefresh_wifi_only">Refresh on WIFI only</string> <string name="dialog_hostsourcerefresh_wifi_only">Refresh on WIFI only</string>
<string name="dialog_hostsourcerefresh_refresh_every">Refresh every</string> <string name="dialog_hostsourcerefresh_refresh_every">Refresh every</string>
<string name="dialog_hostsourcerefresh_refresh_now">Refresh now</string> <string name="dialog_hostsourcerefresh_refresh_now">Refresh now</string>
<string name="dialog_hostsourcerefresh_timeunit_minutes">Minutes</string>
<string name="dialog_hostsourcerefresh_timeunit_hours">Hours</string> <string name="dialog_hostsourcerefresh_timeunit_hours">Hours</string>
<string name="dialog_hostsourcerefresh_timeunit_days">Days</string> <string name="dialog_hostsourcerefresh_timeunit_days">Days</string>
<string name="dialog_hostsourcerefresh_timeunit_weeks">Weeks</string> <string name="dialog_hostsourcerefresh_timeunit_weeks">Weeks</string>
<string-array name="dialog_hostsourcerefresh_timeunits"> <string-array name="dialog_hostsourcerefresh_timeunits">
<item>@string/dialog_hostsourcerefresh_timeunit_minutes</item>
<item>@string/dialog_hostsourcerefresh_timeunit_hours</item> <item>@string/dialog_hostsourcerefresh_timeunit_hours</item>
<item>@string/dialog_hostsourcerefresh_timeunit_days</item> <item>@string/dialog_hostsourcerefresh_timeunit_days</item>
<item>@string/dialog_hostsourcerefresh_timeunit_weeks</item> <item>@string/dialog_hostsourcerefresh_timeunit_weeks</item>
......
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