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
d278102c
authored
Oct 04, 2016
by
Kunj Gupta
Browse files
Options
_('Browse Files')
Download
Plain Diff
UOFLMA-116: Fixed - Mandatory fields issue.
parents
7062c7e8
b73ee666
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
36 additions
and
34 deletions
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
app/src/main/res/values/strings.xml
app/src/main/java/com/vsoft/uoflservicenow/ui/CatalogueVariableScreen.java
View file @
d278102c
...
...
@@ -30,6 +30,7 @@ import android.support.v7.widget.Toolbar;
import
android.text.Html
;
import
android.text.TextUtils
;
import
android.text.method.LinkMovementMethod
;
import
android.util.StringBuilderPrinter
;
import
android.util.TypedValue
;
import
android.view.MenuItem
;
import
android.view.MotionEvent
;
...
...
@@ -308,20 +309,18 @@ public class CatalogueVariableScreen extends AppCompatActivity {
childLabelViewLayoutParams
.
topMargin
=
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
small_margin
);
mContainerLayout
.
addView
(
label
,
childLabelViewLayoutParams
);
}
else
{
/*Create label with mandatory value*/
LinearLayout
labelLayout
=
new
LinearLayout
(
CatalogueVariableScreen
.
this
);
labelLayout
.
setOrientation
(
LinearLayout
.
HORIZONTAL
);
TextView
label
=
new
TextView
(
CatalogueVariableScreen
.
this
);
label
.
setText
(
catalogueVariable
.
getQuestionText
());
childLabelViewLayoutParams
.
topMargin
=
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
small_margin
);
labelLayout
.
addView
(
label
,
childLabelViewLayoutParams
);
TextView
mandatory
=
new
TextView
(
CatalogueVariableScreen
.
this
);
mandatory
.
setText
(
"*"
);
mandatory
.
setTextColor
(
ContextCompat
.
getColor
(
CatalogueVariableScreen
.
this
,
R
.
color
.
error_color
));
labelLayout
.
addView
(
mandatory
);
mContainerLayout
.
addView
(
labelLayout
);
/*Create labelWithMandatory with mandatory value*/
StringBuilder
stringBuilder
=
new
StringBuilder
();
stringBuilder
.
append
(
catalogueVariable
.
getQuestionText
());
stringBuilder
.
append
(
getString
(
R
.
string
.
variable_form_view_mandatory_sign_string
));
TextView
labelWithMandatory
=
new
TextView
(
CatalogueVariableScreen
.
this
);
if
(
android
.
os
.
Build
.
VERSION
.
SDK_INT
>=
android
.
os
.
Build
.
VERSION_CODES
.
N
)
{
labelWithMandatory
.
setText
(
Html
.
fromHtml
(
stringBuilder
.
toString
(),
Html
.
FROM_HTML_MODE_LEGACY
));
}
else
{
labelWithMandatory
.
setText
(
Html
.
fromHtml
(
stringBuilder
.
toString
()));
}
mContainerLayout
.
addView
(
labelWithMandatory
,
childLabelViewLayoutParams
);
}
}
...
...
@@ -415,27 +414,29 @@ public class CatalogueVariableScreen extends AppCompatActivity {
jsonColumnValue
=
Util
.
getDateTime
(
Util
.
getDateTimeFromString
(
value
));
}
if
(
viewType
!=
ViewType
.
SELECT_BOX
&&
viewType
!=
ViewType
.
UI_PAGE
)
{
if
(
TextUtils
.
isEmpty
(
jsonColumnValue
))
{
hasErrors
=
true
;
// show error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
// hide error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
GONE
);
}
}
else
{
if
(
jsonColumnValue
.
equals
(
getString
(
R
.
string
.
none_string
)))
{
hasErrors
=
true
;
// show error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
VISIBLE
);
if
(
catalogueVariable
.
isMandatory
())
{
if
(
viewType
!=
ViewType
.
SELECT_BOX
&&
viewType
!=
ViewType
.
UI_PAGE
)
{
if
(
TextUtils
.
isEmpty
(
jsonColumnValue
))
{
hasErrors
=
true
;
// show error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
// hide error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
GONE
);
}
}
else
{
// hide error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
GONE
);
if
(
jsonColumnValue
.
equals
(
getString
(
R
.
string
.
none_string
)))
{
hasErrors
=
true
;
// show error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
// hide error view
if
(
errorView
!=
null
)
errorView
.
setVisibility
(
View
.
GONE
);
}
}
}
...
...
app/src/main/res/values/strings.xml
View file @
d278102c
...
...
@@ -52,6 +52,7 @@
<!--Variable Screen-->
<string
name=
"variable_form_misc_info_string"
>
%1$s [add %2$s]
</string>
<string
name=
"variable_form_header_string"
>
Submit Order
</string>
<string
name=
"variable_form_view_mandatory_sign_string"
>
<
font color="#FF0000"
>
*
<
/font
>
</string>
<string
name=
"variable_form_reference_dialog_title_string"
>
Search \'%s\'
</string>
<string
name=
"variable_form_radio_text_string"
>
%d
</string>
<string
name=
"variable_form_ui_page_button_label_string"
>
Add Attachment
</string>
...
...
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