Commit 0f4feea1 by Kunj Gupta

UOFLMA-88: Fix - Not rendering full description.

parent 66e0a8f1
...@@ -188,10 +188,10 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -188,10 +188,10 @@ public class CatalogueVariableScreen extends AppCompatActivity {
} }
private void createView() { private void createView() {
/*For variable list */
getCustomLayout();
if(!mCatalogueVariableList.isEmpty()) { if(!mCatalogueVariableList.isEmpty()) {
mBottomLayout.setVisibility(View.VISIBLE); mBottomLayout.setVisibility(View.VISIBLE);
/*For variable list */
getCustomLayout();
} else { } else {
mBottomLayout.setVisibility(View.GONE); mBottomLayout.setVisibility(View.GONE);
} }
...@@ -225,78 +225,80 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -225,78 +225,80 @@ public class CatalogueVariableScreen extends AppCompatActivity {
mContainerLayout.addView(descriptionView, childControlViewLayoutParams); mContainerLayout.addView(descriptionView, childControlViewLayoutParams);
} }
for (int i = 0; i < mCatalogueVariableList.size(); i++) { if(!mCatalogueVariableList.isEmpty()) {
CatalogueVariable catalogueVariable = mCatalogueVariableList.get(i); for (int i = 0; i < mCatalogueVariableList.size(); i++) {
ViewType viewType = catalogueVariable.getType(); CatalogueVariable catalogueVariable = mCatalogueVariableList.get(i);
CatalogueLog.e("viewType: " + viewType + ", Question: "+catalogueVariable.getQuestionText() + ", Order: "+catalogueVariable.getOrder()); ViewType viewType = catalogueVariable.getType();
if (catalogueVariable.getName() == null) { CatalogueLog.e("viewType: " + viewType + ", Question: " + catalogueVariable.getQuestionText() + ", Order: " + catalogueVariable.getOrder());
TextView nameNullView = new TextView(CatalogueVariableScreen.this); if (catalogueVariable.getName() == null) {
nameNullView.setText(R.string.name_null_view_string); TextView nameNullView = new TextView(CatalogueVariableScreen.this);
nameNullView.setBackgroundColor(ContextCompat.getColor(CatalogueVariableScreen.this, R.color.name_null_view_color)); nameNullView.setText(R.string.name_null_view_string);
childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin); nameNullView.setBackgroundColor(ContextCompat.getColor(CatalogueVariableScreen.this, R.color.name_null_view_color));
nameNullView.setPadding((int) getResources().getDimension(R.dimen.small_margin), childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin);
(int) getResources().getDimension(R.dimen.small_margin), nameNullView.setPadding((int) getResources().getDimension(R.dimen.small_margin),
(int) getResources().getDimension(R.dimen.small_margin), (int) getResources().getDimension(R.dimen.small_margin),
(int) getResources().getDimension(R.dimen.small_margin)); (int) getResources().getDimension(R.dimen.small_margin),
mContainerLayout.addView(nameNullView, childLabelViewLayoutParams); (int) getResources().getDimension(R.dimen.small_margin));
} else if(viewType != ViewType.MACRO && viewType != ViewType.CONTAINER_START && viewType != ViewType.CONTAINER_END && viewType != ViewType.CONTAINER_SPLIT) { mContainerLayout.addView(nameNullView, childLabelViewLayoutParams);
} else if (viewType != ViewType.MACRO && viewType != ViewType.CONTAINER_START && viewType != ViewType.CONTAINER_END && viewType != ViewType.CONTAINER_SPLIT) {
/*For MACRO, CONTAINER_START, CONTAINER_END and CONTAINER_SPLIT, there is no need to render any view*/ /*For MACRO, CONTAINER_START, CONTAINER_END and CONTAINER_SPLIT, there is no need to render any view*/
if (viewType != ViewType.LABEL && viewType != ViewType.CHECK_BOX && viewType != ViewType.BREAK) { if (viewType != ViewType.LABEL && viewType != ViewType.CHECK_BOX && viewType != ViewType.BREAK) {
/*Create label for every type*/ /*Create label for every type*/
if (!catalogueVariable.isMandatory()) { if (!catalogueVariable.isMandatory()) {
TextView label = new TextView(CatalogueVariableScreen.this); TextView label = new TextView(CatalogueVariableScreen.this);
label.setText(catalogueVariable.getQuestionText()); label.setText(catalogueVariable.getQuestionText());
childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin); childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin);
mContainerLayout.addView(label, childLabelViewLayoutParams); mContainerLayout.addView(label, childLabelViewLayoutParams);
} else { } else {
/*Create label with mandatory value*/ /*Create label with mandatory value*/
LinearLayout labelLayout = new LinearLayout(CatalogueVariableScreen.this); LinearLayout labelLayout = new LinearLayout(CatalogueVariableScreen.this);
labelLayout.setOrientation(LinearLayout.HORIZONTAL); labelLayout.setOrientation(LinearLayout.HORIZONTAL);
TextView label = new TextView(CatalogueVariableScreen.this); TextView label = new TextView(CatalogueVariableScreen.this);
label.setText(catalogueVariable.getQuestionText()); label.setText(catalogueVariable.getQuestionText());
childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin); childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin);
labelLayout.addView(label, childLabelViewLayoutParams); labelLayout.addView(label, childLabelViewLayoutParams);
TextView mandatory = new TextView(CatalogueVariableScreen.this); TextView mandatory = new TextView(CatalogueVariableScreen.this);
mandatory.setText("*"); mandatory.setText("*");
mandatory.setTextColor(ContextCompat.getColor(CatalogueVariableScreen.this, R.color.error_color)); mandatory.setTextColor(ContextCompat.getColor(CatalogueVariableScreen.this, R.color.error_color));
labelLayout.addView(mandatory); labelLayout.addView(mandatory);
mContainerLayout.addView(labelLayout); mContainerLayout.addView(labelLayout);
}
} }
}
View controlView = Util.getView(CatalogueVariableScreen.this, viewType, catalogueVariable); View controlView = Util.getView(CatalogueVariableScreen.this, viewType, catalogueVariable);
if (controlView != null) { if (controlView != null) {
controlView.setTag(new TagObject(i, null)); controlView.setTag(new TagObject(i, null));
if (viewType == ViewType.DATE) { if (viewType == ViewType.DATE) {
controlView.setOnClickListener(dateListener); controlView.setOnClickListener(dateListener);
} else if (viewType == ViewType.DATE_AND_TIME) { } else if (viewType == ViewType.DATE_AND_TIME) {
controlView.setOnClickListener(dateTimeListener); controlView.setOnClickListener(dateTimeListener);
} else if (viewType == ViewType.REFERENCE) { } else if (viewType == ViewType.REFERENCE) {
controlView.setOnTouchListener(referenceListener); controlView.setOnTouchListener(referenceListener);
} }
/*Set bottom margin for custom view*/ /*Set bottom margin for custom view*/
if (viewType != ViewType.BREAK) { if (viewType != ViewType.BREAK) {
mContainerLayout.addView(controlView, childControlViewLayoutParams); mContainerLayout.addView(controlView, childControlViewLayoutParams);
} else } else
mContainerLayout.addView(controlView); mContainerLayout.addView(controlView);
/*Mandatory variable contain error view*/ /*Mandatory variable contain error view*/
if (catalogueVariable.isMandatory()) { if (catalogueVariable.isMandatory()) {
/*Add error view for validation*/ /*Add error view for validation*/
View errorView = getErrorView(); View errorView = getErrorView();
errorView.setTag("error_" + i); errorView.setTag("error_" + i);
mContainerLayout.addView(errorView); mContainerLayout.addView(errorView);
}
} else {
TextView viewNotImplemented = new TextView(CatalogueVariableScreen.this);
viewNotImplemented.setText(String.format(getString(R.string.view_not_implemented_string), viewType.getDisplayString()));
viewNotImplemented.setBackgroundColor(ContextCompat.getColor(CatalogueVariableScreen.this, R.color.view_not_implemented_color));
childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin);
mContainerLayout.addView(viewNotImplemented, childLabelViewLayoutParams);
} }
} else {
TextView viewNotImplemented = new TextView(CatalogueVariableScreen.this);
viewNotImplemented.setText(String.format(getString(R.string.view_not_implemented_string), viewType.getDisplayString()));
viewNotImplemented.setBackgroundColor(ContextCompat.getColor(CatalogueVariableScreen.this, R.color.view_not_implemented_color));
childLabelViewLayoutParams.topMargin = (int) getResources().getDimension(R.dimen.small_margin);
mContainerLayout.addView(viewNotImplemented, childLabelViewLayoutParams);
} }
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment