Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
BC
public
linhome-android-old-big-globs
Commits
a1afb74e
Commit
a1afb74e
authored
4 years ago
by
Christophe Deschamps
Browse files
Options
Download
Patches
Plain Diff
Highlight selected value in dropdown widgets
parent
7edd6b81
master
develop
feature/fix_sip_ports
No related merge requests found
Pipeline
#23012
passed with stage
in 2 minutes and 36 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
app/src/main/java/org/linhome/ui/widgets/LSpinner.kt
+2
-1
app/src/main/java/org/linhome/ui/widgets/LSpinner.kt
app/src/main/java/org/linhome/ui/widgets/LSpinnerAdapter.kt
+8
-1
app/src/main/java/org/linhome/ui/widgets/LSpinnerAdapter.kt
with
10 additions
and
2 deletions
app/src/main/java/org/linhome/ui/widgets/LSpinner.kt
+
2
−
1
View file @
a1afb74e
...
@@ -72,7 +72,7 @@ class LSpinner : LinearLayout {
...
@@ -72,7 +72,7 @@ class LSpinner : LinearLayout {
var
items
:
ArrayList
<
SpinnerItem
>?
=
null
var
items
:
ArrayList
<
SpinnerItem
>?
=
null
set
(
value
)
{
set
(
value
)
{
binding
.
root
.
spinner
.
adapter
=
value
?.
let
{
LSpinnerAdapter
(
it
,
binding
.
root
.
spinner
,
this
)
}
binding
.
root
.
spinner
.
adapter
=
value
?.
let
{
LSpinnerAdapter
(
it
,
binding
.
root
.
spinner
,
this
,
null
)
}
}
}
...
@@ -93,6 +93,7 @@ class LSpinner : LinearLayout {
...
@@ -93,6 +93,7 @@ class LSpinner : LinearLayout {
set
(
value
)
{
set
(
value
)
{
if
(
value
!=
null
)
{
if
(
value
!=
null
)
{
binding
.
root
.
spinner
.
setSelection
(
value
)
binding
.
root
.
spinner
.
setSelection
(
value
)
(
binding
.
root
.
spinner
.
adapter
as
LSpinnerAdapter
).
selectedIndex
=
value
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
app/src/main/java/org/linhome/ui/widgets/LSpinnerAdapter.kt
+
8
−
1
View file @
a1afb74e
...
@@ -41,7 +41,7 @@ import org.linhome.databinding.ItemSpinnerBinding
...
@@ -41,7 +41,7 @@ import org.linhome.databinding.ItemSpinnerBinding
import
org.linhome.utils.cdlog
import
org.linhome.utils.cdlog
class
SpinnerItem
(
val
textKey
:
String
,
val
iconFile
:
String
?
=
null
,
val
backingKey
:
String
?
=
null
)
class
SpinnerItem
(
val
textKey
:
String
,
val
iconFile
:
String
?
=
null
,
val
backingKey
:
String
?
=
null
)
class
LSpinnerAdapter
(
private
val
options
:
ArrayList
<
SpinnerItem
>,
val
spinner
:
Spinner
,
val
lSpinner
:
LSpinner
)
:
class
LSpinnerAdapter
(
private
val
options
:
ArrayList
<
SpinnerItem
>,
val
spinner
:
Spinner
,
val
lSpinner
:
LSpinner
,
var
selectedIndex
:
Int
?
)
:
SpinnerAdapter
{
SpinnerAdapter
{
var
height
:
Int
?
=
null
var
height
:
Int
?
=
null
...
@@ -114,6 +114,13 @@ class LSpinnerAdapter(private val options: ArrayList<SpinnerItem>, val spinner:
...
@@ -114,6 +114,13 @@ class LSpinnerAdapter(private val options: ArrayList<SpinnerItem>, val spinner:
view
.
visibility
=
View
.
VISIBLE
view
.
visibility
=
View
.
VISIBLE
}
}
if
(
lSpinner
.
opened
&&
position
==
selectedIndex
)
{
view
.
background
=
Theme
.
roundRectInputBackgroundWithColorKeyAndRadius
(
"color_i"
,
"user_input_corner_radius"
)
}
return
view
return
view
}
}
...
...
This diff is collapsed.
Click to expand it.
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment
Menu
Explore
Projects
Groups
Topics
Snippets