Commit c66910c1 by Kunj Gupta

UOFLMA-70: UI related changes.

parent 5a7d3502
...@@ -53,7 +53,7 @@ public class SelectReferenceDialog extends DialogFragment { ...@@ -53,7 +53,7 @@ public class SelectReferenceDialog extends DialogFragment {
private ReferenceListener mListener; private ReferenceListener mListener;
private Unbinder mUnbinder; private Unbinder mUnbinder;
private List<Reference> mReferenceList; private List<Reference> mReferenceList;
private String mReferenceTableName; private String mReferenceTableName, mReferenceTitle;
private CatalogueApplication mApplication; private CatalogueApplication mApplication;
public SelectReferenceDialog() { public SelectReferenceDialog() {
...@@ -64,11 +64,12 @@ public class SelectReferenceDialog extends DialogFragment { ...@@ -64,11 +64,12 @@ public class SelectReferenceDialog extends DialogFragment {
mListener = listener; mListener = listener;
} }
public static SelectReferenceDialog newInstance(String tableName) { public static SelectReferenceDialog newInstance(String tableName, String title) {
SelectReferenceDialog selectReferenceDialog = new SelectReferenceDialog(); SelectReferenceDialog selectReferenceDialog = new SelectReferenceDialog();
Bundle bundle = new Bundle(); Bundle bundle = new Bundle();
bundle.putString(Constants.DATA_KEY_REFERENCE_TABLE_NAME, tableName); bundle.putString(Constants.DATA_KEY_REFERENCE_TABLE_NAME, tableName);
bundle.putString(Constants.DATA_KEY_REFERENCE_TITLE, title);
selectReferenceDialog.setArguments(bundle); selectReferenceDialog.setArguments(bundle);
return selectReferenceDialog; return selectReferenceDialog;
...@@ -81,6 +82,7 @@ public class SelectReferenceDialog extends DialogFragment { ...@@ -81,6 +82,7 @@ public class SelectReferenceDialog extends DialogFragment {
mApplication = (CatalogueApplication) getActivity().getApplication(); mApplication = (CatalogueApplication) getActivity().getApplication();
mReferenceTableName = getArguments().getString(Constants.DATA_KEY_REFERENCE_TABLE_NAME); mReferenceTableName = getArguments().getString(Constants.DATA_KEY_REFERENCE_TABLE_NAME);
mReferenceTitle = getArguments().getString(Constants.DATA_KEY_REFERENCE_TITLE);
} }
@Override @Override
...@@ -99,6 +101,9 @@ public class SelectReferenceDialog extends DialogFragment { ...@@ -99,6 +101,9 @@ public class SelectReferenceDialog extends DialogFragment {
View rootView = inflater.inflate(R.layout.custom_dialog, container, false); View rootView = inflater.inflate(R.layout.custom_dialog, container, false);
mUnbinder = ButterKnife.bind(this, rootView); mUnbinder = ButterKnife.bind(this, rootView);
mTitleTextView.setText(String.format(getString(R.string.variable_form_reference_dialog_title_string), mReferenceTitle));
mEditText.setHint(mReferenceTitle);
return rootView; return rootView;
} }
......
...@@ -137,6 +137,7 @@ public class CatalogueItemScreen extends AppCompatActivity { ...@@ -137,6 +137,7 @@ public class CatalogueItemScreen extends AppCompatActivity {
Intent intent = new Intent(CatalogueItemScreen.this, CatalogueVariableScreen.class); Intent intent = new Intent(CatalogueItemScreen.this, CatalogueVariableScreen.class);
intent.putExtra(Constants.DATA_KEY_SYS_ID, mCatalogueItemList.get(position).getSysId()); intent.putExtra(Constants.DATA_KEY_SYS_ID, mCatalogueItemList.get(position).getSysId());
intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_DESCRIPTION, mCatalogueItemList.get(position).getDescription()); intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_DESCRIPTION, mCatalogueItemList.get(position).getDescription());
intent.putExtra(Constants.DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION, mCatalogueItemList.get(position).getShortDescription());
intent.putExtra(Constants.DATA_KEY_CATALOGUE_TITLE, mCatalogueItemList.get(position).getName()); intent.putExtra(Constants.DATA_KEY_CATALOGUE_TITLE, mCatalogueItemList.get(position).getName());
startActivity(intent); startActivity(intent);
} }
......
...@@ -4,6 +4,7 @@ import android.app.DatePickerDialog; ...@@ -4,6 +4,7 @@ import android.app.DatePickerDialog;
import android.app.ProgressDialog; import android.app.ProgressDialog;
import android.app.TimePickerDialog; import android.app.TimePickerDialog;
import android.content.DialogInterface; import android.content.DialogInterface;
import android.graphics.Typeface;
import android.os.AsyncTask; import android.os.AsyncTask;
import android.os.Bundle; import android.os.Bundle;
import android.support.v4.app.FragmentManager; import android.support.v4.app.FragmentManager;
...@@ -14,6 +15,7 @@ import android.support.v7.app.AppCompatActivity; ...@@ -14,6 +15,7 @@ import android.support.v7.app.AppCompatActivity;
import android.support.v7.widget.Toolbar; import android.support.v7.widget.Toolbar;
import android.text.Html; import android.text.Html;
import android.text.TextUtils; import android.text.TextUtils;
import android.text.method.LinkMovementMethod;
import android.view.MenuItem; import android.view.MenuItem;
import android.view.MotionEvent; import android.view.MotionEvent;
import android.view.View; import android.view.View;
...@@ -65,15 +67,13 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -65,15 +67,13 @@ public class CatalogueVariableScreen extends AppCompatActivity {
@BindView(R.id.tool_bar_view) Toolbar mToolbar; @BindView(R.id.tool_bar_view) Toolbar mToolbar;
@BindView(R.id.variable_screen_back_text_view) TextView mBackTextView; @BindView(R.id.variable_screen_back_text_view) TextView mBackTextView;
@BindView(R.id.variable_screen_submit_text_view) TextView mSubmitTextView; @BindView(R.id.variable_screen_submit_text_view) TextView mSubmitTextView;
@BindView(R.id.variable_screen_empty_text_view) TextView mEmptyTextView;
@BindView(R.id.variable_screen_container_layout) LinearLayout mContainerLayout; @BindView(R.id.variable_screen_container_layout) LinearLayout mContainerLayout;
@BindView(R.id.variable_screen_main_layout) LinearLayout mMainLayout;
@BindView(R.id.variable_screen_bottom_layout) RelativeLayout mBottomLayout; @BindView(R.id.variable_screen_bottom_layout) RelativeLayout mBottomLayout;
private List<CatalogueVariable> mCatalogueVariableList; private List<CatalogueVariable> mCatalogueVariableList;
private JSONArray mJsonArray; private JSONArray mJsonArray;
private CatalogueApplication mApplication; private CatalogueApplication mApplication;
private String mCatalogueItemSysId, mCatalogueItemDescription, mCatalogueItemTitle; private String mCatalogueItemSysId, mCatalogueItemDescription, mCatalogueItemShortDescription, mCatalogueItemTitle;
@Override @Override
protected void onCreate(Bundle savedInstanceState) { protected void onCreate(Bundle savedInstanceState) {
...@@ -91,6 +91,7 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -91,6 +91,7 @@ public class CatalogueVariableScreen extends AppCompatActivity {
if (extras != null) { if (extras != null) {
mCatalogueItemSysId = extras.getString(Constants.DATA_KEY_SYS_ID); mCatalogueItemSysId = extras.getString(Constants.DATA_KEY_SYS_ID);
mCatalogueItemDescription = extras.getString(Constants.DATA_KEY_CATALOGUE_ITEM_DESCRIPTION); mCatalogueItemDescription = extras.getString(Constants.DATA_KEY_CATALOGUE_ITEM_DESCRIPTION);
mCatalogueItemShortDescription = extras.getString(Constants.DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION);
mCatalogueItemTitle = extras.getString(Constants.DATA_KEY_CATALOGUE_TITLE); mCatalogueItemTitle = extras.getString(Constants.DATA_KEY_CATALOGUE_TITLE);
//The key argument here must match that used in the other activity //The key argument here must match that used in the other activity
} }
...@@ -200,8 +201,23 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -200,8 +201,23 @@ public class CatalogueVariableScreen extends AppCompatActivity {
LinearLayout.LayoutParams.WRAP_CONTENT); LinearLayout.LayoutParams.WRAP_CONTENT);
/*Added item Description in form*/ /*Added item Description in form*/
if(!mCatalogueItemShortDescription.isEmpty()) {
TextView shortDescriptionView = new TextView(CatalogueVariableScreen.this);
shortDescriptionView.setPadding(0, 0, 0, (int)getResources().getDimension(R.dimen.normal_margin));
shortDescriptionView.setTypeface(null, Typeface.BOLD);
shortDescriptionView.setMovementMethod(LinkMovementMethod.getInstance());
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
shortDescriptionView.setText(Html.fromHtml(mCatalogueItemShortDescription, Html.FROM_HTML_MODE_LEGACY));
} else {
shortDescriptionView.setText(Html.fromHtml(mCatalogueItemShortDescription));
}
mContainerLayout.addView(shortDescriptionView, childControlViewLayoutParams);
}
if(!mCatalogueItemDescription.isEmpty()) { if(!mCatalogueItemDescription.isEmpty()) {
TextView descriptionView = new TextView(CatalogueVariableScreen.this); TextView descriptionView = new TextView(CatalogueVariableScreen.this);
descriptionView.setMovementMethod(LinkMovementMethod.getInstance());
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) { if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.N) {
descriptionView.setText(Html.fromHtml(mCatalogueItemDescription, Html.FROM_HTML_MODE_LEGACY)); descriptionView.setText(Html.fromHtml(mCatalogueItemDescription, Html.FROM_HTML_MODE_LEGACY));
} else { } else {
...@@ -211,17 +227,10 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -211,17 +227,10 @@ public class CatalogueVariableScreen extends AppCompatActivity {
mContainerLayout.addView(descriptionView, childControlViewLayoutParams); mContainerLayout.addView(descriptionView, childControlViewLayoutParams);
} }
if(mCatalogueVariableList.isEmpty()) {
mEmptyTextView.setVisibility(View.VISIBLE);
mMainLayout.setVisibility(View.GONE);
} else {
mEmptyTextView.setVisibility(View.GONE);
mMainLayout.setVisibility(View.VISIBLE);
for (int i = 0; i < mCatalogueVariableList.size(); i++) { for (int i = 0; i < mCatalogueVariableList.size(); i++) {
CatalogueVariable catalogueVariable = mCatalogueVariableList.get(i); CatalogueVariable catalogueVariable = mCatalogueVariableList.get(i);
ViewType viewType = catalogueVariable.getType(); ViewType viewType = catalogueVariable.getType();
CatalogueLog.e("viewType: " + viewType + ", Order: "+catalogueVariable.getOrder()); CatalogueLog.e("viewType: " + viewType + ", Question: "+catalogueVariable.getQuestionText() + ", Order: "+catalogueVariable.getOrder());
if (catalogueVariable.getName() == null) { if (catalogueVariable.getName() == null) {
TextView nameNullView = new TextView(CatalogueVariableScreen.this); TextView nameNullView = new TextView(CatalogueVariableScreen.this);
nameNullView.setText(R.string.name_null_view_string); nameNullView.setText(R.string.name_null_view_string);
...@@ -232,8 +241,8 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -232,8 +241,8 @@ public class CatalogueVariableScreen extends AppCompatActivity {
(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); mContainerLayout.addView(nameNullView, childLabelViewLayoutParams);
} else if(viewType != ViewType.CONTAINER_START && viewType != ViewType.CONTAINER_END && viewType != ViewType.CONTAINER_SPLIT) { } else if(viewType != ViewType.MACRO && viewType != ViewType.CONTAINER_START && viewType != ViewType.CONTAINER_END && viewType != ViewType.CONTAINER_SPLIT) {
/*For 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()) {
...@@ -295,7 +304,6 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -295,7 +304,6 @@ public class CatalogueVariableScreen extends AppCompatActivity {
} }
} }
} }
}
private View getErrorView() { private View getErrorView() {
TextView textView = new TextView(CatalogueVariableScreen.this); TextView textView = new TextView(CatalogueVariableScreen.this);
...@@ -454,8 +462,10 @@ public class CatalogueVariableScreen extends AppCompatActivity { ...@@ -454,8 +462,10 @@ public class CatalogueVariableScreen extends AppCompatActivity {
}; };
FragmentManager fm = getSupportFragmentManager(); FragmentManager fm = getSupportFragmentManager();
TagObject tagObject = (TagObject)v.getTag(); TagObject tagObject = (TagObject)v.getTag();
String tableName = mCatalogueVariableList.get(tagObject.getIndex()).getReferenceTable(); CatalogueVariable catalogueVariable = mCatalogueVariableList.get(tagObject.getIndex());
SelectReferenceDialog spinnerDialog = SelectReferenceDialog.newInstance(tableName); String tableName = catalogueVariable.getReferenceTable();
String title = catalogueVariable.getQuestionText();
SelectReferenceDialog spinnerDialog = SelectReferenceDialog.newInstance(tableName, title);
spinnerDialog.setListener(listener); spinnerDialog.setListener(listener);
spinnerDialog.show(fm, ""); spinnerDialog.show(fm, "");
return true; return true;
......
...@@ -25,7 +25,9 @@ public class Constants { ...@@ -25,7 +25,9 @@ public class Constants {
public static final String DATA_KEY_SYS_ID = "sys_id"; public static final String DATA_KEY_SYS_ID = "sys_id";
public static final String DATA_KEY_CATALOGUE_TITLE = "catalogue_title"; public static final String DATA_KEY_CATALOGUE_TITLE = "catalogue_title";
public static final String DATA_KEY_CATALOGUE_ITEM_DESCRIPTION = "catalogue_item_des"; public static final String DATA_KEY_CATALOGUE_ITEM_DESCRIPTION = "catalogue_item_des";
public static final String DATA_KEY_CATALOGUE_ITEM_SHORT_DESCRIPTION = "catalogue_item_short_des";
public static final String DATA_KEY_REFERENCE_TABLE_NAME = "table_name"; public static final String DATA_KEY_REFERENCE_TABLE_NAME = "table_name";
public static final String DATA_KEY_REFERENCE_TITLE = "title";
/** /**
* Catalogue services post parameters * Catalogue services post parameters
......
package com.vsoft.uoflservicenow.utils; package com.vsoft.uoflservicenow.utils;
import android.content.Context; import android.content.Context;
import android.net.ConnectivityManager; import android.graphics.Typeface;
import android.net.NetworkInfo;
import android.support.v4.content.ContextCompat; import android.support.v4.content.ContextCompat;
import android.text.InputType; import android.text.InputType;
import android.text.method.PasswordTransformationMethod; import android.text.method.PasswordTransformationMethod;
...@@ -111,9 +110,21 @@ public class Util { ...@@ -111,9 +110,21 @@ public class Util {
referenceEditText.setCompoundDrawablesWithIntrinsicBounds(0, 0, android.R.drawable.ic_menu_search, 0); referenceEditText.setCompoundDrawablesWithIntrinsicBounds(0, 0, android.R.drawable.ic_menu_search, 0);
return referenceEditText; return referenceEditText;
case LABEL: case LABEL:
LinearLayout labelLayout = new LinearLayout(context);
labelLayout.setOrientation(LinearLayout.VERTICAL);
TextView labelTextView = new TextView(context); TextView labelTextView = new TextView(context);
labelTextView.setText(catalogueVariable.getQuestionText()); labelTextView.setText(catalogueVariable.getQuestionText());
return labelTextView; labelTextView.setTypeface(null, Typeface.BOLD);
labelLayout.addView(labelTextView);
View view = new View(context);
view.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1));
view.setBackgroundColor(ContextCompat.getColor(context, android.R.color.black));
labelLayout.addView(view);
labelLayout.setPadding(0, 0, 0, (int)context.getResources().getDimension(R.dimen.small_margin));
return labelLayout;
case MASKED: case MASKED:
EditText maskedEditText = new EditText(context); EditText maskedEditText = new EditText(context);
maskedEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD); maskedEditText.setInputType(InputType.TYPE_TEXT_VARIATION_PASSWORD);
...@@ -154,10 +165,10 @@ public class Util { ...@@ -154,10 +165,10 @@ public class Util {
selectBoxSpinner.setAdapter(selectBoxSpinnerArrayAdapter); selectBoxSpinner.setAdapter(selectBoxSpinnerArrayAdapter);
return selectBoxSpinner; return selectBoxSpinner;
case BREAK: case BREAK:
View view = new View(context); View breakView = new View(context);
view.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1)); breakView.setLayoutParams(new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 1));
view.setBackgroundColor(ContextCompat.getColor(context, android.R.color.black)); breakView.setBackgroundColor(ContextCompat.getColor(context, android.R.color.black));
return view; return breakView;
} }
return null; return null;
} }
......
...@@ -19,26 +19,12 @@ ...@@ -19,26 +19,12 @@
app:contentInsetRight="0dp" app:contentInsetRight="0dp"
app:contentInsetStart="0dp" /> app:contentInsetStart="0dp" />
<FrameLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/variable_screen_empty_text_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:text="@string/no_variables_string"
android:textSize="@dimen/extra_normal_text_size" />
<LinearLayout <LinearLayout
android:id="@+id/variable_screen_main_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@color/screen_bg_color" android:background="@color/screen_bg_color"
android:orientation="vertical" android:orientation="vertical"
android:padding="@dimen/normal_margin" android:padding="@dimen/normal_margin">
android:visibility="gone">
<ScrollView <ScrollView
android:layout_width="match_parent" android:layout_width="match_parent"
...@@ -63,7 +49,8 @@ ...@@ -63,7 +49,8 @@
android:id="@+id/variable_screen_bottom_layout" android:id="@+id/variable_screen_bottom_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:gravity="center_vertical"> android:gravity="center_vertical"
android:visibility="gone">
<TextView <TextView
android:id="@+id/variable_screen_submit_text_view" android:id="@+id/variable_screen_submit_text_view"
...@@ -96,5 +83,4 @@ ...@@ -96,5 +83,4 @@
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>
</LinearLayout> </LinearLayout>
</FrameLayout>
</LinearLayout> </LinearLayout>
\ No newline at end of file
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
android:layout_gravity="center" android:layout_gravity="center"
android:paddingBottom="@dimen/normal_margin" android:paddingBottom="@dimen/normal_margin"
android:paddingTop="@dimen/normal_margin" android:paddingTop="@dimen/normal_margin"
android:text="@string/search_for_reference_string"
android:textSize="@dimen/large_text_size"/> android:textSize="@dimen/large_text_size"/>
<View <View
......
...@@ -44,7 +44,9 @@ ...@@ -44,7 +44,9 @@
<string name="login_screen_password_string">Password</string> <string name="login_screen_password_string">Password</string>
<string name="login_screen_login_string">Login</string> <string name="login_screen_login_string">Login</string>
<!--Variable Screen-->
<string name="variable_form_misc_info_string">%1$s [add %2$s]</string> <string name="variable_form_misc_info_string">%1$s [add %2$s]</string>
<string name="variable_form_reference_dialog_title_string">Search \'%s\'</string>
<!--Catalogue Item Screen--> <!--Catalogue Item Screen-->
<string name="no_catalogue_item_string">No Catalogue Items&#8230;</string> <string name="no_catalogue_item_string">No Catalogue Items&#8230;</string>
......
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