gongpm 9 жил өмнө
parent
commit
e398b1caa3

+ 2 - 1
WeiChat/src/main/java/com/sk/weichat/ui/calendar/entities/DPInfo.java

@@ -9,7 +9,8 @@ package com.sk.weichat.ui.calendar.entities;
  * @author AigeStudio 2015-03-26
  */
 public class DPInfo {
-    public String strG, strF;
+    public String strG;
+    public String strF;
     public boolean isHoliday;
     public boolean isToday, isWeekend;
     public boolean isSolarTerms, isFestival, isDeferred;

+ 3 - 3
WeiChat/src/main/java/com/sk/weichat/ui/calendar/views/MonthView.java

@@ -574,9 +574,8 @@ public class MonthView extends View {
                     if (mDPMode == DPMode.SINGLE) {
                         cirApr.clear();
                         regions.add(region);
-                        final String date = centerYear + "-" + centerMonth + "-" +
-                                mCManager.obtainDPInfo(centerYear, centerMonth)[i][j].strG;
-
+                        int da = Integer.getInteger(mCManager.obtainDPInfo(centerYear, centerMonth)[i][j].strG);
+                        final String date = centerYear + "-" + (centerMonth < 10 ? "0" + centerMonth : centerMonth) + "-" + (da < 10 ? "0" + da : da);
                         BGCircle circle = createCircle(
                                 region.getBounds().centerX() + indexMonth * width,
                                 region.getBounds().centerY() + indexYear * height);
@@ -611,6 +610,7 @@ public class MonthView extends View {
                                 @Override
                                 public void onAnimationEnd(Animator animation) {
                                     if (null != onDatePickedListener) {
+
                                         datePicker.setMonth(true, date);
                                         if (isTime)
                                             onDatePickedListener.onDatePicked(date + "  " + tim);

+ 195 - 180
WeiChat/src/main/java/com/sk/weichat/ui/erp/activity/NewsTwoActivity.java

@@ -1,10 +1,20 @@
 package com.sk.weichat.ui.erp.activity;
 
-import java.util.Date;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Build;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
@@ -19,185 +29,190 @@ import com.sk.weichat.ui.erp.model.NewsEntity;
 import com.sk.weichat.ui.erp.net.ViewUtil;
 import com.sk.weichat.ui.erp.util.CommonUtil;
 import com.sk.weichat.ui.erp.util.Constants;
-import com.sk.weichat.ui.erp.util.ObjectUtils;
 import com.sk.weichat.ui.erp.view.EmptyLayout;
 
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.PersistableBundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.AdapterView.OnItemClickListener;
-import android.widget.BaseAdapter;
-import android.widget.TextView;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
-  * @author Administrator
-  * @功能:原生界面新闻
-  */
-public class NewsTwoActivity extends BaseActivity{
-	@ViewInject(R.id.list_news)
-	private PullToRefreshListView mlist; 
-	private CardItemAdapter adapter;
-	public EmptyLayout mEmptyLayout;
-	private Context ct;
-
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		initView();
-		initData();
-	}
-
-	public void initView() {
-         setContentView(R.layout.act_news_list);
-		 ct=this;
-         ViewUtils.inject(this);
-         TAG="NewsTwoActivity";
-		 String  mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
-		 // 表示已读
-		 FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_ERP_NEWS);
-
-     	 mEmptyLayout = new EmptyLayout(this, mlist.getRefreshableView());
-    	 mEmptyLayout.setShowEmptyButton(false);
-    	 mEmptyLayout.setShowErrorButton(false);
-    	 mEmptyLayout.setShowLoadingButton(false);
-    	 
+ * @author Administrator
+ * @功能:原生界面新闻
+ */
+public class NewsTwoActivity extends BaseActivity {
+    @ViewInject(R.id.list_news)
+    private PullToRefreshListView mlist;
+    private CardItemAdapter adapter;
+    public EmptyLayout mEmptyLayout;
+    private Context ct;
+
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        initView();
+        initData();
+    }
+
+    public void initView() {
+        setContentView(R.layout.act_news_list);
+        ct = this;
+        ViewUtils.inject(this);
+        TAG = "NewsTwoActivity";
+        String mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
+        // 表示已读
+        FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_ERP_NEWS);
+
+        mEmptyLayout = new EmptyLayout(this, mlist.getRefreshableView());
+        mEmptyLayout.setShowEmptyButton(false);
+        mEmptyLayout.setShowErrorButton(false);
+        mEmptyLayout.setShowLoadingButton(false);
+
         getSupportActionBar().setTitle("新闻");
-         
-         mlist.getRefreshableView().setOnItemClickListener(new OnItemClickListener() {
-
-			@Override
-			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-				CardItemAdapter.ItemModel model=(CardItemAdapter.ItemModel) view.getTag();
-				Intent intent=new Intent(NewsTwoActivity.this, NewsDetailActivity.class);
-				intent.putExtra("id", model.id);
-				startActivity(intent);
-			}
-		});
-         
-	}
-
-	public void initData() {
-		String url=Constants.getAppBaseUrl(ct)+"common/desktop/news/getNews.action";
-        final Map<String,Object> param=new HashMap<>();
+
+        mlist.getRefreshableView().setOnItemClickListener(new OnItemClickListener() {
+
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                CardItemAdapter.ItemModel model = (CardItemAdapter.ItemModel) view.getTag();
+                Intent intent = new Intent(NewsTwoActivity.this, NewsDetailActivity.class);
+                intent.putExtra("id", model.id);
+                startActivity(intent);
+            }
+        });
+
+    }
+
+    public void initData() {
+        String url = Constants.getAppBaseUrl(ct) + "common/desktop/news/getNews.action";
+        final Map<String, Object> param = new HashMap<>();
         param.put("count", 1000);
         param.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
-        LinkedHashMap<String , Object> headers=new LinkedHashMap<>();
-        headers.put("Cookie", "JSESSIONID="+CommonUtil.getSharedPreferences(ct, "sessionId"));
-	    ViewUtil.httpSendRequest(ct, url, param, handler, headers, Constants.LOAD_SUCCESS, null, null, "get");
-	}
-
-	
-	private Handler handler=new Handler(){
-		public void handleMessage(android.os.Message msg) {
-			switch (msg.what) {
-			case Constants.LOAD_SUCCESS:
-				String result=msg.getData().getString("result");
-			    NewsEntity newsEntity=JSON.parseObject(result, NewsEntity.class);
-				if (adapter==null) {
-					adapter=new CardItemAdapter(ct, newsEntity);
-					mlist.getRefreshableView().setAdapter(adapter);
-				}else{
-					adapter.notifyDataSetChanged();
-				}
-				
-				Log.i(TAG, result);
-				break;
-			case Constants.APP_SOCKETIMEOUTEXCEPTION:
-				result=msg.getData().getString("result");
-				Log.i(TAG, result);
-				mEmptyLayout.setErrorMessage(result+",请刷新重试!");
-				mEmptyLayout.showError();
-				ViewUtil.AutoLoginErp(NewsTwoActivity.this, handler);
-				break;
-			default:
-				break;
-			}
-		};
-	};
-	
-	
-	public class CardItemAdapter extends BaseAdapter{
-		
-		private NewsEntity newsEntities;
-		private Context ct;
-		private LayoutInflater inflater;
-		
-		public CardItemAdapter(Context ct,NewsEntity list) {
-          this.ct=ct;
-          this.newsEntities=list;
-          this.inflater=LayoutInflater.from(ct);
-		}
-
-		@Override
-		public int getCount() {
-			return newsEntities==null?0:newsEntities.getData().size();
-			
-		}
-
-		@Override
-		public Object getItem(int position) {
-			return newsEntities.getData().get(position);
-		}
-
-		@Override
-		public long getItemId(int position) {
-			return position;
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent) {
-			ItemModel model=null;
-			if (convertView==null) {
-				convertView=inflater.inflate(R.layout.item_card_notice, parent,false);
-				model=new ItemModel();
-				model.tv_title=(TextView) convertView.findViewById(R.id.tv_title);
-				model.tv_time=(TextView) convertView.findViewById(R.id.tv_time);
-				model.tv_count=(TextView) convertView.findViewById(R.id.tv_count);
-				model.tv_theme=(TextView) convertView.findViewById(R.id.tv_theme);
-				model.tv_author=(TextView) convertView.findViewById(R.id.tv_author);
-				model.tv_hasRead=(TextView)convertView.findViewById(R.id.tv_hasRead);
-				convertView.setTag(model);
-			}else{
-				model=(ItemModel) convertView.getTag();
-			}
-			List<NewsEntity.Data> datas=  newsEntities.getData();
-			model.tv_title.setText(datas.get(position).getNE_THEME());
-			model.tv_time.setText(CommonUtil.transferLongToDate("yyyy-MM-dd HH:mm:ss", datas.get(position).getNE_RELEASEDATE()));
-			model.tv_count.setText(datas.get(position).getNE_BROWSENUMBER()+"");
-			model.tv_theme.setText(datas.get(position).getNE_TYPE());
-			model.tv_author.setText("作者:"+datas.get(position).getNE_RELEASER());
-			model.id=datas.get(position).getNE_ID();
-			if (!ObjectUtils.isEquals(datas.get(position).getSTATUS(),null)){
-			if (((int) datas.get(position).getSTATUS()) != -1) {
-				model.tv_hasRead.setText("未读");
-			} else {
-				if (((int) datas.get(position).getSTATUS()) == -1) {
-					model.tv_hasRead.setText("已读");
-				}
-			}}else{
-				model.tv_hasRead.setText("未读");
-			}
-			return convertView;
-		}
-		
-		
-		class ItemModel{
-			private  int id;
-			private TextView tv_title;
-			private TextView tv_time;
-			private TextView tv_count;
-			private TextView tv_theme;
-			private TextView tv_author;
-			private TextView tv_hasRead;//已读,未读
-		}
-		
-	}
+        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+        ViewUtil.httpSendRequest(ct, url, param, handler, headers, Constants.LOAD_SUCCESS, null, null, "get");
+    }
+
+
+    private Handler handler = new Handler() {
+        public void handleMessage(android.os.Message msg) {
+            switch (msg.what) {
+                case Constants.LOAD_SUCCESS:
+                    String result = msg.getData().getString("result");
+                    NewsEntity newsEntity = JSON.parseObject(result, NewsEntity.class);
+                    if (adapter == null) {
+                        adapter = new CardItemAdapter(ct, newsEntity);
+                        mlist.getRefreshableView().setAdapter(adapter);
+                    } else {
+                        adapter.notifyDataSetChanged();
+                    }
+
+                    Log.i(TAG, result);
+                    break;
+                case Constants.APP_SOCKETIMEOUTEXCEPTION:
+                    result = msg.getData().getString("result");
+                    Log.i(TAG, result);
+                    mEmptyLayout.setErrorMessage(result + ",请刷新重试!");
+                    mEmptyLayout.showError();
+                    ViewUtil.AutoLoginErp(NewsTwoActivity.this, handler);
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        ;
+    };
+
+
+    public class CardItemAdapter extends BaseAdapter {
+
+        private NewsEntity newsEntities;
+        private Context ct;
+        private LayoutInflater inflater;
+
+        public CardItemAdapter(Context ct, NewsEntity list) {
+            this.ct = ct;
+            this.newsEntities = list;
+            this.inflater = LayoutInflater.from(ct);
+        }
+
+        @Override
+        public int getCount() {
+            return newsEntities == null ? 0 : newsEntities.getData().size();
+
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return newsEntities.getData().get(position);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return position;
+        }
+
+        @TargetApi(Build.VERSION_CODES.JELLY_BEAN)
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            ItemModel model = null;
+            if (convertView == null) {
+                convertView = inflater.inflate(R.layout.item_card_notice, parent, false);
+                model = new ItemModel();
+                model.img = (ImageView) convertView.findViewById(R.id.img);
+//				model.tv_title=(TextView) convertView.findViewById(R.id.tv_title);
+                model.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
+//				model.tv_count=(TextView) convertView.findViewById(R.id.tv_count);
+                model.tv_theme = (TextView) convertView.findViewById(R.id.tv_theme);
+                model.tv_author = (TextView) convertView.findViewById(R.id.tv_author);
+//				model.tv_hasRead=(TextView)convertView.findViewById(R.id.tv_hasRead);
+                convertView.setTag(model);
+            } else {
+                model = (ItemModel) convertView.getTag();
+            }
+
+            if (position % 2 == 0) {
+                convertView.setBackgroundColor(getResources().getColor(R.color.item_color1));
+                model.img.setImageResource(R.drawable.notice_img_1);
+            } else {
+                convertView.setBackgroundColor(getResources().getColor(R.color.item_color2));
+                model.img.setImageResource(R.drawable.notice_img_2);
+            }
+            List<NewsEntity.Data> datas = newsEntities.getData();
+//			model.tv_title.setText(datas.get(position).getNE_THEME());
+            model.tv_time.setText(CommonUtil.transferLongToDate("yyyy-MM-dd HH:mm:ss", datas.get(position).getNE_RELEASEDATE()));
+
+//			model.tv_count.setText(datas.get(position).getNE_BROWSENUMBER()+"");
+            model.tv_theme.setText(datas.get(position).getNE_THEME());
+            model.tv_author.setText("作者:" + datas.get(position).getNE_RELEASER());
+            model.id = datas.get(position).getNE_ID();
+
+//			if (!ObjectUtils.isEquals(datas.get(position).getSTATUS(),null)){
+//			if (((int) datas.get(position).getSTATUS()) != -1) {
+//				model.tv_hasRead.setText("未读");
+//			} else {
+//				if (((int) datas.get(position).getSTATUS()) == -1) {
+//					model.tv_hasRead.setText("已读");
+//				}
+//			}}else{
+//				model.tv_hasRead.setText("未读");
+//			}
+            return convertView;
+        }
+
+
+        class ItemModel {
+            private int id;
+            private ImageView img;
+            //			private TextView tv_title;
+            private TextView tv_time;
+            //			private TextView tv_count;
+            private TextView tv_theme;
+            private TextView tv_author;
+//			private TextView tv_hasRead;//已读,未读
+        }
+
+    }
 }

+ 212 - 198
WeiChat/src/main/java/com/sk/weichat/ui/erp/activity/NoticesActivity.java

@@ -1,10 +1,18 @@
 package com.sk.weichat.ui.erp.activity;
 
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import android.content.Context;
+import android.content.Intent;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.AdapterView;
+import android.widget.AdapterView.OnItemClickListener;
+import android.widget.BaseAdapter;
+import android.widget.ImageView;
+import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
@@ -19,209 +27,215 @@ import com.sk.weichat.ui.erp.model.NoticeEntity;
 import com.sk.weichat.ui.erp.net.ViewUtil;
 import com.sk.weichat.ui.erp.util.CommonUtil;
 import com.sk.weichat.ui.erp.util.Constants;
-import com.sk.weichat.ui.erp.util.ObjectUtils;
 import com.sk.weichat.ui.erp.util.StringUtils;
 import com.sk.weichat.ui.erp.view.EmptyLayout;
 
-import android.content.Context;
-import android.content.Intent;
-import android.os.Bundle;
-import android.os.Handler;
-import android.os.PersistableBundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.AdapterView;
-import android.widget.BaseAdapter;
-import android.widget.TextView;
-import android.widget.AdapterView.OnItemClickListener;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
+
 /**
-  * @author Administrator
-  * @功能:通知
-  */
-public class NoticesActivity extends BaseActivity{
-	
-	@ViewInject(R.id.list_notice)
-	private PullToRefreshListView mlist;
-	private EmptyLayout mEmptyLayout;
-	private CardItemAdapter adapter;
-	private int type;
-	private Context ct;
-
-	@Override
-	protected void onCreate(Bundle savedInstanceState) {
-		super.onCreate(savedInstanceState);
-		initView();
-		initData();
-	}
-
-	public void initView() {
-		setContentView(R.layout.act_notice_list);
+ * @author Administrator
+ * @功能:通知
+ */
+public class NoticesActivity extends BaseActivity {
+
+    @ViewInject(R.id.list_notice)
+    private PullToRefreshListView mlist;
+    private EmptyLayout mEmptyLayout;
+    private CardItemAdapter adapter;
+    private int type;
+    private Context ct;
+
+    @Override
+    protected void onCreate(Bundle savedInstanceState) {
+        super.onCreate(savedInstanceState);
+        initView();
+        initData();
+    }
+
+    public void initView() {
+        setContentView(R.layout.act_notice_list);
         ViewUtils.inject(this);
-        TAG="NoticesActivity";
-		ct=this;
+        TAG = "NoticesActivity";
+        ct = this;
         getSupportActionBar().setTitle("通知");
         mEmptyLayout = new EmptyLayout(this, mlist.getRefreshableView());
-   	    mEmptyLayout.setShowEmptyButton(false);
-   	    mEmptyLayout.setShowErrorButton(false);
-   	    mEmptyLayout.setShowLoadingButton(false);
-        
-        type=   getIntent().getIntExtra("type", 0);
+        mEmptyLayout.setShowEmptyButton(false);
+        mEmptyLayout.setShowErrorButton(false);
+        mEmptyLayout.setShowLoadingButton(false);
+
+        type = getIntent().getIntExtra("type", 0);
         mlist.getRefreshableView().setOnItemClickListener(new OnItemClickListener() {
 
-			@Override
-			public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-				CardItemAdapter.ItemModel model=(CardItemAdapter.ItemModel) view.getTag();
-				Intent intent=new Intent(NoticesActivity.this, NewsDetailActivity.class);
-				intent.putExtra("id", model.id);
-				intent.putExtra("type", type);
-				startActivity(intent);
-			}
-		});
-	}
-
-	public void initData() {
-		String url= Constants.getAppBaseUrl(ct)+"common/desktop/note/notice.action";
-        final Map<String,Object> param=new HashMap<>();
+            @Override
+            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
+                CardItemAdapter.ItemModel model = (CardItemAdapter.ItemModel) view.getTag();
+                Intent intent = new Intent(NoticesActivity.this, NewsDetailActivity.class);
+                intent.putExtra("id", model.id);
+                intent.putExtra("type", type);
+                startActivity(intent);
+            }
+        });
+    }
+
+    public void initData() {
+        String url = Constants.getAppBaseUrl(ct) + "common/desktop/note/notice.action";
+        final Map<String, Object> param = new HashMap<>();
         param.put("count", "1000");
         param.put("sessionId", CommonUtil.getSharedPreferences(ct, "sessionId"));
-        if (getIntent().getIntExtra("type", 0)==1) {
-			 url= Constants.getAppBaseUrl(ct)+"common/desktop/note/inform.action";
-			getSupportActionBar().setTitle("通知");
-			String  mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
-			// 表示已读
-			FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_ERP_NOTICE);
-		}else{
-			url= Constants.getAppBaseUrl(ct)+"common/desktop/note/notice.action";
-			getSupportActionBar().setTitle("公告");
-			String  mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
-			// 表示已读
-			FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_ERP_GONGGAO);
-		}
-        LinkedHashMap<String , Object> headers=new LinkedHashMap<>();
-        headers.put("Cookie", "JSESSIONID="+CommonUtil.getSharedPreferences(ct, "sessionId"));
-	    ViewUtil.httpSendRequest(ct, url, param, handler, headers, Constants.LOAD_SUCCESS, null, null, "get");
-	}
-	
-	private Handler handler=new Handler(){
-		public void handleMessage(android.os.Message msg) {
-			switch (msg.what) {
-			case Constants.LOAD_SUCCESS:
-				String result=msg.getData().getString("result");
-			   NoticeEntity newsEntity=JSON.parseObject(result, NoticeEntity.class);
-				if (adapter==null) {
-					String em_id=CommonUtil.getSharedPreferences(ct, "erp_emid");
-					Log.i("User", "em_id="+em_id);
-					List<NoticeEntity.Data> fiterdata=new ArrayList<NoticeEntity.Data>();
-					for (int i = 0; i < newsEntity.getData().size(); i++) {
-						if (newsEntity.getData().get(i).getNO_ISPUBLIC()==0) {
-							if ((!StringUtils.isEmpty(em_id)&&newsEntity.getData().get(i).getNO_RECIPIENTID()!=null)){
-								if (newsEntity.getData().get(i).getNO_RECIPIENTID().toString().contains(em_id)) {
-									fiterdata.add(newsEntity.getData().get(i));
-								}
-							}
-						}else{
-							fiterdata.add(newsEntity.getData().get(i));
-						}
-					}
-					newsEntity.setData(fiterdata);
-					adapter=new CardItemAdapter(ct, newsEntity);
-					mlist.getRefreshableView().setAdapter(adapter);
-				}else{
-					adapter.notifyDataSetChanged();
-				}
-				Log.i(TAG, result);
-				break;
-			case Constants.APP_SOCKETIMEOUTEXCEPTION:
-				 result=msg.getData().getString("result");
-				 Log.i(TAG, result);
-				mEmptyLayout.setErrorMessage(result+",请刷新重试!");
-				mEmptyLayout.showError();
-				ViewUtil.AutoLoginErp(NoticesActivity.this, handler);
-				break;
-			default:
-				break;
-			}
-		};
-	};
-	
-	public class CardItemAdapter extends BaseAdapter{
-		
-		private NoticeEntity newsEntities;
-		private LayoutInflater inflater;
-		
-		public CardItemAdapter(Context ct,NoticeEntity list) {
-          this.newsEntities=list;
-          this.inflater=LayoutInflater.from(ct);
-		}
-
-		@Override
-		public int getCount() {
-			return newsEntities==null?0:newsEntities.getData().size();
-			
-		}
-
-		@Override
-		public Object getItem(int position) {
-			return newsEntities.getData().get(position);
-		}
-
-		@Override
-		public long getItemId(int position) {
-			return position;
-		}
-
-		@Override
-		public View getView(int position, View convertView, ViewGroup parent) {
-			ItemModel model=null;
-			if (convertView==null) {
-				convertView=inflater.inflate(R.layout.item_card_notice, parent,false);
-				model=new ItemModel();
-				model.tv_title=(TextView) convertView.findViewById(R.id.tv_title);
-				model.tv_time=(TextView) convertView.findViewById(R.id.tv_time);
-				model.tv_count=(TextView) convertView.findViewById(R.id.tv_count);
-				model.tv_theme=(TextView) convertView.findViewById(R.id.tv_theme);
-				model.tv_author=(TextView) convertView.findViewById(R.id.tv_author);
-				model.tv_hasRead=(TextView)convertView.findViewById(R.id.tv_hasRead);
-				convertView.setTag(model);
-			}else{
-				model=(ItemModel) convertView.getTag();
-			}
-			List<NoticeEntity.Data> datas=  newsEntities.getData();
-			model.tv_title.setText(datas.get(position).getNO_TITLE());
-			model.tv_time.setText(CommonUtil.transferLongToDate("yyyy-MM-dd HH:mm:ss",
-					datas.get(position).getNO_APPTIME()));
-			model.tv_theme.setText((CharSequence) datas.get(position).getNO_KEYWORD());
-			model.tv_author.setText("作者:"+datas.get(position).getNO_APPROVER());
-			model.id=datas.get(position).getNO_ID();
-			if(!ObjectUtils.isEquals(datas.get(position).getSTATUS(),null)){
-				if (((int)datas.get(position).getSTATUS())!=-1)
-				{
-					model.tv_hasRead.setText("未读");}
-				else{
-					if (((int)datas.get(position).getSTATUS())==-1)
-					{
-						model.tv_hasRead.setText("已读");
-					}
-				}
-			}
-			else{
-				model.tv_hasRead.setText("未读");
-			}
-			model.tv_count.setVisibility(View.GONE);
-			return convertView;
-		}
-		class ItemModel{
-			private  int id;
-			private TextView tv_title;
-			private TextView tv_time;
-			private TextView tv_count;
-			private TextView tv_theme;
-			private TextView tv_author;
-			private TextView tv_hasRead;//已读,未读
-		}
-		
-	}
+        if (getIntent().getIntExtra("type", 0) == 1) {
+            url = Constants.getAppBaseUrl(ct) + "common/desktop/note/inform.action";
+            getSupportActionBar().setTitle("通知");
+            String mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
+            // 表示已读
+            FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_ERP_NOTICE);
+        } else {
+            url = Constants.getAppBaseUrl(ct) + "common/desktop/note/notice.action";
+            getSupportActionBar().setTitle("公告");
+            String mLoginUserId = MyApplication.getInstance().mLoginUser.getUserId();
+            // 表示已读
+            FriendDao.getInstance().markUserMessageRead(mLoginUserId, Friend.ID_ERP_GONGGAO);
+        }
+        LinkedHashMap<String, Object> headers = new LinkedHashMap<>();
+        headers.put("Cookie", "JSESSIONID=" + CommonUtil.getSharedPreferences(ct, "sessionId"));
+        ViewUtil.httpSendRequest(ct, url, param, handler, headers, Constants.LOAD_SUCCESS, null, null, "get");
+    }
+
+    private Handler handler = new Handler() {
+        public void handleMessage(android.os.Message msg) {
+            switch (msg.what) {
+                case Constants.LOAD_SUCCESS:
+                    String result = msg.getData().getString("result");
+                    NoticeEntity newsEntity = JSON.parseObject(result, NoticeEntity.class);
+                    if (adapter == null) {
+                        String em_id = CommonUtil.getSharedPreferences(ct, "erp_emid");
+                        Log.i("User", "em_id=" + em_id);
+                        List<NoticeEntity.Data> fiterdata = new ArrayList<NoticeEntity.Data>();
+                        for (int i = 0; i < newsEntity.getData().size(); i++) {
+                            if (newsEntity.getData().get(i).getNO_ISPUBLIC() == 0) {
+                                if ((!StringUtils.isEmpty(em_id) && newsEntity.getData().get(i).getNO_RECIPIENTID() != null)) {
+                                    if (newsEntity.getData().get(i).getNO_RECIPIENTID().toString().contains(em_id)) {
+                                        fiterdata.add(newsEntity.getData().get(i));
+                                    }
+                                }
+                            } else {
+                                fiterdata.add(newsEntity.getData().get(i));
+                            }
+                        }
+                        newsEntity.setData(fiterdata);
+                        adapter = new CardItemAdapter(ct, newsEntity);
+                        mlist.getRefreshableView().setAdapter(adapter);
+                    } else {
+                        adapter.notifyDataSetChanged();
+                    }
+                    Log.i(TAG, result);
+                    break;
+                case Constants.APP_SOCKETIMEOUTEXCEPTION:
+                    result = msg.getData().getString("result");
+                    Log.i(TAG, result);
+                    mEmptyLayout.setErrorMessage(result + ",请刷新重试!");
+                    mEmptyLayout.showError();
+                    ViewUtil.AutoLoginErp(NoticesActivity.this, handler);
+                    break;
+                default:
+                    break;
+            }
+        }
+
+        ;
+    };
+
+    public class CardItemAdapter extends BaseAdapter {
+
+        private NoticeEntity newsEntities;
+        private LayoutInflater inflater;
+
+        public CardItemAdapter(Context ct, NoticeEntity list) {
+            this.newsEntities = list;
+            this.inflater = LayoutInflater.from(ct);
+        }
+
+        @Override
+        public int getCount() {
+            return newsEntities == null ? 0 : newsEntities.getData().size();
+
+        }
+
+        @Override
+        public Object getItem(int position) {
+            return newsEntities.getData().get(position);
+        }
+
+        @Override
+        public long getItemId(int position) {
+            return position;
+        }
+
+        @Override
+        public View getView(int position, View convertView, ViewGroup parent) {
+            ItemModel model = null;
+            if (convertView == null) {
+                convertView = inflater.inflate(R.layout.item_card_notice, parent, false);
+                model = new ItemModel();
+                model.img= (ImageView) convertView.findViewById(R.id.img);
+//				model.tv_title=(TextView) convertView.findViewById(R.id.tv_title);
+                model.tv_time = (TextView) convertView.findViewById(R.id.tv_time);
+//				model.tv_count=(TextView) convertView.findViewById(R.id.tv_count);
+                model.tv_theme = (TextView) convertView.findViewById(R.id.tv_theme);
+                model.tv_author = (TextView) convertView.findViewById(R.id.tv_author);
+//				model.tv_hasRead=(TextView)convertView.findViewById(R.id.tv_hasRead);
+                convertView.setTag(model);
+            } else {
+                model = (ItemModel) convertView.getTag();
+            }
+
+            if (position%2==0){
+                convertView.setBackgroundColor(getResources().getColor(R.color.item_color1));
+                model.img.setImageResource( R.drawable.notice_img_1);
+            }else{
+                convertView.setBackgroundColor(getResources().getColor(R.color.item_color2));
+                model.img.setImageResource(R.drawable.notice_img_2);
+            }
+
+            List<NoticeEntity.Data> datas = newsEntities.getData();
+//			model.tv_title.setText(datas.get(position).getNO_TITLE());
+            model.tv_time.setText(CommonUtil.transferLongToDate("yyyy-MM-dd HH:mm:ss",
+                    datas.get(position).getNO_APPTIME()));
+            model.tv_theme.setText( datas.get(position).getNO_TITLE());
+            model.tv_author.setText(datas.get(position).getNO_APPROVER());
+            model.id = datas.get(position).getNO_ID();
+//			if(!ObjectUtils.isEquals(datas.get(position).getSTATUS(),null)){
+//				if (((int)datas.get(position).getSTATUS())!=-1)
+//				{
+//					model.tv_hasRead.setText("未读");}
+//				else{
+//					if (((int)datas.get(position).getSTATUS())==-1)
+//					{
+//						model.tv_hasRead.setText("已读");
+//					}
+//				}
+//			}
+//			else{
+//				model.tv_hasRead.setText("未读");
+//			}
+//			model.tv_count.setVisibility(View.GONE);
+            return convertView;
+        }
+
+        class ItemModel {
+            private int id;
+            //			private TextView tv_title;
+            private TextView tv_time;
+            private ImageView img;
+            //			private TextView tv_count;
+            private TextView tv_theme;
+            private TextView tv_author;
+//			private TextView tv_hasRead;//已读,未读
+        }
+
+    }
 
 }

+ 24 - 24
WeiChat/src/main/java/com/sk/weichat/ui/erp/activity/SaleDetailActivity.java

@@ -1,11 +1,21 @@
 package com.sk.weichat.ui.erp.activity;
 
-import java.io.Serializable;
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-import java.util.List;
-import java.util.Map;
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Paint;
+import android.os.Bundle;
+import android.os.Handler;
+import android.util.Log;
+import android.view.Gravity;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
+import android.widget.RelativeLayout.LayoutParams;
+import android.widget.TextView;
 
 import com.alibaba.fastjson.JSON;
 import com.lidroid.xutils.ViewUtils;
@@ -25,22 +35,12 @@ import com.sk.weichat.ui.erp.view.EmptyLayout;
 import com.sk.weichat.ui.erp.view.ListViewInScroller;
 import com.sk.weichat.ui.erp.view.PickDialog;
 
-import android.content.Context;
-import android.content.Intent;
-import android.graphics.Paint;
-import android.os.Bundle;
-import android.os.Handler;
-import android.util.Log;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.View.OnClickListener;
-import android.view.ViewGroup;
-import android.widget.BaseAdapter;
-import android.widget.LinearLayout;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-import android.widget.RelativeLayout.LayoutParams;
+import java.io.Serializable;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.LinkedHashMap;
+import java.util.List;
+import java.util.Map;
 
 /**
  * @author :LiuJie 2015年6月10日 上午8:43:55
@@ -57,8 +57,8 @@ public class SaleDetailActivity extends BaseActivity implements OnClickListener
 	private LinearLayout ly_panel_data;
 	@ViewInject(R.id.lv_detail_data)
 	private ListViewInScroller lv_detail_data;
-	@ViewInject(R.id.tv_title)
-	private TextView tv_title;
+//	@ViewInject(R.id.tv_title)
+//	private TextView tv_title;
 	@ViewInject(R.id.tv_log_handler)
 	private TextView tv_log_handler;
 	@ViewInject(R.id.tv_log_approve)

BIN
WeiChat/src/main/res/drawable-hdpi/exit_rom.png


BIN
WeiChat/src/main/res/drawable-hdpi/notice_img_1.png


BIN
WeiChat/src/main/res/drawable-hdpi/notice_img_2.png


BIN
WeiChat/src/main/res/drawable-hdpi/search_btn.png


BIN
WeiChat/src/main/res/drawable-hdpi/system_img.png


+ 34 - 53
WeiChat/src/main/res/layout/item_card_notice.xml

@@ -2,85 +2,66 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@drawable/card_background_white"
-    android:orientation="vertical" >
+    android:orientation="vertical">
 
-    <TextView
-        android:id="@+id/tv_title"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginTop="10dp"
-        android:gravity="center"
-        android:text="新闻标题"
-        android:textColor="@color/black" />
+    <!--<TextView-->
+    <!--android:id="@+id/tv_title"-->
+    <!--android:layout_width="match_parent"-->
+    <!--android:layout_height="wrap_content"-->
+    <!--android:layout_marginTop="10dp"-->
+    <!--android:gravity="center"-->
+    <!--android:text="新闻标题"-->
+    <!--android:textColor="@color/black" />-->
 
     <RelativeLayout
+        android:layout_marginTop="@dimen/line_big"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_marginTop="5dp" >
+        android:paddingLeft="27dp"
+        android:paddingRight="27dp">
 
         <TextView
-            android:id="@+id/tv_time"
+            android:id="@+id/tv_author"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
-            android:layout_marginLeft="10dp"
-            android:text="2015-09-12"
-            android:textColor="@color/darkmagenta" />
+            android:text="作者:张超"
+            android:textColor="@color/text_main" />
+
+        <ImageView
+            android:id="@+id/img"
+            android:layout_width="35dp"
+            android:layout_height="25dp"
+            android:layout_alignParentRight="true"
+            android:src="@drawable/loading_01" />
 
         <TextView
-            android:layout_width="wrap_content"
+            android:id="@+id/tv_theme"
+            android:layout_width="match_parent"
             android:layout_height="wrap_content"
-            android:layout_toLeftOf="@+id/tv_count"
-            android:text="浏览数:"
-            android:visibility="gone"
-            android:textColor="@color/black" >
+            android:layout_below="@+id/tv_author"
+            android:singleLine="true"
+            android:text="新闻正文"
+            android:textColor="@color/text_hine" />
 
-        </TextView>
         <TextView
-            android:id="@+id/tv_count"
+            android:id="@+id/tv_time"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_alignParentRight="true"
-            android:layout_marginRight="10dp"
-            android:text="11112"
-            android:textColor="@color/yellow_home" />
-
+            android:layout_below="@+id/tv_theme"
+            android:text="2015-09-12"
+            android:textColor="@color/text_hine" />
     </RelativeLayout>
 
-    <TextView
-        android:id="@+id/tv_theme"
-        android:layout_width="match_parent"
-        android:layout_height="wrap_content"
-        android:layout_marginLeft="10dp"
-        android:singleLine="true"
-        android:text="新闻正文" />
+
     <LinearLayout
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
         android:layout_marginTop="10dp"
         android:orientation="horizontal">
-        <TextView
-            android:id="@+id/tv_hasRead"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="10dp"
-            android:layout_marginLeft="10dp"
-            android:gravity="left"
-            android:text="未读"
-            android:textColor="@color/darkgray" />
 
-        <TextView
-            android:id="@+id/tv_author"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:layout_marginBottom="10dp"
-            android:layout_marginLeft="10dp"
-            android:layout_marginRight="10dp"
-            android:gravity="right"
-            android:text="作者:张超"
-            android:textColor="@color/darkgray" />
-    </LinearLayout>
 
+    </LinearLayout>
 
 
 </LinearLayout>

+ 1 - 1
build.gradle

@@ -4,7 +4,7 @@ buildscript {
         jcenter()
     }
     dependencies {
-        classpath 'com.android.tools.build:gradle:1.3.0'
+        classpath 'com.android.tools.build:gradle:2.0.0'
     }
 }
 allprojects {

+ 2 - 2
gradle/wrapper/gradle-wrapper.properties

@@ -1,6 +1,6 @@
-#Tue Mar 29 15:27:01 CST 2016
+#Thu Apr 14 16:53:21 CST 2016
 distributionBase=GRADLE_USER_HOME
 distributionPath=wrapper/dists
 zipStoreBase=GRADLE_USER_HOME
 zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip