|
|
@@ -8,6 +8,7 @@ import android.graphics.Color;
|
|
|
import android.os.Bundle;
|
|
|
import android.os.Handler;
|
|
|
import android.os.Message;
|
|
|
+import android.provider.Settings;
|
|
|
import android.text.Editable;
|
|
|
import android.text.TextUtils;
|
|
|
import android.text.TextWatcher;
|
|
|
@@ -71,6 +72,7 @@ import com.xzjmyk.pm.activity.util.TimeUtils;
|
|
|
import com.xzjmyk.pm.activity.util.ToastUtil;
|
|
|
import com.xzjmyk.pm.activity.util.ViewHolder;
|
|
|
import com.xzjmyk.pm.activity.view.ClearEditText;
|
|
|
+import com.xzjmyk.pm.activity.view.DrawableCenterTextView;
|
|
|
import com.xzjmyk.pm.activity.view.PullToRefreshSlideListView;
|
|
|
import com.xzjmyk.pm.activity.volley.ArrayResult;
|
|
|
import com.xzjmyk.pm.activity.volley.Result;
|
|
|
@@ -96,6 +98,10 @@ public class MessageFragment extends EasyFragment {
|
|
|
private Handler mHandler = new Handler();
|
|
|
private boolean isRefeshed;
|
|
|
private MainActivity mActivity;
|
|
|
+
|
|
|
+ private DrawableCenterTextView mNetTextView;
|
|
|
+ private String mNoticeMsg = null;
|
|
|
+
|
|
|
public static final int REQUESTCODE = 0xa1;
|
|
|
//界面更新广播
|
|
|
private BroadcastReceiver mUpdateReceiver = new BroadcastReceiver() {
|
|
|
@@ -180,6 +186,7 @@ public class MessageFragment extends EasyFragment {
|
|
|
}
|
|
|
|
|
|
private void initView() {
|
|
|
+ mNetTextView = (DrawableCenterTextView) findViewById(R.id.message_net_set);
|
|
|
mClearEditText = (ClearEditText) findViewById(R.id.search_edit);
|
|
|
mClearEditText.addTextChangedListener(new TextWatcher() {
|
|
|
@Override
|
|
|
@@ -221,6 +228,7 @@ public class MessageFragment extends EasyFragment {
|
|
|
mPullToRefreshListView.setOnRefreshListener(new OnRefreshListener<SlideListView>() {
|
|
|
@Override
|
|
|
public void onRefresh(PullToRefreshBase<SlideListView> refreshView) {
|
|
|
+ mNoticeMsg = null;
|
|
|
refreshUI();
|
|
|
}
|
|
|
});
|
|
|
@@ -253,8 +261,23 @@ public class MessageFragment extends EasyFragment {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ mNetTextView.setOnClickListener(new View.OnClickListener() {
|
|
|
+ @Override
|
|
|
+ public void onClick(View v) {
|
|
|
+ startActivity(new Intent(Settings.ACTION_SETTINGS));
|
|
|
+ }
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
+ public void setNetNoticeVisiable(boolean visiable){
|
|
|
+ if (mNetTextView != null){
|
|
|
+ if (visiable){
|
|
|
+ mNetTextView.setVisibility(View.VISIBLE);
|
|
|
+ }else {
|
|
|
+ mNetTextView.setVisibility(View.GONE);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
/**
|
|
|
* 头视图相关
|
|
|
@@ -301,7 +324,7 @@ public class MessageFragment extends EasyFragment {
|
|
|
public void onClick(View view) {
|
|
|
switch (view.getId()) {
|
|
|
case R.id.schedule_rl:
|
|
|
- // startActivity(new Intent(mActivity, ScheduleActivity.class));
|
|
|
+ // startActivity(new Intent(mActivity, ScheduleActivity.class));
|
|
|
startActivity(new Intent(mActivity, ProcessMsgActivity.class));
|
|
|
break;
|
|
|
case R.id.task_rl:
|
|
|
@@ -713,9 +736,9 @@ public class MessageFragment extends EasyFragment {
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * @desc:审批流接口
|
|
|
- * @author:Arison on 2016/11/15
|
|
|
- */
|
|
|
+ * @desc:审批流接口
|
|
|
+ * @author:Arison on 2016/11/15
|
|
|
+ */
|
|
|
private void loadProcessToDo(int page) {
|
|
|
String url = Constants.getAppBaseUrl(ct) + "common/desktop/process/toDo.action";
|
|
|
Map<String, Object> params = new HashMap<>();
|
|
|
@@ -764,9 +787,10 @@ public class MessageFragment extends EasyFragment {
|
|
|
switch (msg.what) {
|
|
|
case 0x16:
|
|
|
String message = (String) msg.getData().get("result");
|
|
|
+ List<SubscriptionMessage> messages = null;
|
|
|
int num = 0;
|
|
|
if (JSON.parseObject(message).containsKey("data")) {
|
|
|
- List<SubscriptionMessage> messages = JSON.parseArray(JSON.parseObject(message).getJSONArray("data").toJSONString(), SubscriptionMessage.class);
|
|
|
+ messages = JSON.parseArray(JSON.parseObject(message).getJSONArray("data").toJSONString(), SubscriptionMessage.class);
|
|
|
for (SubscriptionMessage e : messages) {
|
|
|
if (e.getSTATUS_() == 0)
|
|
|
num += 1;
|
|
|
@@ -777,26 +801,35 @@ public class MessageFragment extends EasyFragment {
|
|
|
if (num > 0) {
|
|
|
num_tv.setText(num + "");
|
|
|
num_tv.setVisibility(View.VISIBLE);
|
|
|
- content_tv.setText("您有新的订阅消息!");
|
|
|
+// content_tv.setText("您有新的订阅消息!");
|
|
|
+ content_tv.setText(messages.get(0).getTITLE_());
|
|
|
time_tv.setText("刚刚");
|
|
|
} else {
|
|
|
num_tv.setVisibility(View.GONE);
|
|
|
- content_tv.setText("暂无新的订阅消息!");
|
|
|
+// content_tv.setText("暂无新的订阅消息!");
|
|
|
+ content_tv.setText("");
|
|
|
}
|
|
|
break;
|
|
|
case 0x17:
|
|
|
- JSONArray itemArray = JSON.parseObject( msg.getData().getString("result")).getJSONArray("data");
|
|
|
- itemArray=CommonUtil.sortJsonArray(itemArray);
|
|
|
- LogUtil.d("item:"+itemArray.size());
|
|
|
- if (!ListUtils.isEmpty(itemArray)){
|
|
|
- DAIBAN_count= itemArray.size();
|
|
|
- handler.sendEmptyMessage(DAIBAN_MSG);
|
|
|
- }else{
|
|
|
- DAIBAN_count=0;
|
|
|
+ JSONArray itemArray = JSON.parseObject(msg.getData().getString("result")).getJSONArray("data");
|
|
|
+ itemArray = CommonUtil.sortJsonArray(itemArray);
|
|
|
+ LogUtil.d("item:" + itemArray.size());
|
|
|
+ if (!ListUtils.isEmpty(itemArray)) {
|
|
|
+ DAIBAN_count = itemArray.size();
|
|
|
+ Message DaibanMsg = Message.obtain();
|
|
|
+ DaibanMsg.what = DAIBAN_MSG;
|
|
|
+ if (itemArray.size() != 0){
|
|
|
+ DaibanMsg.obj = itemArray.getJSONObject(0).getString("JP_LAUNCHERNAME") + "的"
|
|
|
+ + itemArray.getJSONObject(0).getString("JP_NAME");
|
|
|
+ }
|
|
|
+ handler.sendMessage(DaibanMsg);
|
|
|
+// handler.sendEmptyMessage(DAIBAN_MSG);
|
|
|
+ } else {
|
|
|
+ DAIBAN_count = 0;
|
|
|
handler.sendEmptyMessage(DAIBAN_MSG);
|
|
|
}
|
|
|
-
|
|
|
- break;
|
|
|
+
|
|
|
+ break;
|
|
|
case Constants.SUCCESS_LOGIN://公告
|
|
|
updateGongGao(msg);
|
|
|
break;
|
|
|
@@ -824,23 +857,30 @@ public class MessageFragment extends EasyFragment {
|
|
|
if (TASK_count > 0) {
|
|
|
task_num_tv.setText(TASK_count + "");
|
|
|
task_num_tv.setVisibility(View.VISIBLE);
|
|
|
- task_content_tv.setText("您有新的任务!");
|
|
|
+// task_content_tv.setText("您有新的任务!");
|
|
|
+ if (msg.obj != null){
|
|
|
+ task_content_tv.setText((String) msg.obj);
|
|
|
+ }
|
|
|
task_time_tv.setText("刚刚");
|
|
|
} else {
|
|
|
task_num_tv.setVisibility(View.GONE);
|
|
|
- task_content_tv.setText("暂无新的任务!");
|
|
|
+ task_content_tv.setText("");
|
|
|
}
|
|
|
break;
|
|
|
case DAIBAN_MSG:
|
|
|
setListener();
|
|
|
if (DAIBAN_count > 0) {
|
|
|
+ String daiban = (String) msg.obj;
|
|
|
schedule_num_tv.setText(DAIBAN_count + "");
|
|
|
schedule_num_tv.setVisibility(View.VISIBLE);
|
|
|
- schedule_content_tv.setText("您有新的待审批流程!");
|
|
|
+// schedule_content_tv.setText("您有新的待审批流程!");
|
|
|
+ if (daiban != null){
|
|
|
+ schedule_content_tv.setText(daiban);
|
|
|
+ }
|
|
|
schedule_time_tv.setText("刚刚");
|
|
|
} else {
|
|
|
schedule_num_tv.setVisibility(View.GONE);
|
|
|
- schedule_content_tv.setText("暂无新的审批流程!");
|
|
|
+ schedule_content_tv.setText("");
|
|
|
}
|
|
|
break;
|
|
|
}
|
|
|
@@ -853,11 +893,14 @@ public class MessageFragment extends EasyFragment {
|
|
|
if (count > 0) {
|
|
|
notice_num_tv.setText(count + "");
|
|
|
notice_num_tv.setVisibility(View.VISIBLE);
|
|
|
- notice_content_tv.setText("您有新的通知公告!");
|
|
|
+ if (mNoticeMsg != null){
|
|
|
+ notice_content_tv.setText(mNoticeMsg);
|
|
|
+ }
|
|
|
+// notice_content_tv.setText("您有新的通知公告!");
|
|
|
notice_time_tv.setText("刚刚");
|
|
|
} else {
|
|
|
notice_num_tv.setVisibility(View.GONE);
|
|
|
- notice_content_tv.setText("暂无新的通知公告!");
|
|
|
+ notice_content_tv.setText("");
|
|
|
}
|
|
|
}
|
|
|
|
|
|
@@ -882,6 +925,9 @@ public class MessageFragment extends EasyFragment {
|
|
|
if (((int) newsEntity.getData().get(i).getSTATUS()) != -1) {
|
|
|
if ((!StringUtils.isEmpty(em_id) && newsEntity.getData().get(i).getNO_RECIPIENTID() != null)) {
|
|
|
if (newsEntity.getData().get(i).getNO_RECIPIENTID().toString().contains(em_id)) {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = newsEntity.getData().get(0).getNO_TITLE().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
@@ -889,9 +935,15 @@ public class MessageFragment extends EasyFragment {
|
|
|
} else {
|
|
|
if ((!StringUtils.isEmpty(em_id) && newsEntity.getData().get(i).getNO_RECIPIENTID() != null)) {
|
|
|
if (newsEntity.getData().get(i).getNO_RECIPIENTID().toString().contains(em_id)) {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = newsEntity.getData().get(0).getNO_TITLE().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
} else {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = newsEntity.getData().get(0).getNO_TITLE().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
@@ -923,6 +975,9 @@ public class MessageFragment extends EasyFragment {
|
|
|
if (((int) newsEntity.getData().get(i).getSTATUS()) != -1) {
|
|
|
if ((!StringUtils.isEmpty(em_id) && newsEntity.getData().get(i).getNO_RECIPIENTID() != null)) {
|
|
|
if (newsEntity.getData().get(i).getNO_RECIPIENTID().toString().contains(em_id)) {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = newsEntity.getData().get(0).getNO_TITLE().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
@@ -930,9 +985,15 @@ public class MessageFragment extends EasyFragment {
|
|
|
} else {
|
|
|
if ((!StringUtils.isEmpty(em_id) && newsEntity.getData().get(i).getNO_RECIPIENTID() != null)) {
|
|
|
if (newsEntity.getData().get(i).getNO_RECIPIENTID().toString().contains(em_id)) {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = newsEntity.getData().get(0).getNO_TITLE().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
} else {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = newsEntity.getData().get(0).getNO_TITLE().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
}
|
|
|
@@ -959,9 +1020,15 @@ public class MessageFragment extends EasyFragment {
|
|
|
for (int i = 0; i < size; i++) {
|
|
|
if (!ObjectUtils.isEquals(news.getData().get(i).getSTATUS(), null)) {
|
|
|
if (((int) news.getData().get(i).getSTATUS()) != -1) {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = news.getData().get(0).getNE_THEME().replace(" ", "");
|
|
|
+ }
|
|
|
count++;
|
|
|
}
|
|
|
} else {
|
|
|
+ if (mNoticeMsg == null){
|
|
|
+ mNoticeMsg = news.getData().get(0).getNE_THEME().replace(" ","") ;
|
|
|
+ }
|
|
|
count++;//数据为空,算是未读
|
|
|
}
|
|
|
}
|
|
|
@@ -998,7 +1065,13 @@ public class MessageFragment extends EasyFragment {
|
|
|
}
|
|
|
}
|
|
|
TASK_count = task_num;
|
|
|
- handler.sendEmptyMessage(TASK_MSG);
|
|
|
+ Message TaskMsg = Message.obtain();
|
|
|
+ TaskMsg.what = TASK_MSG;
|
|
|
+ if (allProcesses.size() != 0){
|
|
|
+ TaskMsg.obj = allProcesses.get(0).getTaskname();
|
|
|
+ }
|
|
|
+ handler.sendMessage(TaskMsg);
|
|
|
+// handler.sendEmptyMessage(TASK_MSG);
|
|
|
// DAIBAN_count = daiban_num;
|
|
|
// handler.sendEmptyMessage(DAIBAN_MSG);
|
|
|
}
|