Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
Krishna Vemulavada
/
vera_2.1_app
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
24705d5a
authored
Oct 17, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
UOFLMA-119 - Fixed - Drop down by default it has to show "Select Group".
parent
f0394a64
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
31 additions
and
4 deletions
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
app/src/main/java/com/vsoft/uoflservicenow/utils/Util.java
app/src/main/java/com/vsoft/uoflservicenow/db/models/CatalogueVariable.java
View file @
24705d5a
...
...
@@ -45,6 +45,9 @@ public class CatalogueVariable {
@SerializedName
(
"Active"
)
@Expose
private
boolean
active
;
@SerializedName
(
"default_value"
)
@Expose
private
String
defaultValue
;
// @SerializedName("type")
// @Expose
...
...
@@ -173,6 +176,14 @@ public class CatalogueVariable {
this
.
active
=
active
;
}
public
String
getDefaultValue
()
{
return
defaultValue
;
}
public
void
setDefaultValue
(
String
defaultValue
)
{
this
.
defaultValue
=
defaultValue
;
}
public
List
<
VariableChoice
>
getVariableChoiceList
()
{
return
mVariableChoiceList
;
}
...
...
@@ -181,9 +192,23 @@ public class CatalogueVariable {
this
.
mVariableChoiceList
=
mVariableChoiceList
;
}
public
String
[]
getDisplayChoiceText
(
Context
context
,
boolean
isNoneRequired
)
{
public
String
[]
getDisplayChoiceText
(
Context
context
)
{
String
[]
choiceText
;
if
(
isNoneRequired
)
{
if
(
defaultValue
!=
null
)
{
choiceText
=
new
String
[
mVariableChoiceList
.
size
()
+
1
];
choiceText
[
0
]
=
defaultValue
;
for
(
int
i
=
0
;
i
<
mVariableChoiceList
.
size
();
i
++)
{
VariableChoice
variableChoice
=
mVariableChoiceList
.
get
(
i
);
/*(i+1) for add None text as a first Element*/
if
(
variableChoice
.
getMisc
()
>
0
)
{
choiceText
[
i
+
1
]
=
String
.
format
(
context
.
getString
(
R
.
string
.
variable_form_misc_info_string
),
variableChoice
.
getText
(),
variableChoice
.
getMisc
());
}
else
{
choiceText
[
i
+
1
]
=
variableChoice
.
getText
();
}
}
}
else
if
(
isNoneRequired
)
{
choiceText
=
new
String
[
mVariableChoiceList
.
size
()
+
1
];
choiceText
[
0
]
=
context
.
getString
(
R
.
string
.
none_string
);
for
(
int
i
=
0
;
i
<
mVariableChoiceList
.
size
();
i
++)
{
...
...
@@ -230,7 +255,6 @@ public class CatalogueVariable {
}
catch
(
JSONException
e
)
{
e
.
printStackTrace
();
}
this
.
setType
(
ViewType
.
from
(
viewType
));
}
...
...
@@ -254,6 +278,7 @@ public class CatalogueVariable {
", order="
+
order
+
", referenceColumnName='"
+
referenceColumnName
+
'\''
+
", active="
+
active
+
", defaultValue='"
+
defaultValue
+
'\''
+
", type="
+
type
+
", mVariableChoiceList="
+
mVariableChoiceList
+
'}'
;
...
...
app/src/main/java/com/vsoft/uoflservicenow/utils/Util.java
View file @
24705d5a
...
...
@@ -354,7 +354,7 @@ public class Util {
selectBoxSpinner
.
setPadding
(
0
,
(
int
)
context
.
getResources
().
getDimension
(
R
.
dimen
.
normal_margin
),
0
,
(
int
)
context
.
getResources
().
getDimension
(
R
.
dimen
.
normal_margin
));
ArrayAdapter
<
String
>
selectBoxSpinnerArrayAdapter
=
new
ArrayAdapter
<>(
context
,
android
.
R
.
layout
.
simple_spinner_item
,
catalogueVariable
.
getDisplayChoiceText
(
context
,
catalogueVariable
.
isNoneRequired
()
));
new
ArrayAdapter
<>(
context
,
android
.
R
.
layout
.
simple_spinner_item
,
catalogueVariable
.
getDisplayChoiceText
(
context
));
selectBoxSpinnerArrayAdapter
.
setDropDownViewResource
(
android
.
R
.
layout
.
simple_spinner_dropdown_item
);
selectBoxSpinner
.
setAdapter
(
selectBoxSpinnerArrayAdapter
);
container
.
setInputView
(
selectBoxSpinner
);
...
...
@@ -494,6 +494,8 @@ public class Util {
case
SELECT_BOX:
Spinner
selectBoxSpinner
=
(
Spinner
)
view
;
String
value
=
catalogueVariable
.
getDisplayChoiceText
(
selectBoxSpinner
.
getSelectedItem
().
toString
());
/*value = null mean selected value is none or default value.*/
value
=
value
!=
null
?
value
:
""
;
return
value
;
default
:
return
getVariableViewValue
(
view
,
catalogueVariable
.
getType
());
...
...
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