Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
BC
public
Linhome-Android
Commits
c9e28637
Commit
c9e28637
authored
Jul 01, 2020
by
Christophe Deschamps
Browse files
Refacto
Former-commit-id: 5ed841f5e3e2fb89d92b21641b9d78f11e11abaf
parent
f37c4182
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
7 additions
and
7 deletions
+7
-7
app/src/main/java/org/lindoor/ui/devices/edit/DeviceEditorViewModel.kt
...java/org/lindoor/ui/devices/edit/DeviceEditorViewModel.kt
+5
-5
app/src/main/res/layout-sw533dp-land/fragment_device_edit.xml
...src/main/res/layout-sw533dp-land/fragment_device_edit.xml
+1
-1
app/src/main/res/layout/fragment_device_edit.xml
app/src/main/res/layout/fragment_device_edit.xml
+1
-1
No files found.
app/src/main/java/org/lindoor/ui/devices/edit/DeviceEditorViewModel.kt
View file @
c9e28637
...
...
@@ -23,7 +23,7 @@ class DeviceEditorViewModel : ViewModelWithTools() {
Pair
(
MutableLiveData
<
String
>(),
MutableLiveData
<
Boolean
>(
false
))
var
availableDeviceTypes
:
ArrayList
<
SpinnerItem
>
=
ArrayList
()
var
t
ype
:
MutableLiveData
<
Int
>
=
MutableLiveData
<
Int
>(
0
)
var
deviceT
ype
:
MutableLiveData
<
Int
>
=
MutableLiveData
<
Int
>(
0
)
var
availableMethodTypes
:
ArrayList
<
SpinnerItem
>
=
ArrayList
()
var
actionsMethod
:
MutableLiveData
<
Int
>
=
MutableLiveData
<
Int
>(
0
)
...
...
@@ -39,7 +39,7 @@ class DeviceEditorViewModel : ViewModelWithTools() {
value
?.
also
{
name
.
first
.
value
=
it
.
name
address
.
first
.
value
=
it
.
address
t
ype
.
value
=
indexByBackingKey
(
it
.
type
,
availableDeviceTypes
)
deviceT
ype
.
value
=
indexByBackingKey
(
it
.
type
,
availableDeviceTypes
)
actionsMethod
.
value
=
indexByBackingKey
(
it
.
actionsMethodType
,
availableMethodTypes
)
}
}
...
...
@@ -49,7 +49,7 @@ class DeviceEditorViewModel : ViewModelWithTools() {
val
deviceTypeListener
=
object
:
LSpinnerListener
{
override
fun
onItemSelected
(
position
:
Int
)
{
t
ype
.
value
=
position
deviceT
ype
.
value
=
position
}
}
...
...
@@ -88,7 +88,7 @@ class DeviceEditorViewModel : ViewModelWithTools() {
if
(
device
==
null
)
{
device
=
Device
(
if
(
t
ype
.
value
==
0
)
null
else
availableDeviceTypes
.
get
(
t
ype
.
value
!!
).
backingKey
,
if
(
deviceT
ype
.
value
==
0
)
null
else
availableDeviceTypes
.
get
(
deviceT
ype
.
value
!!
).
backingKey
,
name
.
first
.
value
!!
,
if
(
address
.
first
.
value
!!
.
startsWith
(
"sip:"
)
||
address
.
first
.
value
!!
.
startsWith
(
"sips:"
))
address
.
first
.
value
!!
else
"sip:${address.first.value}"
,
if
(
actionsMethod
.
value
==
0
)
null
else
availableMethodTypes
.
get
(
actionsMethod
.
value
!!
).
backingKey
,
...
...
@@ -107,7 +107,7 @@ class DeviceEditorViewModel : ViewModelWithTools() {
}
else
{
device
?.
also
{
it
.
type
=
if
(
t
ype
.
value
==
0
)
null
else
availableDeviceTypes
.
get
(
t
ype
.
value
!!
).
backingKey
if
(
deviceT
ype
.
value
==
0
)
null
else
availableDeviceTypes
.
get
(
deviceT
ype
.
value
!!
).
backingKey
it
.
name
=
name
.
first
.
value
!!
it
.
address
=
if
(
address
.
first
.
value
!!
.
startsWith
(
"sip:"
)
||
address
.
first
.
value
!!
.
startsWith
(
"sips:"
))
address
.
first
.
value
!!
else
"sip:${address.first.value}"
it
.
actionsMethodType
=
...
...
app/src/main/res/layout-sw533dp-land/fragment_device_edit.xml
View file @
c9e28637
...
...
@@ -103,7 +103,7 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
listener=
"@{model.deviceTypeListener}"
initialIndex=
"@{model.
t
ype}"
initialIndex=
"@{model.
deviceT
ype}"
items=
"@{model.availableDeviceTypes}"
/>
...
...
app/src/main/res/layout/fragment_device_edit.xml
View file @
c9e28637
...
...
@@ -91,7 +91,7 @@
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
listener=
"@{model.deviceTypeListener}"
initialIndex=
"@{model.
t
ype}"
initialIndex=
"@{model.
deviceT
ype}"
items=
"@{model.availableDeviceTypes}"
/>
...
...
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