Commit 46685956 by Kunj Gupta

Added some hard code sys_id for HRCase, Fixed app is crashing.

parent feac4b31
...@@ -21,16 +21,35 @@ import java.util.List; ...@@ -21,16 +21,35 @@ import java.util.List;
*/ */
public class HRCaseCategoryAdapter extends BaseAdapter { public class HRCaseCategoryAdapter extends BaseAdapter {
private final List<HRCase> mHRCaseList = new ArrayList<>(0); private final List<HRCase> mHRCaseList = new ArrayList<>(0);
private String[] hardCodedHRCase = new String[3];
private LayoutInflater mInflater; private LayoutInflater mInflater;
private Context mContext; private Context mContext;
public HRCaseCategoryAdapter(Context context) { public HRCaseCategoryAdapter(Context context) {
mContext = context; mContext = context;
mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE); mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
hardCodedHRCase = context.getResources().getStringArray(R.array.hard_code_hr_case_sys_id);
} }
public void setHRCaseList(List<HRCase> hrCaseList) { public void setHRCaseList(List<HRCase> hrCaseList) {
mHRCaseList.clear(); mHRCaseList.clear();
for (int i = 0; i < hrCaseList.size(); i++) {
String sysId = hrCaseList.get(i).getSysId();
boolean isDelete = false;
for (int j = 0; j < hardCodedHRCase.length; j++) {
String hardCodeSysId = hardCodedHRCase[j];
if(hardCodeSysId == null || hardCodeSysId.equals(sysId)) {
isDelete = false;
break;
} else {
isDelete = true;
}
}
if(isDelete) {
hrCaseList.remove(i);
}
}
if(hrCaseList!=null) if(hrCaseList!=null)
mHRCaseList.addAll(hrCaseList); mHRCaseList.addAll(hrCaseList);
notifyDataSetChanged(); notifyDataSetChanged();
...@@ -73,7 +92,7 @@ public class HRCaseCategoryAdapter extends BaseAdapter { ...@@ -73,7 +92,7 @@ public class HRCaseCategoryAdapter extends BaseAdapter {
HRCase hrCase = mHRCaseList.get(position); HRCase hrCase = mHRCaseList.get(position);
holder.titleTextView.setText(hrCase.getTitle()); holder.titleTextView.setText(hrCase.getTitle());
if(hrCase.getDescription() != null && !hrCase.getDescription().isEmpty()) { if (hrCase.getDescription() != null && !hrCase.getDescription().isEmpty()) {
holder.desTextView.setVisibility(View.VISIBLE); holder.desTextView.setVisibility(View.VISIBLE);
holder.desTextView.setText(hrCase.getDescription()); holder.desTextView.setText(hrCase.getDescription());
} else { } else {
...@@ -81,7 +100,7 @@ public class HRCaseCategoryAdapter extends BaseAdapter { ...@@ -81,7 +100,7 @@ public class HRCaseCategoryAdapter extends BaseAdapter {
holder.desTextView.setText(hrCase.getDescription()); holder.desTextView.setText(hrCase.getDescription());
} }
if(hrCase.getIcon() != null && !hrCase.getIcon().isEmpty()) { if (hrCase.getIcon() != null && !hrCase.getIcon().isEmpty()) {
holder.image.setVisibility(View.VISIBLE); holder.image.setVisibility(View.VISIBLE);
StringBuilder builder = new StringBuilder(); StringBuilder builder = new StringBuilder();
builder.append(Constants.DOMAIN); builder.append(Constants.DOMAIN);
...@@ -92,7 +111,6 @@ public class HRCaseCategoryAdapter extends BaseAdapter { ...@@ -92,7 +111,6 @@ public class HRCaseCategoryAdapter extends BaseAdapter {
holder.image.setVisibility(View.INVISIBLE); holder.image.setVisibility(View.INVISIBLE);
} }
return convertView; return convertView;
} }
......
...@@ -112,7 +112,9 @@ public class HRCaseVariableManager implements DBConstants { ...@@ -112,7 +112,9 @@ public class HRCaseVariableManager implements DBConstants {
continue; continue;
} }
if (!localCatalogueVariable.getQuestionText().equals(serverCatalogueVariable.getQuestionText())) { if (localCatalogueVariable.getQuestionText() != null
&& serverCatalogueVariable.getQuestionText() != null
&& !localCatalogueVariable.getQuestionText().equals(serverCatalogueVariable.getQuestionText())) {
hasChanged = true; hasChanged = true;
continue; continue;
} }
......
...@@ -1225,6 +1225,7 @@ public class HRCaseVariableScreen extends HandleNotificationActivity { ...@@ -1225,6 +1225,7 @@ public class HRCaseVariableScreen extends HandleNotificationActivity {
if(container.getErrorView()==null) { if(container.getErrorView()==null) {
TextView errorView = Util.getErrorView(HRCaseVariableScreen.this); TextView errorView = Util.getErrorView(HRCaseVariableScreen.this);
container.setErrorView(errorView); container.setErrorView(errorView);
if(container.getContainerView() != null)
container.getContainerView().addView(errorView); container.getContainerView().addView(errorView);
} }
variable.setMandatory(true); variable.setMandatory(true);
...@@ -1232,15 +1233,19 @@ public class HRCaseVariableScreen extends HandleNotificationActivity { ...@@ -1232,15 +1233,19 @@ public class HRCaseVariableScreen extends HandleNotificationActivity {
} }
if (action.getVisible().equals(Boolean.toString(true))) { if (action.getVisible().equals(Boolean.toString(true))) {
if(container.getContainerView() != null)
container.getContainerView().setVisibility(View.GONE); container.getContainerView().setVisibility(View.GONE);
} else if (action.getVisible().equals(Boolean.toString(false))) { } else if (action.getVisible().equals(Boolean.toString(false))) {
if(container.getContainerView() != null)
container.getContainerView().setVisibility(View.VISIBLE); container.getContainerView().setVisibility(View.VISIBLE);
runUIPolicyActions(variable.getSysId()); runUIPolicyActions(variable.getSysId());
} }
if (action.getDisabled().equals(Boolean.toString(true))) { if (action.getDisabled().equals(Boolean.toString(true))) {
if(container.getContainerView() != null)
container.getContainerView().setEnabled(false); container.getContainerView().setEnabled(false);
} else if (action.getDisabled().equals(Boolean.toString(false))) { } else if (action.getDisabled().equals(Boolean.toString(false))) {
if(container.getContainerView() != null)
container.getContainerView().setEnabled(true); container.getContainerView().setEnabled(true);
} }
} }
......
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="hard_code_hr_case_sys_id">
<item>0b724f4e4fcd3200412a60001310c71c</item>
<item>2d4bb88e4f4a020020280ea28110c7f9</item>
<item>2d6b51924f8286005e1a3d728110c74a</item>
</string-array>
</resources>
\ No newline at end of file
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