Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Nathan OBrian
Nebulo
Commits
40ca2561
Commit
40ca2561
authored
Aug 08, 2019
by
Daniel Wolf
Browse files
Properly disable/enable the content initially
parent
8b0142db
Changes
2
Hide whitespace changes
Inline
Side-by-side
app/src/main/java/com/frostnerd/smokescreen/dialog/HostSourceRefreshDialog.kt
View file @
40ca2561
...
...
@@ -2,6 +2,7 @@ package com.frostnerd.smokescreen.dialog
import
android.content.Context
import
android.content.DialogInterface
import
android.view.View
import
android.widget.ArrayAdapter
import
androidx.annotation.Keep
import
androidx.appcompat.app.AlertDialog
...
...
@@ -38,15 +39,20 @@ class HostSourceRefreshDialog(context:Context,
view
.
refreshNow
.
setOnClickListener
{
runRefresh
()
}
v
iew
.
a
utomaticRefresh
.
setOnCheckedChangeListener
{
_
,
isChecked
->
v
al
changeA
utomaticRefresh
Status
:(
Boolean
)
->
Unit
=
{
isChecked
->
view
.
refreshWifiOnly
.
isEnabled
=
isChecked
view
.
timeAmountTil
.
isEnabled
=
isChecked
view
.
timeUnit
.
isEnabled
=
isChecked
view
.
refreshTimeWrap
.
visibility
=
if
(
isChecked
)
View
.
VISIBLE
else
View
.
INVISIBLE
}
view
.
automaticRefresh
.
setOnCheckedChangeListener
{
_
,
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
)
val
adapter
:
ArrayAdapter
<
CharSequence
>
=
ArrayAdapter
.
createFromResource
(
context
,
R
.
array
.
dialog_hostsourcerefresh_timeunits
,
...
...
app/src/main/res/layout/dialog_host_source_refresh.xml
View file @
40ca2561
...
...
@@ -24,49 +24,56 @@
android:id=
"@+id/refreshWifiOnly"
android:layout_height=
"wrap_content"
/>
<TextView
android:layout_width=
"wrap_content"
android:layout_marginTop=
"12dp"
android:text=
"@string/dialog_hostsourcerefresh_refresh_every"
android:layout_height=
"wrap_content"
/>
<RelativeLayout
<LinearLayout
android:layout_width=
"match_parent"
android:id=
"@+id/refreshTimeWrap"
android:orientation=
"vertical"
android:layout_height=
"wrap_content"
>
<com.google.android.material.textfield.TextInputLayout
<TextView
android:layout_width=
"wrap_content"
android:id=
"@+id/timeAmountTil"
android:layout_above=
"@id/refreshNow"
android:layout_alignParentTop=
"true"
android:layout_marginTop=
"12dp"
android:text=
"@string/dialog_hostsourcerefresh_refresh_every"
android:layout_height=
"wrap_content"
/>
<RelativeLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width=
"match_parent"
android:id=
"@+id/timeAmount"
android:inputType=
"numberSigned"
android:imeOptions=
"actionNext"
android:text=
"12"
android:maxLines=
"1"
<com.google.android.material.textfield.TextInputLayout
android:layout_width=
"wrap_content"
android:id=
"@+id/timeAmountTil"
android:layout_above=
"@id/refreshNow"
android:layout_alignParentTop=
"true"
android:layout_height=
"wrap_content"
>
<com.google.android.material.textfield.TextInputEditText
android:layout_width=
"match_parent"
android:id=
"@+id/timeAmount"
android:inputType=
"numberSigned"
android:imeOptions=
"actionNext"
android:text=
"12"
android:maxLines=
"1"
android:layout_height=
"wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<Spinner
android:layout_width=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_toEndOf=
"@id/timeAmountTil"
android:id=
"@+id/timeUnit"
android:layout_marginStart=
"8dp"
android:layout_alignBaseline=
"@id/timeAmountTil"
android:layout_height=
"wrap_content"
/>
</com.google.android.material.textfield.TextInputLayout>
<Spinner
android:layout_width=
"wrap_content"
android:layout_alignParentEnd=
"true"
android:layout_toEndOf=
"@id/timeAmountTil"
android:id=
"@+id/timeUnit"
android:layout_marginStart=
"8dp"
android:layout_alignBaseline=
"@id/timeAmountTil"
android:layout_height=
"wrap_content"
/>
<Button
android:layout_width=
"match_parent"
android:background=
"@drawable/main_roundbuttons"
android:id=
"@+id/refreshNow"
android:layout_alignParentBottom=
"true"
android:text=
"@string/dialog_hostsourcerefresh_refresh_now"
style=
"@style/Base.Widget.AppCompat.Button.Borderless.Colored"
android:layout_height=
"wrap_content"
/>
</RelativeLayout>
</LinearLayout>
<Button
android:layout_width=
"match_parent"
android:background=
"@drawable/main_roundbuttons"
android:id=
"@+id/refreshNow"
android:layout_alignParentBottom=
"true"
android:text=
"@string/dialog_hostsourcerefresh_refresh_now"
style=
"@style/Base.Widget.AppCompat.Button.Borderless.Colored"
android:layout_height=
"wrap_content"
/>
</RelativeLayout>
</LinearLayout>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment