|
|
@@ -3,6 +3,7 @@ package com.xzjmyk.pm.activity.ui.erp.activity.datainquiry.adapter;
|
|
|
import android.app.Activity;
|
|
|
import android.content.Context;
|
|
|
import android.text.Editable;
|
|
|
+import android.text.TextUtils;
|
|
|
import android.text.TextWatcher;
|
|
|
import android.view.LayoutInflater;
|
|
|
import android.view.View;
|
|
|
@@ -180,12 +181,15 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
|
|
|
break;
|
|
|
case "D":
|
|
|
case "CD":
|
|
|
+ case "YM":
|
|
|
+ case "YMV":
|
|
|
holder.stringEdittext.setVisibility(View.GONE);
|
|
|
holder.numEdittextLl.setVisibility(View.GONE);
|
|
|
holder.textviewLl.setVisibility(View.VISIBLE);
|
|
|
holder.gridview.setVisibility(View.GONE);
|
|
|
|
|
|
mProperties = object.getProperties();
|
|
|
+ String type = object.getType();
|
|
|
|
|
|
if (mProperties != null && mProperties.size() == 2) {
|
|
|
holder.textview1.setText(mProperties.get(0).getDisplay());
|
|
|
@@ -197,10 +201,12 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
|
|
|
public void onClick(View v) {
|
|
|
String time1 = holder.textview1.getText().toString();
|
|
|
String[] times1 = time1.split("-");
|
|
|
- if (times1.length >= 3) {
|
|
|
- showDateDialog(times1[0], times1[1], times1[2], holder.textview1, object, 0);
|
|
|
+ if (("YM".equals(type) || "YMV".equals(type)) && time1.length() == 6) {
|
|
|
+ showDateDialog(time1.substring(0, 4), time1.substring(4, 6), null, holder.textview1, type, object, 0);
|
|
|
+ } else if (times1.length >= 3) {
|
|
|
+ showDateDialog(times1[0], times1[1], times1[2], holder.textview1, type, object, 0);
|
|
|
} else {
|
|
|
- showDateDialog(null, null, null, holder.textview1, object, 0);
|
|
|
+ showDateDialog(null, null, null, holder.textview1, type, object, 0);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -210,10 +216,12 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
|
|
|
public void onClick(View v) {
|
|
|
String time2 = holder.textview2.getText().toString();
|
|
|
String[] times2 = time2.split("-");
|
|
|
- if (times2.length >= 3) {
|
|
|
- showDateDialog(times2[0], times2[1], times2[2], holder.textview2, object, 1);
|
|
|
+ if (("YM".equals(type) || "YMV".equals(type)) && time2.length() == 6) {
|
|
|
+ showDateDialog(time2.substring(0, 4), time2.substring(4, 6), null, holder.textview2, type, object, 1);
|
|
|
+ } else if (times2.length >= 3) {
|
|
|
+ showDateDialog(times2[0], times2[1], times2[2], holder.textview2, type, object, 1);
|
|
|
} else {
|
|
|
- showDateDialog(null, null, null, holder.textview2, object, 1);
|
|
|
+ showDateDialog(null, null, null, holder.textview2, type, object, 1);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -223,10 +231,12 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
|
|
|
public void onClick(View v) {
|
|
|
String time1 = holder.textview1.getText().toString();
|
|
|
String[] times1 = time1.split("-");
|
|
|
- if (times1.length >= 3) {
|
|
|
- showDateDialog(times1[0], times1[1], times1[2], holder.textview1, object, 0);
|
|
|
+ if (("YM".equals(type) || "YMV".equals(type)) && time1.length() == 6) {
|
|
|
+ showDateDialog(time1.substring(0, 4), time1.substring(4, 6), null, holder.textview1, type, object, 0);
|
|
|
+ } else if (times1.length >= 3) {
|
|
|
+ showDateDialog(times1[0], times1[1], times1[2], holder.textview1, type, object, 0);
|
|
|
} else {
|
|
|
- showDateDialog(null, null, null, holder.textview1, object, 0);
|
|
|
+ showDateDialog(null, null, null, holder.textview1, type, object, 0);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -236,10 +246,12 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
|
|
|
public void onClick(View v) {
|
|
|
String time2 = holder.textview2.getText().toString();
|
|
|
String[] times2 = time2.split("-");
|
|
|
- if (times2.length >= 3) {
|
|
|
- showDateDialog(times2[0], times2[1], times2[2], holder.textview2, object, 1);
|
|
|
+ if (("YM".equals(type) || "YMV".equals(type)) && time2.length() == 6) {
|
|
|
+ showDateDialog(time2.substring(0, 4), time2.substring(4, 6), null, holder.textview2, type, object, 1);
|
|
|
+ } else if (times2.length >= 3) {
|
|
|
+ showDateDialog(times2[0], times2[1], times2[2], holder.textview2, type, object, 1);
|
|
|
} else {
|
|
|
- showDateDialog(null, null, null, holder.textview2, object, 1);
|
|
|
+ showDateDialog(null, null, null, holder.textview2, type, object, 1);
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
@@ -369,18 +381,32 @@ public class DataInquirySchemeConditionAdapter extends BaseAdapter {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- private void showDateDialog(String year, String month, String day, final TextView tv, SchemeConditionBean object, int i) {
|
|
|
- OASigninPicker picker = new OASigninPicker((Activity) context, 2000, 2030);
|
|
|
+ private void showDateDialog(String year, String month, String day, final TextView tv, String type, SchemeConditionBean object, int i) {
|
|
|
+ boolean haveDay = true;
|
|
|
+ if (("YM".equals(type) || "YMV".equals(type))) {
|
|
|
+ haveDay = false;
|
|
|
+ }
|
|
|
+ OASigninPicker picker = new OASigninPicker((Activity) context, 2000, 2030, haveDay);
|
|
|
picker.setRange(2030, 12, 31);
|
|
|
try {
|
|
|
- picker.setSelectedItem(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
|
|
|
+ if (haveDay && !TextUtils.isEmpty(day))
|
|
|
+ picker.setSelectedItem(Integer.parseInt(year), Integer.parseInt(month), Integer.parseInt(day));
|
|
|
+ else
|
|
|
+ picker.setSelectedItem(Integer.parseInt(year), Integer.parseInt(month));
|
|
|
} catch (Exception e) {
|
|
|
- picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
|
|
|
+ if (haveDay)
|
|
|
+ picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth(), CalendarUtil.getDay());
|
|
|
+ else
|
|
|
+ picker.setSelectedItem(CalendarUtil.getYear(), CalendarUtil.getMonth());
|
|
|
}
|
|
|
+
|
|
|
picker.setOnDateTimePickListener(new OASigninPicker.OnDateTimePickListener() {
|
|
|
@Override
|
|
|
public void setTime(String year, String month, String day) {
|
|
|
String time = year + "-" + month + "-" + day;
|
|
|
+ if (TextUtils.isEmpty(day)) {
|
|
|
+ time = year + month;
|
|
|
+ }
|
|
|
tv.setText(time);
|
|
|
if (object.getProperties().size() == 2) {
|
|
|
object.getProperties().get(i).setDisplay(time);
|