Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Contribute to GitLab
Sign in / Register
Toggle navigation
M
Magisk
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
Magisk
Commits
89da45f9
Commit
89da45f9
authored
Nov 29, 2019
by
Viktor De Pasquale
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed state not being propagated correctly on startup
parent
34a0a00e
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
13 additions
and
10 deletions
+13
-10
SettingsItems.kt
...a/com/topjohnwu/magisk/redesign/settings/SettingsItems.kt
+8
-0
SettingsViewModel.kt
...m/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt
+5
-10
No files found.
app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsItems.kt
View file @
89da45f9
...
@@ -129,6 +129,14 @@ object UpdateChannelUrl : SettingsItem.Input() {
...
@@ -129,6 +129,14 @@ object UpdateChannelUrl : SettingsItem.Input() {
notifyChange
(
BR
.
result
)
notifyChange
(
BR
.
result
)
}
}
init
{
updateState
()
}
fun
updateState
()
{
isEnabled
=
UpdateChannel
.
value
==
Config
.
Value
.
CUSTOM_CHANNEL
}
override
fun
getView
(
context
:
Context
)
=
DialogSettingsUpdateChannelBinding
override
fun
getView
(
context
:
Context
)
=
DialogSettingsUpdateChannelBinding
.
inflate
(
LayoutInflater
.
from
(
context
)).
also
{
it
.
data
=
this
}.
root
.
inflate
(
LayoutInflater
.
from
(
context
)).
also
{
it
.
data
=
this
}.
root
}
}
...
...
app/src/main/java/com/topjohnwu/magisk/redesign/settings/SettingsViewModel.kt
View file @
89da45f9
...
@@ -9,7 +9,6 @@ import androidx.databinding.Bindable
...
@@ -9,7 +9,6 @@ import androidx.databinding.Bindable
import
androidx.databinding.ViewDataBinding
import
androidx.databinding.ViewDataBinding
import
androidx.recyclerview.widget.StaggeredGridLayoutManager
import
androidx.recyclerview.widget.StaggeredGridLayoutManager
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.BR
import
com.topjohnwu.magisk.Config
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.R
import
com.topjohnwu.magisk.model.entity.recycler.ObservableItem
import
com.topjohnwu.magisk.model.entity.recycler.ObservableItem
import
com.topjohnwu.magisk.model.events.DieEvent
import
com.topjohnwu.magisk.model.events.DieEvent
...
@@ -49,18 +48,14 @@ class SettingsViewModel : CompatViewModel(), SettingsItem.Callback {
...
@@ -49,18 +48,14 @@ class SettingsViewModel : CompatViewModel(), SettingsItem.Callback {
// use only instances you want, don't declare everything
// use only instances you want, don't declare everything
is
Theme
->
Navigation
.
theme
().
publish
()
is
Theme
->
Navigation
.
theme
().
publish
()
is
Redesign
->
DieEvent
().
publish
()
is
Redesign
->
DieEvent
().
publish
()
is
UpdateChannel
->
item
.
openUrlIfNecessary
(
view
)
is
UpdateChannel
->
openUrlIfNecessary
(
view
)
else
->
Unit
else
->
Unit
}
}
private
fun
UpdateChannel
.
openUrlIfNecessary
(
view
:
View
)
{
private
fun
openUrlIfNecessary
(
view
:
View
)
{
if
(
value
==
Config
.
Value
.
CUSTOM_CHANNEL
)
{
UpdateChannelUrl
.
updateState
()
if
(
UpdateChannelUrl
.
value
.
isBlank
())
{
if
(
UpdateChannelUrl
.
value
.
isBlank
())
{
UpdateChannelUrl
.
onPressed
(
view
,
this
@SettingsViewModel
)
UpdateChannelUrl
.
onPressed
(
view
,
this
@SettingsViewModel
)
}
UpdateChannelUrl
.
isEnabled
=
true
}
else
{
UpdateChannelUrl
.
isEnabled
=
false
}
}
}
}
...
...
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