|
|
@@ -14,7 +14,7 @@ import android.widget.BaseAdapter;
|
|
|
import android.widget.EditText;
|
|
|
import android.widget.ImageView;
|
|
|
import android.widget.LinearLayout;
|
|
|
-import android.widget.ListView;
|
|
|
+import android.widget.RelativeLayout;
|
|
|
import android.widget.TextView;
|
|
|
import android.widget.Toast;
|
|
|
|
|
|
@@ -33,6 +33,7 @@ import com.xzjmyk.pm.activity.ui.erp.util.Constants;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.JsonValidator;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.ListUtils;
|
|
|
import com.xzjmyk.pm.activity.ui.erp.util.LogUtil;
|
|
|
+import com.xzjmyk.pm.activity.ui.erp.view.ListViewInScroller;
|
|
|
import com.xzjmyk.pm.activity.util.StringUtils;
|
|
|
|
|
|
import java.util.ArrayList;
|
|
|
@@ -50,7 +51,7 @@ import java.util.Map;
|
|
|
public class DataFormDetailActivity extends BaseActivity {
|
|
|
|
|
|
@ViewInject(R.id.lv_datas)
|
|
|
- private ListView lv_datas;
|
|
|
+ private ListViewInScroller lv_datas;
|
|
|
private String caller="";
|
|
|
|
|
|
private DataAdapter mAdapter;
|
|
|
@@ -108,17 +109,21 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
data.setIsDefault(items.getIntValue("mfd_isdefault"));
|
|
|
data.setIsNeed(items.getIntValue("mfd_isdefault"));
|
|
|
data.setType(items.getString("fd_type"));
|
|
|
- if(!StringUtils.isEmpty(value)){
|
|
|
- if (value.equals(items.getString("fd_group"))){
|
|
|
- itemData.add(data);
|
|
|
- }
|
|
|
- }else{
|
|
|
+// if(!StringUtils.isEmpty(value)){
|
|
|
+// if (value.equals(items.getString("fd_group"))){
|
|
|
+ // itemData.add(data);
|
|
|
+// }
|
|
|
+// }else{
|
|
|
itemData.add(data);
|
|
|
- }
|
|
|
+// }
|
|
|
|
|
|
|
|
|
}
|
|
|
- groupData.setName(value);
|
|
|
+ if (!StringUtils.isEmpty(value)){
|
|
|
+ groupData.setName(value);
|
|
|
+ }else{
|
|
|
+ groupData.setName(null);
|
|
|
+ }
|
|
|
groupData.setDatas(itemData);
|
|
|
mDatas.add(groupData);//添加分组
|
|
|
System.out.println(value);
|
|
|
@@ -126,7 +131,10 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
}
|
|
|
|
|
|
if (!ListUtils.isEmpty(grids)){
|
|
|
+ GroupData groupData=new GroupData();//分组
|
|
|
+ ArrayList<Data> itemData=new ArrayList<>();
|
|
|
for(int i=0;i<grids.size();i++){
|
|
|
+
|
|
|
JSONObject items=grids.getJSONObject(i);
|
|
|
Data data=new Data();
|
|
|
data.setName(items.getString("dg_caption"));
|
|
|
@@ -136,8 +144,11 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
data.setIsDefault(items.getIntValue("mdg_isdefault"));
|
|
|
data.setIsNeed(items.getIntValue("mdg_isdefault"));
|
|
|
data.setType(items.getString("dg_type"));
|
|
|
- datas.add(data);
|
|
|
+ itemData.add(data);
|
|
|
}
|
|
|
+ groupData.setDatas(itemData);
|
|
|
+ groupData.setName("明细项");
|
|
|
+ mDatas.add(groupData);
|
|
|
}
|
|
|
|
|
|
if(mAdapter==null) {
|
|
|
@@ -159,7 +170,7 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
setContentView(R.layout.activity_data_form_detail);
|
|
|
initView();
|
|
|
initListener();
|
|
|
- caller="Ask4Leave";
|
|
|
+ caller="Workovertime";//Workovertime
|
|
|
initData();
|
|
|
|
|
|
|
|
|
@@ -435,7 +446,7 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
* @author:Arison on 2016/11/15
|
|
|
*/
|
|
|
|
|
|
- public boolean isLastItem(int position){
|
|
|
+ public boolean isGroupLastItem(int position){
|
|
|
boolean falg=false;
|
|
|
// 异常情况处理
|
|
|
if (null == mListData || position < 0|| position > getCount()) {
|
|
|
@@ -461,6 +472,41 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
return falg;
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * @desc:判断是否是最后一个元素
|
|
|
+ * @author:Arison on 2016/11/15
|
|
|
+ */
|
|
|
+
|
|
|
+ public boolean isLastItem(int position){
|
|
|
+ boolean falg=false;
|
|
|
+ // 异常情况处理
|
|
|
+ if (null == mListData || position < 0|| position > getCount()) {
|
|
|
+ return falg;
|
|
|
+ }
|
|
|
+ int categroyFirstIndex = 0;
|
|
|
+ for (int i=0;i<mListData.size();i++) {
|
|
|
+ int size = mListData.get(i).getItemCount();
|
|
|
+ if (i==mListData.size()-1){
|
|
|
+
|
|
|
+ // 在当前分类中的索引值
|
|
|
+ int categoryIndex = position - categroyFirstIndex;
|
|
|
+ // item在当前分类内
|
|
|
+ if (categoryIndex < size) {
|
|
|
+ if (categoryIndex==size-1){
|
|
|
+ return true;
|
|
|
+ }else{
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ // 索引移动到当前分类结尾,即下一个分类第一个元素索引
|
|
|
+
|
|
|
+ }
|
|
|
+ categroyFirstIndex += size;
|
|
|
+ }
|
|
|
+
|
|
|
+ return falg;
|
|
|
+ }
|
|
|
+
|
|
|
@Override
|
|
|
public int getViewTypeCount() {
|
|
|
return 2;
|
|
|
@@ -481,10 +527,14 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
}
|
|
|
TextView textView = (TextView) convertView.findViewById(R.id.tv_title);
|
|
|
ImageView item_add=(ImageView)convertView.findViewById(R.id.iv_item_add);
|
|
|
+ RelativeLayout header= (RelativeLayout) convertView.findViewById(R.id.rl_item_header);
|
|
|
final String itemValue = (String) getItem(position);
|
|
|
textView.setText( itemValue );
|
|
|
if (StringUtils.isEmpty(itemValue)){
|
|
|
- convertView.setVisibility(View.GONE);
|
|
|
+// LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, 0);
|
|
|
+// lp.height=CommonUtil.convertPx2Dip(ct,1);
|
|
|
+// header.setLayoutParams(lp);
|
|
|
+ header.setVisibility(View.GONE);
|
|
|
}
|
|
|
//添加子item的事件监听
|
|
|
item_add.setOnClickListener(new View.OnClickListener() {
|
|
|
@@ -504,18 +554,24 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
model.ll_moment= (LinearLayout) convertView.findViewById(R.id.ll_moment);
|
|
|
convertView.setTag(model);
|
|
|
}else{
|
|
|
+ //缓存问题
|
|
|
//model= (ViewModel) convertView.getTag();
|
|
|
}
|
|
|
|
|
|
- Data data= (Data) getItem(position);
|
|
|
- if (isLastItem(position)){
|
|
|
- Toast.makeText(ct,"最后一行:"+data.getName(),Toast.LENGTH_LONG).show();
|
|
|
+ final Data data=(Data) getItem(position);
|
|
|
+ if (isGroupLastItem(position)){
|
|
|
+// Toast.makeText(ct,"最后一行:"+data.getName(),Toast.LENGTH_LONG).show();
|
|
|
// model.ll_moment.setBottom(CommonUtil.convertDip2Px(ct,10));
|
|
|
LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
|
- lp.setMargins(0, 0, 0, 50);
|
|
|
+ lp.setMargins(0, 0, 0, CommonUtil.convertDip2Px(ct,20));
|
|
|
model.ll_moment.setLayoutParams(lp);
|
|
|
}
|
|
|
|
|
|
+ if (isLastItem(position)){
|
|
|
+ LinearLayout.LayoutParams lp = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MATCH_PARENT, LinearLayout.LayoutParams.WRAP_CONTENT);
|
|
|
+ lp.setMargins(0, 0, 0, CommonUtil.convertDip2Px(ct,50));
|
|
|
+ model.ll_moment.setLayoutParams(lp);
|
|
|
+ }
|
|
|
|
|
|
model.text.setText(data.getName());
|
|
|
//
|
|
|
@@ -541,13 +597,13 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
model.editText.setOnClickListener(new View.OnClickListener() {
|
|
|
@Override
|
|
|
public void onClick(View v) {
|
|
|
- if (mData.get(position).getType().equals("D")){
|
|
|
+ if (data.getType().equals("D")){
|
|
|
CommonUtil.showDateDialog(ct, (EditText) v);
|
|
|
}
|
|
|
- if (mData.get(position).getType().equals("C")){
|
|
|
+ if (data.getType().equals("C")){
|
|
|
HashMap param = new HashMap<>();
|
|
|
param.put("caller", "Ask4Leave");
|
|
|
- param.put("field", mData.get(position).getField());
|
|
|
+ param.put("field", data.getField());
|
|
|
Bundle bundle = new Bundle();
|
|
|
bundle.putSerializable("param", param);
|
|
|
Intent intent = new Intent(ct, SelectActivity.class);
|
|
|
@@ -555,26 +611,26 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
intent.putExtra("reid", R.style.OAThemeMeet);
|
|
|
intent.putExtras(bundle);
|
|
|
intent.putExtra("key", "combdatas");
|
|
|
- intent.putExtra("showKey", mData.get(position).getField());
|
|
|
+ intent.putExtra("showKey", data.getField());
|
|
|
intent.putExtra("action", "mobile/common/getCombo.action");
|
|
|
- intent.putExtra("title", mData.get(position).getName());
|
|
|
+ intent.putExtra("title", data.getName());
|
|
|
intent.putExtra("id",position+1);
|
|
|
- startActivityForResult(intent, mData.get(position).getDetno());
|
|
|
+ startActivityForResult(intent, data.getDetno());
|
|
|
}
|
|
|
|
|
|
- if (mData.get(position).getType().equals("MF")||mData.get(position).getType().equals("SF")){
|
|
|
+ if (data.getType().equals("MF")||data.getType().equals("SF")){
|
|
|
HashMap param = new HashMap<>();
|
|
|
param.put("caller", "Ask4Leave");
|
|
|
param.put("page","1");
|
|
|
param.put("which","form");
|
|
|
param.put("condition","1=1");
|
|
|
param.put("pageSize", "1000");
|
|
|
- param.put("field", mData.get(position).getField());
|
|
|
+ param.put("field", data.getField());
|
|
|
Bundle bundle = new Bundle();
|
|
|
bundle.putSerializable("param", param);
|
|
|
Intent intent = new Intent(ct, SelectActivity.class);
|
|
|
intent.putExtra("type", 1);
|
|
|
- if (mData.get(position).getType().equals("SF")){
|
|
|
+ if (data.getType().equals("SF")){
|
|
|
intent.putExtra("isSingle", true);
|
|
|
}else{
|
|
|
intent.putExtra("isSingle", false);
|
|
|
@@ -583,11 +639,11 @@ public class DataFormDetailActivity extends BaseActivity {
|
|
|
intent.putExtra("reid", R.style.OAThemeMeet);
|
|
|
intent.putExtras(bundle);
|
|
|
intent.putExtra("key", "combdatas");
|
|
|
- intent.putExtra("showKey", mData.get(position).getField());
|
|
|
+ intent.putExtra("showKey", data.getField());
|
|
|
intent.putExtra("action", "common/dbfind.action");
|
|
|
- intent.putExtra("title", mData.get(position).getName());
|
|
|
+ intent.putExtra("title", data.getName());
|
|
|
intent.putExtra("id",position+1);
|
|
|
- startActivityForResult(intent, mData.get(position).getDetno());
|
|
|
+ startActivityForResult(intent, data.getDetno());
|
|
|
}
|
|
|
}
|
|
|
});
|