Преглед изворни кода

提交类型 新功能修改
提交内容 修改部分bug

Bitliker пре 7 година
родитељ
комит
6cc0cdb5a6

+ 101 - 101
WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java

@@ -1,12 +1,14 @@
 package com.xzjmyk.pm.activity.ui.message;
 
-import android.app.Activity;
 import android.content.Context;
 import android.content.Intent;
 import android.os.Bundle;
 import android.provider.Settings;
 import android.support.v7.widget.AppCompatTextView;
-import android.text.Editable;
+import android.support.v7.widget.DividerItemDecoration;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.support.v7.widget.Toolbar;
 import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.LayoutInflater;
@@ -15,7 +17,6 @@ import android.view.MenuInflater;
 import android.view.MenuItem;
 import android.view.View;
 import android.view.ViewGroup;
-import android.widget.AdapterView;
 import android.widget.BaseAdapter;
 import android.widget.ImageButton;
 import android.widget.ImageView;
@@ -38,15 +39,13 @@ import com.core.model.WorkModel;
 import com.core.utils.ToastUtil;
 import com.core.utils.sortlist.BaseSortModel;
 import com.core.widget.DrawableCenterTextView;
-import com.core.widget.MyListView;
 import com.core.widget.RedView;
-import com.core.widget.VoiceSearchView;
-import com.core.widget.listener.EditChangeListener;
 import com.modular.appmessages.activity.ProcessB2BActivity;
 import com.modular.appmessages.activity.ProcessMsgActivity;
 import com.modular.appmessages.activity.Subscription2Activity;
-import com.modular.appmessages.adapter.MessageAdapter;
+import com.modular.appmessages.adapter.MessageNewAdapter;
 import com.modular.appmessages.model.MessageHeader;
+import com.modular.appmessages.model.MessageNew;
 import com.modular.appmessages.presenter.MessagePresenter;
 import com.modular.appmessages.presenter.imp.IMessageView;
 import com.modular.appmessages.widget.SignRefreshLayout;
@@ -55,6 +54,7 @@ import com.xzjmyk.pm.activity.R;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskActivity;
 import com.xzjmyk.pm.activity.ui.platform.task.TaskB2BActivity;
 
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.Comparator;
 import java.util.List;
@@ -64,28 +64,24 @@ import java.util.List;
  */
 public class MessageFragment extends SupportToolBarFragment implements IMessageView, View.OnClickListener {
 
-    private VoiceSearchView voiceSearchView;
     private DrawableCenterTextView message_net_set;
     private SignRefreshLayout mSignRefreshLayout;
-    private MyListView headerLV;
-    private MyListView contentLV;
-    private View handerAndContentLine;
+    private RecyclerView mRecyclerView;
 
+    //打卡界面
     private View signView;
     private ImageButton itemSignImage;
     private AppCompatTextView itemWorkTv;
     private AppCompatTextView itemOffkTv;
 
+    private MessageNewAdapter mAdapter;
     private BaseActivity mContext;
     private MessagePresenter presenter;
-    private MessageAdapter mAdapter;
     private PopupWindow setWindow;
     private int clickPosition = 0;
     private Boolean platform;
 
     private Comparator<BaseSortModel<Friend>> comparator;
-
-    private HeadAdapter headAdapter;
     private MessagePresenter.UnReaderListener unReaderListener;
 
     @Override
@@ -122,7 +118,7 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
 
     @Override
     protected int inflateLayoutId() {
-        return R.layout.fragment_new_message;
+        return R.layout.fragment_message;
     }
 
     @Override
@@ -145,15 +141,38 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
         }
     }
 
+    private MessageNewAdapter.ItemTouchListener mItemTouchListener = new MessageNewAdapter.ItemTouchListener() {
+        @Override
+        public void longClick(int id) {
+
+
+            clickPosition = id - mAdapter.getHeaderSize();
+            if (clickPosition < 0) clickPosition = 0;
+            showPopupWindow();
+        }
+
+        @Override
+        public void click(int id, MessageNew messageNew) {
+            if (messageNew != null && messageNew.getT() != null) {
+                if (messageNew.getT() instanceof MessageHeader) {
+                    MessageHeader model = (MessageHeader) messageNew.getT();
+                    if (model != null) {
+                        if (!model.isHideRed()) {//如果没有被隐藏,需要更新
+                            model.hideRed();
+                            mAdapter.notifyItemChanged(id);
+                        }
+                        presenter.turn2ActByHeader(ct, model);
+                    }
+                } else {
+                    presenter.turn2NextAct(mContext, id - mAdapter.getHeaderSize());
+                }
+            }
+        }
+    };
+
 
     private void initEvent() {
         message_net_set.setOnClickListener(this);
-        voiceSearchView.addTextChangedListener(new EditChangeListener() {
-            @Override
-            public void afterTextChanged(Editable s) {
-                presenter.search(s.toString());
-            }
-        });
         mSignRefreshLayout.setOnRefreshListener(new SignRefreshLayout.onRefreshListener() {
             @Override
             public void onRefresh() {
@@ -161,47 +180,20 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
             }
         });
 
-        contentLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-            @Override
-            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                if (mAdapter == null || ListUtils.isEmpty(mAdapter.getmFriendList()) || mAdapter.getCount() <= id || id < 0)
-                    return;
-                try {
-                    presenter.turn2NextAct(mContext, (int) id);
-                } catch (Exception e) {
-                    e.printStackTrace();
-                }
-            }
-        });
-        contentLV.setOnItemLongClickListener(new AdapterView.OnItemLongClickListener() {
-            @Override
-            public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id) {
-                if (mAdapter == null || ListUtils.isEmpty(mAdapter.getmFriendList()) || mAdapter.getCount() <= id)
-                    return true;
-                clickPosition = (int) id;
-                if (clickPosition < 0) clickPosition = 0;
-                showPopupWindow();
-                return true;
-            }
-        });
     }
 
 
     private void initView() {
-        android.support.v7.widget.Toolbar toolbar = getCommonToolBar();
+        Toolbar toolbar = getCommonToolBar();
         if (toolbar != null) {
             toolbar.setBackgroundResource(R.drawable.common_toolbar_message_bg);
         }
         setTitle(R.string.contact_title);
-        voiceSearchView = findViewById(R.id.voiceSearchView);
         message_net_set = findViewById(R.id.message_net_set);
         mSignRefreshLayout = findViewById(R.id.mSignRefreshLayout);
-        headerLV = findViewById(R.id.headerLV);
-        contentLV = findViewById(R.id.contentLV);
-        handerAndContentLine = findViewById(R.id.handerAndContentLine);
-
-        mAdapter = new MessageAdapter(null, mContext);
-        contentLV.setAdapter(mAdapter);
+        mRecyclerView = findViewById(R.id.mRecyclerView);
+        mRecyclerView.setLayoutManager(new LinearLayoutManager(ct));
+        mRecyclerView.addItemDecoration(new DividerItemDecoration(ct, LinearLayout.VERTICAL));
         presenter = new MessagePresenter(mContext, this, unReaderListener);
         signView = mSignRefreshLayout.getSignView();
         if (signView != null) {
@@ -348,15 +340,24 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
         if (mSignRefreshLayout.isEnablePullDown() && mSignRefreshLayout.isRefreshing()) {
             mSignRefreshLayout.stopRefresh();
         }
+        List<MessageNew> messageNews = new ArrayList<>();
+        if (!ListUtils.isEmpty(models)) {
+            for (BaseSortModel<Friend> e : models) {
+                MessageNew<BaseSortModel<Friend>> t = new MessageNew<>();
+                t.setT(e);
+                t.setType(1);
+                messageNews.add(t);
+            }
+        }
         if (mAdapter == null) {
-            mAdapter = new MessageAdapter(models, mContext);
-            contentLV.setAdapter(mAdapter);
+            mAdapter = new MessageNewAdapter(ct);
+            mAdapter.setContentModels(messageNews);
+            mAdapter.setItemTouchListener(mItemTouchListener);
+            mRecyclerView.setAdapter(mAdapter);
         } else {
-            mAdapter.setmFriendList(models);
+            mAdapter.setContentModels(messageNews);
             mAdapter.notifyDataSetChanged();
         }
-        headerLV.setSelection(0);
-        handerAndContentLine.setVisibility(ListUtils.isEmpty(models) ? View.GONE : View.VISIBLE);
     }
 
     private void sortModels(List<BaseSortModel<Friend>> models) {
@@ -374,49 +375,53 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
 
     @Override
     public void clearSearch() {
-        voiceSearchView.setText("");
     }
 
 
     @Override
     public void updateHeaderView(int type, int num, String subTitle, String time) {
-        if (headAdapter != null && !ListUtils.isEmpty(headAdapter.getModels())) {
+        if (mAdapter != null && !ListUtils.isEmpty(mAdapter.getModels())) {
             boolean isUpdated = false;
             if (type != MessagePresenter.REAL_TIME_FORM && type != MessagePresenter.BUSINESS_STATISTICS) {
-                for (MessageHeader e : headAdapter.getModels()) {
-                    if (e.getType() == type) {
-                        isUpdated = true;
-                        e.setSubDoc(subTitle);
-                        e.setRedNum(num);
-                        e.setTime(time);
+                for (int i = 0; i < mAdapter.getModels().size(); i++) {
+                    MessageNew e = mAdapter.getModels().get(i);
+                    if (e != null && e.getT() != null && e.getT() instanceof MessageHeader) {
+                        MessageHeader h = (MessageHeader) e.getT();
+                        if (h.getType() == type) {
+                            isUpdated = true;
+                            h.setSubDoc(subTitle);
+                            h.setRedNum(num);
+                            h.setTime(time);
+                            mAdapter.notifyItemChanged(i, e);
+                            break;
+                        }
                     }
                 }
             }
-
             if (type == MessagePresenter.REAL_TIME_FORM || type == MessagePresenter.BUSINESS_STATISTICS) {
-                isUpdated = updateHideOrDisplay(num, isUpdated, type);
-            }
-
-            if (isUpdated) {
-                headAdapter.notifyDataSetChanged();
+                updateHideOrDisplay(num, isUpdated, type);
             }
-
         }
         if (mSignRefreshLayout.isEnablePullDown() && mSignRefreshLayout.isRefreshing()) {
             mSignRefreshLayout.stopRefresh();
         }
     }
 
+    //更新是否显示红点
     private boolean updateHideOrDisplay(int num, boolean isUpdated, int type) {
         boolean isExist = false;
         int position = -1;
-        for (int i = 0; i < headAdapter.getModels().size(); i++) {
-            MessageHeader messageHeader = headAdapter.getModels().get(i);
-            if (messageHeader.getType() == type) {
-                position = i;
-                isExist = true;
-                break;
+        for (int i = 0; i < mAdapter.getModels().size(); i++) {
+            MessageNew model = mAdapter.getModels().get(i);
+            if (model != null && model.getT() != null && model.getT() instanceof MessageHeader) {
+                MessageHeader messageHeader = (MessageHeader) model.getT();
+                if (messageHeader.getType() == type) {
+                    position = i;
+                    isExist = true;
+                    break;
+                }
             }
+
         }
         if (num > 0) {
             if (!isExist) {
@@ -426,21 +431,28 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
                     model.setIcon(R.drawable.ic_real_time_form);
                     model.setRedKey(Constants.MESSAGE_REAL_TIME);
                     model.setType(MessagePresenter.REAL_TIME_FORM);
-                    headAdapter.getModels().add(2, model);
+                    MessageNew news = new MessageNew();
+                    news.setT(model);
+                    mAdapter.addHeadModel(2, news);
                 } else if (type == MessagePresenter.BUSINESS_STATISTICS) {
                     MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.business_statistics));
                     model.setIcon(R.drawable.ic_business_statistics);
                     model.setRedKey(Constants.MESSAGE_BUSINESS_STATISTICS);
                     model.setType(MessagePresenter.BUSINESS_STATISTICS);
-                    headAdapter.getModels().add(headAdapter.getModels().size() - 1, model);
+                    MessageNew news = new MessageNew();
+                    news.setT(model);
+                    mAdapter.getModels().add(1000, news);
                 }
             }
         } else {
             isUpdated = true;
-            if (position >= 0 && position <= headAdapter.getModels().size()) {
-                headAdapter.getModels().remove(position);
+            if (position >= 0 && position <= mAdapter.getModels().size()) {
+                mAdapter.getModels().remove(position);
             }
         }
+        if (isUpdated) {
+            mAdapter.notifyDataSetChanged();
+        }
         return isUpdated;
     }
 
@@ -456,25 +468,14 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
     }
 
     @Override
-    public void updateHeader(List<MessageHeader> models) {
-        if (headAdapter == null) {
-            headAdapter = new HeadAdapter(models);
-            headerLV.setAdapter(headAdapter);
-            headerLV.setOnItemClickListener(new AdapterView.OnItemClickListener() {
-                @Override
-                public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
-                    MessageHeader model = headAdapter.getItemModel(position);
-                    if (model != null) {
-                        if (!model.isHideRed()) {//如果没有被隐藏,需要更新
-                            model.hideRed();
-                            headAdapter.notifyDataSetChanged();
-                        }
-                        presenter.turn2ActByHeader((Activity) ct, model);
-                    }
-                }
-            });
+    public void updateHeader(List<MessageNew> models) {
+        if (mAdapter == null) {
+            mAdapter = new MessageNewAdapter(ct);
+            mAdapter.setItemTouchListener(mItemTouchListener);
+            mAdapter.setHeaderModels(models);
+            mRecyclerView.setAdapter(mAdapter);
         } else {
-            headAdapter.setModels(models);
+            mAdapter.setHeaderModels(models);
         }
     }
 
@@ -586,7 +587,6 @@ public class MessageFragment extends SupportToolBarFragment implements IMessageV
                 }
             }
         }
-
     }
 
 

+ 0 - 163
WeiChat/src/main/res/layout/layout_main_tab_radio_group.xml

@@ -1,163 +0,0 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
-    android:layout_width="match_parent"
-    android:layout_height="45dp"
-    android:background="@color/white">
-
-    <View
-        android:layout_width="match_parent"
-        android:layout_height="@dimen/line"
-        android:background="@color/item_line" />
-
-    <com.xzjmyk.pm.activity.view.DivideRadioGroup
-        android:id="@+id/mDivideRadioGroup"
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
-        android:baselineAligned="false"
-        android:orientation="horizontal"
-        android:paddingBottom="2dp"
-        android:paddingTop="2dp">
-
-        <FrameLayout
-            android:layout_width="0dip"
-            android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:background="@null">
-
-            <RadioButton
-                android:id="@+id/main_tab_one"
-                style="@style/IMTabButton"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:checked="true"
-                android:drawableTop="@drawable/tab_job_bg"
-                android:paddingTop="5dp"
-                android:text="@string/message"
-                android:textSize="9sp" />
-
-            <TextView
-                android:id="@+id/main_tab_one_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="top|right"
-                android:layout_marginRight="18dp"
-                android:background="@drawable/tab_unread_bg"
-                android:gravity="center"
-                android:textColor="@android:color/white"
-                android:textSize="7sp"
-                android:visibility="invisible" />
-        </FrameLayout>
-
-        <FrameLayout
-            android:layout_width="0dip"
-            android:layout_height="match_parent"
-            android:layout_weight="1">
-
-            <RadioButton
-                android:id="@+id/main_tab_two"
-                style="@style/IMTabButton"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:drawableTop="@drawable/tab_found_bg"
-                android:paddingTop="5dp"
-                android:text="@string/find"
-                android:textSize="9sp" />
-
-            <TextView
-                android:id="@+id/main_tab_two_tv"
-                android:layout_width="wrap_content"
-                android:layout_height="wrap_content"
-                android:layout_gravity="top|right"
-                android:layout_marginRight="18dp"
-                android:background="@drawable/tab_unread_bg"
-                android:gravity="center"
-                android:textColor="@android:color/white"
-                android:textSize="7sp"
-                android:visibility="invisible" />
-        </FrameLayout>
-
-        <FrameLayout
-            android:layout_width="0dip"
-            android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:background="@null">
-
-            <RadioButton
-                android:id="@+id/main_tab_three"
-                style="@style/IMTabButton"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:drawableTop="@drawable/tab_interview"
-                android:paddingTop="5dp"
-                android:text="@string/nearby"
-                android:textSize="9sp" />
-
-            <TextView
-                android:id="@+id/main_tab_three_tv"
-                android:layout_width="10dp"
-                android:layout_height="10dp"
-                android:layout_gravity="top|right"
-                android:layout_marginRight="28dp"
-                android:background="@drawable/hongdian"
-                android:gravity="center"
-                android:textColor="@android:color/white"
-                android:textSize="7sp"
-                android:visibility="invisible" />
-        </FrameLayout>
-
-        <!--   <FrameLayout
-               android:layout_width="0dip"
-               android:layout_height="match_parent"
-               android:layout_weight="1"
-               android:background="@null" >
-
-               <RadioButton
-                   android:id="@+id/main_tab_four"
-                   style="@style/IMTabButton"
-                   android:layout_width="match_parent"
-                   android:layout_height="match_parent"
-                   android:drawableTop="@drawable/tab_message"
-                   android:text="@string/group_chat" />
-
-               <TextView
-                   android:id="@+id/main_tab_four_tv"
-                   android:layout_width="wrap_content"
-                   android:layout_height="wrap_content"
-                   android:layout_gravity="top|right"
-                   android:layout_marginRight="10dp"
-                   android:background="@drawable/tab_unread_bg"
-                   android:gravity="center"
-                   android:textColor="@android:color/white"
-                   android:textSize="10dp"
-                   android:visibility="invisible" />
-           </FrameLayout>-->
-
-        <FrameLayout
-            android:layout_width="0dip"
-            android:layout_height="match_parent"
-            android:layout_weight="1"
-            android:background="@null">
-
-            <RadioButton
-                android:id="@+id/main_tab_five"
-                style="@style/IMTabButton"
-                android:layout_width="match_parent"
-                android:layout_height="match_parent"
-                android:drawableTop="@drawable/tab_more"
-                android:paddingTop="5dp"
-                android:text="@string/me"
-                android:textSize="9sp" />
-
-            <TextView
-                android:id="@+id/main_tab_five_tv"
-                android:layout_width="10dp"
-                android:layout_height="10dp"
-                android:layout_gravity="top|right"
-                android:layout_marginRight="28dp"
-                android:background="@drawable/hongdian"
-                android:gravity="center"
-                android:textColor="@android:color/white"
-                android:textSize="7sp"
-                android:visibility="invisible" />
-        </FrameLayout>
-    </com.xzjmyk.pm.activity.view.DivideRadioGroup>
-</RelativeLayout>

+ 1 - 1
app_core/common/src/main/java/com/core/app/MyApplication.java

@@ -299,7 +299,7 @@ public class MyApplication extends BaseApplication {
                 .bitmapConfig(Bitmap.Config.RGB_565).
                         cacheInMemory(true)
                 .cacheOnDisc(true)
-                .displayer(new RoundedBitmapDisplayer(30))
+                .displayer(new RoundedBitmapDisplayer(10))
 //                .displayer(new RoundedBitmapDisplayer(10))
                 .resetViewBeforeLoading(true)
                 .showImageForEmptyUri(R.drawable.avatar_normal)

+ 3 - 3
app_core/common/src/main/res/layout/item_secondmsgs.xml

@@ -21,15 +21,15 @@
         <!--android:background="@color/item_color1"-->
         <FrameLayout
             android:id="@+id/msgs_area"
-            android:layout_width="57dp"
+            android:layout_width="53dp"
             android:layout_height="65dp"
             android:layout_centerVertical="true">
 
 
             <ImageView
                 android:id="@+id/msgs_img"
-                android:layout_width="@dimen/item_img_height"
-                android:layout_height="@dimen/item_img_width"
+                android:layout_width="42dp"
+                android:layout_height="42dp"
                 android:layout_gravity="center_vertical"
                 android:background="@color/transparent"
                 android:contentDescription="@string/app_name"

+ 153 - 143
app_core/common/src/main/res/layout/layout_main_tab_radio_group.xml

@@ -1,153 +1,163 @@
-<com.xzjmyk.pm.activity.view.DivideRadioGroup
-    xmlns:android="http://schemas.android.com/apk/res/android"
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
-    android:layout_height="60dp"
-    android:background="#FFFFFF"
-    android:baselineAligned="false"
-    android:gravity="bottom"
-    android:orientation="horizontal"
-    android:paddingBottom="4dp"
-    android:paddingTop="4dp">
-    <FrameLayout
-        android:layout_width="0dip"
+    android:layout_height="45dp"
+    android:background="@color/white">
+
+    <View
+        android:layout_width="match_parent"
+        android:layout_height="@dimen/line"
+        android:background="@color/item_line" />
+
+    <com.xzjmyk.pm.activity.view.DivideRadioGroup
+        android:id="@+id/mDivideRadioGroup"
+        android:layout_width="match_parent"
         android:layout_height="match_parent"
-        android:layout_weight="1"
-        android:background="@null" >
-
-        <TextView
-            android:id="@+id/main_tab_one_tv"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="top|right"
-            android:layout_marginRight="10dp"
-            android:background="@drawable/tab_unread_bg"
-            android:gravity="center"
-            android:textColor="@android:color/white"
-            android:textSize="10dp"
-            android:visibility="invisible" />
-
-        <RadioButton
-            android:id="@+id/main_tab_one"
-            style="@style/IMTabButton"
-            android:layout_width="match_parent"
+        android:baselineAligned="false"
+        android:orientation="horizontal"
+        android:paddingBottom="2dp"
+        android:paddingTop="2dp">
+
+        <FrameLayout
+            android:layout_width="0dip"
             android:layout_height="match_parent"
-            android:checked="true"
-            android:drawableTop="@drawable/tab_job_bg"
-            android:paddingTop="3dp"
-            android:text="@string/message" />
-    </FrameLayout>
-
-    <FrameLayout
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1"
-         >
+            android:layout_weight="1"
+            android:background="@null">
+
+            <RadioButton
+                android:id="@+id/main_tab_one"
+                style="@style/IMTabButton"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:checked="true"
+                android:drawableTop="@drawable/tab_job_bg"
+                android:paddingTop="7dp"
+                android:text="@string/message"
+                android:textSize="9sp" />
 
-        <RadioButton
-            android:id="@+id/main_tab_two"
-            style="@style/IMTabButton"
-            android:layout_width="match_parent"
+            <TextView
+                android:id="@+id/main_tab_one_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="top|right"
+                android:layout_marginRight="20dp"
+                android:background="@drawable/tab_unread_bg"
+                android:gravity="center"
+                android:textColor="@android:color/white"
+                android:textSize="7sp"
+                android:visibility="invisible" />
+        </FrameLayout>
+
+        <FrameLayout
+            android:layout_width="0dip"
             android:layout_height="match_parent"
-            android:drawableTop="@drawable/tab_found_bg"
-            android:text="@string/find"
-            android:paddingTop="3dp"/>
-
-        <TextView
-            android:id="@+id/main_tab_two_tv"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
-            android:layout_gravity="top|right"
-            android:layout_marginRight="10dp"
-            android:background="@drawable/tab_unread_bg"
-            android:gravity="center"
-            android:textColor="@android:color/white"
-            android:textSize="10dp"
-            android:visibility="invisible" />
-    </FrameLayout>
-
-    <FrameLayout
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1"
-        android:background="@null" >
+            android:layout_weight="1">
+
+            <RadioButton
+                android:id="@+id/main_tab_two"
+                style="@style/IMTabButton"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:drawableTop="@drawable/tab_found_bg"
+                android:paddingTop="7dp"
+                android:text="@string/find"
+                android:textSize="9sp" />
+
+            <TextView
+                android:id="@+id/main_tab_two_tv"
+                android:layout_width="wrap_content"
+                android:layout_height="wrap_content"
+                android:layout_gravity="top|right"
+                android:layout_marginRight="20dp"
+                android:background="@drawable/tab_unread_bg"
+                android:gravity="center"
+                android:textColor="@android:color/white"
+                android:textSize="7sp"
+                android:visibility="invisible" />
+        </FrameLayout>
 
-        <RadioButton
-            android:id="@+id/main_tab_three"
-            style="@style/IMTabButton"
-            android:layout_width="match_parent"
+        <FrameLayout
+            android:layout_width="0dip"
             android:layout_height="match_parent"
-            android:drawableTop="@drawable/tab_interview"
-            android:text="@string/nearby"
-            android:paddingTop="3dp"/>
-
-        <TextView
-            android:id="@+id/main_tab_three_tv"
-            android:layout_width="10dp"
-            android:layout_height="10dp"
-            android:layout_gravity="top|right"
-            android:layout_marginRight="20dp"
-            android:layout_marginTop="5dp"
-            android:background="@drawable/hongdian"
-            android:gravity="center"
-            android:textColor="@android:color/white"
-            android:textSize="10dp"
-            android:visibility="invisible" />
-    </FrameLayout>
-
-    <!--   <FrameLayout
-           android:layout_width="0dip"
-           android:layout_height="match_parent"
-           android:layout_weight="1"
-           android:background="@null" >
-
-           <RadioButton
-               android:id="@+id/main_tab_four"
-               style="@style/IMTabButton"
-               android:layout_width="match_parent"
+            android:layout_weight="1"
+            android:background="@null">
+
+            <RadioButton
+                android:id="@+id/main_tab_three"
+                style="@style/IMTabButton"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:drawableTop="@drawable/tab_interview"
+                android:paddingTop="7dp"
+                android:text="@string/nearby"
+                android:textSize="9sp" />
+
+            <TextView
+                android:id="@+id/main_tab_three_tv"
+                android:layout_width="10dp"
+                android:layout_height="10dp"
+                android:layout_gravity="top|right"
+                android:layout_marginRight="28dp"
+                android:background="@drawable/hongdian"
+                android:gravity="center"
+                android:textColor="@android:color/white"
+                android:textSize="7sp"
+                android:visibility="invisible" />
+        </FrameLayout>
+
+        <!--   <FrameLayout
+               android:layout_width="0dip"
                android:layout_height="match_parent"
-               android:drawableTop="@drawable/tab_message"
-               android:text="@string/group_chat" />
-
-           <TextView
-               android:id="@+id/main_tab_four_tv"
-               android:layout_width="wrap_content"
-               android:layout_height="wrap_content"
-               android:layout_gravity="top|right"
-               android:layout_marginRight="10dp"
-               android:background="@drawable/tab_unread_bg"
-               android:gravity="center"
-               android:textColor="@android:color/white"
-               android:textSize="10dp"
-               android:visibility="invisible" />
-       </FrameLayout>-->
-
-    <FrameLayout
-        android:layout_width="0dip"
-        android:layout_height="match_parent"
-        android:layout_weight="1"
-        android:background="@null" >
+               android:layout_weight="1"
+               android:background="@null" >
 
-        <RadioButton
-            android:id="@+id/main_tab_five"
-            style="@style/IMTabButton"
-            android:layout_width="match_parent"
+               <RadioButton
+                   android:id="@+id/main_tab_four"
+                   style="@style/IMTabButton"
+                   android:layout_width="match_parent"
+                   android:layout_height="match_parent"
+                   android:drawableTop="@drawable/tab_message"
+                   android:text="@string/group_chat" />
+
+               <TextView
+                   android:id="@+id/main_tab_four_tv"
+                   android:layout_width="wrap_content"
+                   android:layout_height="wrap_content"
+                   android:layout_gravity="top|right"
+                   android:layout_marginRight="10dp"
+                   android:background="@drawable/tab_unread_bg"
+                   android:gravity="center"
+                   android:textColor="@android:color/white"
+                   android:textSize="10dp"
+                   android:visibility="invisible" />
+           </FrameLayout>-->
+
+        <FrameLayout
+            android:layout_width="0dip"
             android:layout_height="match_parent"
-            android:drawableTop="@drawable/tab_more"
-            android:text="@string/me"
-            android:paddingTop="3dp"/>
-
-        <TextView
-            android:id="@+id/main_tab_five_tv"
-            android:layout_width="10dp"
-            android:layout_height="10dp"
-            android:layout_gravity="top|right"
-            android:layout_marginRight="20dp"
-            android:layout_marginTop="5dp"
-            android:background="@drawable/hongdian"
-            android:gravity="center"
-            android:textColor="@android:color/white"
-            android:textSize="10dp"
-            android:visibility="invisible"/>
-    </FrameLayout>
-
-</com.xzjmyk.pm.activity.view.DivideRadioGroup>
+            android:layout_weight="1"
+            android:background="@null">
+
+            <RadioButton
+                android:id="@+id/main_tab_five"
+                style="@style/IMTabButton"
+                android:layout_width="match_parent"
+                android:layout_height="match_parent"
+                android:drawableTop="@drawable/tab_more"
+                android:paddingTop="7dp"
+                android:text="@string/me"
+                android:textSize="9sp" />
+
+            <TextView
+                android:id="@+id/main_tab_five_tv"
+                android:layout_width="10dp"
+                android:layout_height="10dp"
+                android:layout_gravity="top|right"
+                android:layout_marginRight="28dp"
+                android:background="@drawable/hongdian"
+                android:gravity="center"
+                android:textColor="@android:color/white"
+                android:textSize="7sp"
+                android:visibility="invisible" />
+        </FrameLayout>
+    </com.xzjmyk.pm.activity.view.DivideRadioGroup>
+</RelativeLayout>

+ 21 - 17
app_modular/appcontact/src/main/java/com/uas/appcontact/adapter/FriendSortAdapter.java

@@ -14,10 +14,12 @@ import com.alibaba.fastjson.JSON;
 import com.common.LogUtil;
 import com.common.data.StringUtil;
 import com.common.system.SystemUtil;
+import com.core.app.MyApplication;
 import com.core.model.Friend;
 import com.core.utils.helper.AvatarHelper;
 import com.core.utils.sortlist.BaseSortModel;
 import com.core.widget.crouton.Crouton;
+import com.nostra13.universalimageloader.core.ImageLoader;
 import com.uas.appcontact.R;
 import com.uas.appcontact.db.TopContactsDao;
 
@@ -31,7 +33,7 @@ import java.util.regex.Pattern;
 import se.emilsjolander.stickylistheaders.StickyListHeadersAdapter;
 
 
-public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,StickyListHeadersAdapter {
+public class FriendSortAdapter extends BaseAdapter implements SectionIndexer, StickyListHeadersAdapter {
 
     private Context mContext;
     private List<BaseSortModel<Friend>> mSortFriends;
@@ -100,7 +102,7 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
 //        } else {
 //            holder.tag_tv.setVisibility(View.GONE);
 //        }
-       final Friend friend = mSortFriends.get(position).getBean();
+        final Friend friend = mSortFriends.get(position).getBean();
         final String phone = friend.getPhone();
         if (!StringUtil.isEmpty(phone)) {
             String check = "^((13[0-9])|(15[^4,\\D])|(18[0,5-9]))\\d{8}$";
@@ -118,17 +120,22 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
         /*头像*/
         if (friend.getRoomFlag() == 0) {// 这是单个人
             if (friend.getUserId().equals(Friend.ID_SYSTEM_MESSAGE)) {// 系统消息的头像
-                holder.header_img.setImageResource(R.drawable.im_notice);
+//                holder.header_img.setImageResource(R.drawable.im_notice);
+                ImageLoader.getInstance().displayImage("drawable://" + R.drawable.im_notice, holder.header_img, MyApplication.mAvatarRoundImageOptions);
+
             } else if (friend.getUserId().equals(Friend.ID_NEW_FRIEND_MESSAGE)) {// 新朋友的头像
-                holder.header_img.setImageResource(R.drawable.im_new_friends);
+//                holder.header_img.setImageResource(R.drawable.im_new_friends);
+                ImageLoader.getInstance().displayImage("drawable://" + R.drawable.im_new_friends, holder.header_img, MyApplication.mAvatarRoundImageOptions);
             } else if (Integer.valueOf(friend.getUserId()) == 0) {
-                holder.header_img.setImageResource(R.drawable.avatar_normal);
+//                holder.header_img.setImageResource(R.drawable.avatar_normal);
+                ImageLoader.getInstance().displayImage("drawable://" + R.drawable.avatar_normal, holder.header_img, MyApplication.mAvatarRoundImageOptions);
+
             } else {// 其他
                 if (isRefeshed) {
                     AvatarHelper.getInstance().display(friend.getUserId(), holder.header_img, true, true);//设定为每次刷新都会去删除缓存重新获取数据
                     isRefeshed = false;
                 } else {
-                    AvatarHelper.getInstance().display(friend.getUserId(), holder.header_img, true,true);//不会删除缓存
+                    AvatarHelper.getInstance().display(friend.getUserId(), holder.header_img, true, true);//不会删除缓存
                 }
             }
         } else {// 这是1个房间
@@ -142,7 +149,7 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
         String name = friend.getShowName();
         holder.name_tv.setText(name);
         /*个性签名*/
-        holder.sub_tv.setText(TextUtils.isEmpty(friend.getPhone())?"":friend.getPhone());
+        holder.sub_tv.setText(TextUtils.isEmpty(friend.getPhone()) ? "" : friend.getPhone());
         final View finalConvertView = convertView;
         holder.phone_img.setOnClickListener(new View.OnClickListener() {
             @Override
@@ -153,9 +160,9 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
                     Matcher matcher = regex.matcher(phone.toString());
                     if (matcher.matches()) {
 //                        selectByPhone(phone, finalConvertView);
-                        SystemUtil.phoneAction(mContext,phone);
-                        LogUtil.i("通讯录界面 拨打电话\n"+ JSON.toJSONString(friend));
-                        if (friend!=null){
+                        SystemUtil.phoneAction(mContext, phone);
+                        LogUtil.i("通讯录界面 拨打电话\n" + JSON.toJSONString(friend));
+                        if (friend != null) {
                             friend.setPhone(phone);
                         }
                         TopContactsDao.api().addGoodFriend(friend);
@@ -171,9 +178,6 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
     }
 
 
-
-   
-
     /**
      * 根据ListView的当前位置获取分类的首字母的Char ascii值
      */
@@ -203,12 +207,12 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
     @Override
     public View getHeaderView(int position, View convertView, ViewGroup parent) {
         HeaderViewHolder viewHolder = null;
-        if (convertView == null){
-            convertView = LayoutInflater.from(mContext).inflate(R.layout.layout_head,parent,false);
+        if (convertView == null) {
+            convertView = LayoutInflater.from(mContext).inflate(R.layout.layout_head, parent, false);
             viewHolder = new HeaderViewHolder();
             viewHolder.cityLetterTextView = (TextView) convertView.findViewById(R.id.head);
             convertView.setTag(viewHolder);
-        }else {
+        } else {
             viewHolder = (HeaderViewHolder) convertView.getTag();
         }
         viewHolder.cityLetterTextView.setText(mSortFriends.get(position).getFirstLetter());
@@ -221,7 +225,7 @@ public class FriendSortAdapter extends BaseAdapter implements SectionIndexer,Sti
         return mSortFriends.get(position).getFirstLetter().charAt(0);
     }
 
-    class HeaderViewHolder{
+    class HeaderViewHolder {
         TextView cityLetterTextView;
     }
 

+ 3 - 5
app_modular/appmessages/src/main/java/com/modular/appmessages/activity/MsgsSecondCommonActivity.java

@@ -18,7 +18,6 @@ import android.widget.AdapterView;
 import android.widget.BaseAdapter;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
-import android.widget.ListView;
 import android.widget.PopupWindow;
 import android.widget.TextView;
 
@@ -34,13 +33,12 @@ import com.core.api.wxapi.ApiConfig;
 import com.core.api.wxapi.ApiPlatform;
 import com.core.api.wxapi.ApiUtils;
 import com.core.app.MyApplication;
-import com.core.base.BaseActivity;
+import com.core.base.SupportToolBarActivity;
 import com.core.dao.MessageDao;
 import com.core.model.MessageModel;
 import com.core.net.http.ViewUtil;
 import com.core.utils.CommonUtil;
 import com.core.utils.IntentUtils;
-import com.core.utils.TimeUtils;
 import com.core.widget.EmptyLayout;
 import com.handmark.pulltorefresh.library.PullToRefreshBase;
 import com.handmark.pulltorefresh.library.PullToRefreshListView;
@@ -57,7 +55,7 @@ import java.util.Map;
  * Created by FANGlh on 2017/2/24.
  * function: 消息第二层 通用界面
  */
-public class MsgsSecondCommonActivity extends BaseActivity implements View.OnClickListener {
+public class MsgsSecondCommonActivity extends SupportToolBarActivity implements View.OnClickListener {
     private static final int GET_SECOND_MSGS = 17022801;
     private static final int MSG_MARKED_READED = 0x35;
     private static final int SECOND_MSG_DETAILY = 0x329;
@@ -234,7 +232,7 @@ public class MsgsSecondCommonActivity extends BaseActivity implements View.OnCli
         mark_time = intent.getStringExtra("readTime");
         Log.i("mark_time,msg_type", mark_time + msg_type + "");
         if (!StringUtil.isEmpty(msg_title)) {
-            getSupportActionBar().setTitle(msg_title);
+            setTitle(msg_title);
         }
         if (platform && MyApplication.getInstance().isNetworkActive() && !"kpi".equals(msg_type)) {
             progressDialog.show();

+ 289 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/adapter/MessageNewAdapter.java

@@ -0,0 +1,289 @@
+package com.modular.appmessages.adapter;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.text.Html;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import com.common.data.ListUtils;
+import com.common.data.StringUtil;
+import com.core.app.MyApplication;
+import com.core.model.Friend;
+import com.core.model.XmppMessage;
+import com.core.utils.TimeUtils;
+import com.core.utils.helper.AvatarHelper;
+import com.core.utils.sortlist.BaseSortModel;
+import com.core.widget.RedView;
+import com.core.xmpp.utils.HtmlUtils;
+import com.modular.appmessages.R;
+import com.modular.appmessages.model.MessageHeader;
+import com.modular.appmessages.model.MessageNew;
+
+import java.util.ArrayList;
+import java.util.List;
+
+public class MessageNewAdapter extends RecyclerView.Adapter<MessageNewAdapter.ViewHolder> {
+    private Context ct;
+    private List<MessageNew> models;
+    private List<MessageNew> headerModels, contentModels;
+
+
+    public List<MessageNew> getModels() {
+        return models;
+    }
+
+    public MessageNewAdapter(Context ct) {
+        this.ct = ct;
+        this.models = new ArrayList<>();
+        this.headerModels = new ArrayList<>();
+        this.contentModels = new ArrayList<>();
+    }
+
+    public void addHeadModel(int item, MessageNew model) {
+        if (model == null) {
+            return;
+        }
+        if (this.headerModels == null) {
+            this.headerModels = new ArrayList<>();
+        }
+        if (ListUtils.getSize(this.headerModels) > item) {
+            this.headerModels.add(item, model);
+        } else {
+            this.headerModels.add(model);
+        }
+
+    }
+
+    public void setContentModels(List<MessageNew> contentModels) {
+        if (contentModels != null) {
+            this.models.clear();
+            this.contentModels = contentModels;
+            this.models.addAll(this.headerModels);
+            this.models.addAll(this.contentModels);
+        }
+    }
+
+    public int getHeaderSize() {
+        return ListUtils.getSize(headerModels);
+    }
+
+    public void setHeaderModels(List<MessageNew> models) {
+        if (models != null) {
+            this.models.clear();
+            this.headerModels = models;
+            this.models.addAll(this.headerModels);
+            this.models.addAll(this.contentModels);
+        }
+    }
+
+
+    @Override
+    public ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
+        return new ViewHolder(LayoutInflater.from(ct).inflate(R.layout.item_message_header, viewGroup, false));
+    }
+
+
+    @Override
+    public int getItemCount() {
+        return ListUtils.getSize(models);
+    }
+
+    protected class ViewHolder extends RecyclerView.ViewHolder {
+        private ImageView headerImg;
+        private TextView headerNumTv, titleTv, headerSubTv, timeTv;
+        private RedView headerRv;
+
+        public ViewHolder(View convertView) {
+            super(convertView);
+            headerImg = (ImageView) convertView.findViewById(R.id.headerImg);
+            headerNumTv = (TextView) convertView.findViewById(R.id.headerNumTv);
+            headerRv = (RedView) convertView.findViewById(R.id.headerRv);
+            titleTv = (TextView) convertView.findViewById(R.id.titleTv);
+            headerSubTv = (TextView) convertView.findViewById(R.id.headerSubTv);
+            timeTv = (TextView) convertView.findViewById(R.id.timeTv);
+        }
+    }
+
+
+    @Override
+    public void onBindViewHolder(ViewHolder viewHolder, int i) {
+        MessageNew model = models.get(i);
+        viewHolder.itemView.setTag(R.id.tag_key,i);
+        viewHolder.itemView.setTag(R.id.tag_key2,model);
+        if (model != null && model.getT() != null) {
+            if (model.getT() instanceof MessageHeader) {
+                bindHeader((MessageHeader) model.getT(), viewHolder);
+            } else if (model.getT() instanceof BaseSortModel) {
+                BaseSortModel baseSortModel = (BaseSortModel) model.getT();
+                if (baseSortModel.getBean() instanceof Friend) {
+                    bindView(viewHolder, (Friend) baseSortModel.getBean());
+                }
+            }
+        }
+    }
+
+
+    private void bindHeader(MessageHeader model, ViewHolder hodler) {
+        hodler.itemView.setOnLongClickListener(null);
+        hodler.itemView.setOnClickListener(mOnClickListener);
+        if (model != null) {
+            hodler.headerImg.setImageResource(model.getIcon());
+            if (model.getRedNum() > 0) {
+                hodler.headerNumTv.setVisibility(View.VISIBLE);
+                hodler.headerNumTv.setText(String.valueOf(model.getRedNum()));
+            } else {
+                hodler.headerNumTv.setVisibility(View.GONE);
+                hodler.headerNumTv.setText("");
+            }
+            hodler.titleTv.setText(model.getName());
+            hodler.headerSubTv.setText(model.getSubDoc());
+            if (model.isHideRed()) {
+                hodler.headerRv.setVisibility(View.GONE);
+                hodler.timeTv.setVisibility(View.VISIBLE);
+                hodler.timeTv.setText(model.getTime());
+            } else {
+                hodler.headerRv.setVisibility(View.VISIBLE);
+                hodler.headerRv.setName(model.getRedMessage());
+                hodler.timeTv.setVisibility(View.GONE);
+            }
+        }
+    }
+
+    private View.OnLongClickListener mOnLongClickListener = new View.OnLongClickListener() {
+        @Override
+        public boolean onLongClick(View view) {
+
+            if (mItemTouchListener != null && view != null) {
+                Object tag = view.getTag(R.id.tag_key);
+                if (tag != null && tag instanceof Integer) {
+                    int id = (int) tag;
+                    mItemTouchListener.longClick(id);
+                }
+            }
+            return false;
+        }
+    };
+    private View.OnClickListener mOnClickListener = new View.OnClickListener() {
+        @Override
+        public void onClick(View view) {
+            if (mItemTouchListener != null && view != null) {
+                Object tag = view.getTag(R.id.tag_key);
+                Object tag2 = view.getTag(R.id.tag_key2);
+                if (tag != null && tag instanceof Integer && tag2 != null && tag2 instanceof MessageNew) {
+                    int id = (int) tag;
+                    MessageNew model = (MessageNew) tag2;
+                    mItemTouchListener.click(id, model);
+                }
+            }
+        }
+    };
+
+    private void bindView(ViewHolder holder, Friend friend) {
+        holder.itemView.setOnLongClickListener(mOnLongClickListener);
+        holder.itemView.setOnClickListener(mOnClickListener);
+        holder.headerImg.setBackgroundResource(R.color.transparent);
+        //设置头像
+        if (friend.getType() == XmppMessage.TYPE_ERP) {
+            doShowMsgPhotos(holder, friend);
+            holder.timeTv.setText(TimeUtils.getFriendlyTimeDesc(MyApplication.getInstance(), friend.getTimeSend()));
+        } else if (friend.getType() == XmppMessage.TYPE_UUHELPER) {
+            holder.timeTv.setText(TimeUtils.getFriendlyTimeDesc(MyApplication.getInstance(), friend.getTimeSend()));
+            holder.headerImg.setImageResource(R.drawable.icon_uuhelper);
+        } else {
+            if (friend.getRoomFlag() == 0) {// 这是单个人
+                AvatarHelper.getInstance().display(friend.getUserId(), holder.headerImg, false, false);//每次刷新都会去删除此人缓存
+            } else {
+                if (TextUtils.isEmpty(friend.getRoomCreateUserId())) {
+                    holder.headerImg.setImageResource(R.drawable.qunliao);
+                } else {
+                    AvatarHelper.getInstance().displayAvatarPng(friend.getRoomCreateUserId(), holder.headerImg, true);// 目前在备注名放房间的创建者Id
+                }
+            }
+            holder.timeTv.setText(TimeUtils.getFriendlyTimeDesc(MyApplication.getInstance(), friend.getTimeSend()));
+        }
+
+        //设置名字和时间
+        holder.titleTv.setText(friend.getRemarkName() != null ? friend.getRemarkName() : friend.getNickName());
+        //设置内容数据显示
+        CharSequence content = "";
+        if (friend.getType() == XmppMessage.TYPE_TEXT) {
+            String s = StringUtil.replaceSpecialChar(friend.getContent());
+            content = HtmlUtils.transform200SpanString(s.replaceAll("\n", "\r\n"), true);
+        } else {
+            content = friend.getContent();
+        }
+        if (!TextUtils.isEmpty(content)) {
+            holder.headerSubTv.setText(Html.fromHtml(content.toString()));
+        } else {
+            holder.headerSubTv.setText("");
+        }
+        //设置红点显示数量
+        if (friend.getUnReadNum() > 0) {
+            String numStr = friend.getUnReadNum() >= 99 ? "99+" : friend.getUnReadNum() + "";
+            holder.headerNumTv.setText(numStr);
+            holder.headerNumTv.setVisibility(View.VISIBLE);
+        } else {
+            holder.headerNumTv.setVisibility(View.GONE);
+        }
+
+    }
+
+    private void doShowMsgPhotos(ViewHolder holder, Friend friend) {
+        String msg_type = friend.getDescription();
+        if (!TextUtils.isEmpty(msg_type)) {
+            int imageurl = 0;
+            switch (msg_type) {
+                case "note": // 通知公告
+                    imageurl = R.drawable.home_image_03_u;
+                    break;
+                case "common": // 普通知会
+                    imageurl = R.drawable.putongzhihui;
+                    break;
+                case "b2b": // b2b提醒
+                    imageurl = R.drawable.b2btixing;
+                    break;
+                case "crm":  // CRM提醒
+                    imageurl = R.drawable.crmtixing;
+                    break;
+                case "kpi": // 考勤提醒
+                    imageurl = R.drawable.kaoqintixing;
+                    break;
+                case "meeting": // 会议提醒
+                    imageurl = R.drawable.huiyitixing;
+                    break;
+                case "process": // 审批知会
+                    imageurl = R.drawable.shenpizhihui;
+                    break;
+                case "job": // 稽核提醒
+                    imageurl = R.drawable.jihetixing;
+                    break;
+                case "system": // 知会消息
+                    imageurl = R.drawable.zhihuixiaoxi;
+                    break;
+                case "task": // 任务提醒
+                    imageurl = R.drawable.home_image_02_u;
+                    break;
+                default:
+                    imageurl = R.drawable.gongzuotixing;
+            }
+            holder.headerImg.setImageResource(imageurl);
+        }
+    }
+
+    private ItemTouchListener mItemTouchListener;
+
+    public void setItemTouchListener(ItemTouchListener mItemTouchListener) {
+        this.mItemTouchListener = mItemTouchListener;
+    }
+
+    public interface ItemTouchListener {
+        void longClick(int id);
+
+        void click(int id, MessageNew messageNew);
+    }
+}

+ 0 - 33
app_modular/appmessages/src/main/java/com/modular/appmessages/fragment/MessageNewFragment.java

@@ -1,33 +0,0 @@
-package com.modular.appmessages.fragment;
-
-import android.os.Bundle;
-import android.support.v7.widget.RecyclerView;
-
-import com.core.base.EasyFragment;
-import com.modular.appmessages.R;
-
-/**
- * Created by Bitlike on 2018/5/2.
- */
-
-public class MessageNewFragment extends EasyFragment {
-    private RecyclerView mRecyclerView;
-
-    @Override
-    protected int inflateLayoutId() {
-        return R.layout.fragment_message;
-    }
-
-    @Override
-    protected void onCreateView(Bundle savedInstanceState, boolean createView) {
-        if (createView) {
-            initView();
-        }
-    }
-
-    private void initView() {
-        mRecyclerView = (RecyclerView) findViewById(R.id.messageRecycler);
-    }
-
-
-}

+ 61 - 28
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java

@@ -54,6 +54,7 @@ import com.modular.appmessages.activity.Subscription2Activity;
 import com.modular.appmessages.activity.UUHelperActivity;
 import com.modular.appmessages.db.SubsDao;
 import com.modular.appmessages.model.MessageHeader;
+import com.modular.appmessages.model.MessageNew;
 import com.modular.appmessages.model.SubMessage;
 import com.modular.appmessages.presenter.imp.IMessageView;
 import com.modular.appmessages.util.ApprovalUtil;
@@ -719,6 +720,7 @@ public class MessagePresenter implements OnHttpResultListener {
     private void showByEndIm() {
         iMessageView.clearSearch();
         iMessageView.showModel(mFriendList);
+        iMessageView.showModel(mFriendList);
         updateForUnReader();
     }
 
@@ -967,7 +969,7 @@ public class MessagePresenter implements OnHttpResultListener {
      * @param mContext
      * @param position
      */
-    public void turn2NextAct(Activity mContext, int position) throws Exception {
+    public void turn2NextAct(Activity mContext, int position) {
         Friend friend = mFriendList.get(position).getBean();
         if (friend == null) {
             return;
@@ -1079,8 +1081,7 @@ public class MessagePresenter implements OnHttpResultListener {
 
 
     private void initHeaderModels() {
-        List<MessageHeader> models = new ArrayList<>();
-        MessageHeader model = null;
+        List<MessageNew> models = new ArrayList<>();
         String role = CommonUtil.getUserRole();
         if (role.equals("1")) {//个人用户
             models.addAll(getPersonalHeader());
@@ -1089,47 +1090,58 @@ public class MessagePresenter implements OnHttpResultListener {
         } else {
             models.addAll(getErpHeader());
         }
+
         if (PreferenceUtils.getInt("UUSTEP", -1) == 1) {
             //显示UU运动
-            model = new MessageHeader(StringUtil.getMessage(R.string.set_sport));
+            MessageNew h=new MessageNew();
+            MessageHeader  model = new MessageHeader(StringUtil.getMessage(R.string.set_sport));
             model.setIcon(R.drawable.uu_run);
             model.setSubDoc("");
             model.setRedKey(Constants.MESSAGE_RUN);
             model.setType(3);
             model.setTag("");
-            models.add(model);
+            h.setT(model);
+            models.add(h);
         }
 
         if (SwitchUtil.showShebeiguanli()) {
-            model = new MessageHeader("设备管理");
+            MessageNew h=new MessageNew();
+            MessageHeader    model = new MessageHeader("设备管理");
             model.setIcon(R.drawable.uu_run);
             model.setSubDoc("");
             model.setRedKey(Constants.MESSAGE_RUN);
             model.setType(10);
             model.setTag("");
-            models.add(model);
+            h.setT(model);
+            models.add(h);
         }
         iMessageView.updateHeader(models);
     }
 
-    private List<MessageHeader> getErpHeader() {
-        List<MessageHeader> models = new ArrayList<>();
+    private  List<MessageNew> getErpHeader() {
+        List<MessageNew> models = new ArrayList<>();
+
+        MessageNew h=new MessageNew();
         MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.msg_approval));
         model.setIcon(R.drawable.home_image_01_u);
         model.setSubDoc("");
         model.setRedKey("");
         model.setType(4);
         model.setTag("");
-        models.add(model);
+        h.setT(model);
+        models.add(h);
 
+        h=new MessageNew();
         model = new MessageHeader(StringUtil.getMessage(R.string.msg_work));
         model.setIcon(R.drawable.daibangongzuo);
         model.setSubDoc("");
         model.setRedKey("");
         model.setType(5);
         model.setTag("");
-        models.add(model);
+        h.setT(model);
+        models.add(h);
 
+        h=new MessageNew();
         model = new MessageHeader(StringUtil.getMessage(R.string.msg_subscribe));
         model.setIcon(R.drawable.tingyue);
         model.setSubDoc("");
@@ -1137,80 +1149,96 @@ public class MessagePresenter implements OnHttpResultListener {
         model.setRedMessage(StringUtil.getMessage(R.string.msg_subscribe_data));
         model.setType(6);
         model.setTag("");
-        models.add(model);
-
+        h.setT(model);
+        models.add(h);
 
+        h=new MessageNew();
         model = new MessageHeader(StringUtil.getMessage(R.string.booking_menu));
         model.setIcon(R.drawable.icon_yuyue3);
         model.setSubDoc("");
         model.setRedKey(Constants.MESSAGE_YUYUE);
         model.setType(2);
         model.setTag("");
-        models.add(model);
+        h.setT(model);
+        models.add(h);
         return models;
     }
 
-    private List<MessageHeader> getB2bHeader() {
-        List<MessageHeader> models = new ArrayList<>();
+    private  List<MessageNew> getB2bHeader() {
+        List<MessageNew> models = new ArrayList<>();
+        MessageNew h=new MessageNew();
         MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.msg_approval));
         model.setIcon(R.drawable.home_image_01_u);
         model.setSubDoc("");
         model.setRedKey("");
         model.setType(4);
         model.setTag("");
-        models.add(model);
+        h.setT(model);
+        models.add(h);
 
+        h=new MessageNew();
         model = new MessageHeader(StringUtil.getMessage(R.string.msg_work));
         model.setIcon(R.drawable.daibangongzuo);
         model.setSubDoc("");
         model.setRedKey("");
         model.setType(5);
         model.setTag("");
-        models.add(model);
+        h.setT(model);
+        models.add(h);
 
+        h=new MessageNew();
         model = new MessageHeader(StringUtil.getMessage(R.string.booking_menu));
         model.setIcon(R.drawable.icon_yuyue3);
         model.setSubDoc("");
         model.setRedKey(Constants.MESSAGE_YUYUE);
         model.setType(2);
         model.setTag("");
-        models.add(model);
+        h.setT(model);
+        models.add(h);
         return models;
     }
 
-    private List<MessageHeader> getPersonalHeader() {
-        List<MessageHeader> models = new ArrayList<>();
+    private List<MessageNew> getPersonalHeader() {
+        List<MessageNew> models = new ArrayList<>();
+        MessageNew header=new MessageNew();
         MessageHeader model = new MessageHeader(StringUtil.getMessage(R.string.booking_menu));
         model.setIcon(R.drawable.icon_yuyue3);
         model.setSubDoc("");
         model.setRedKey(Constants.MESSAGE_YUYUE);
         model.setType(2);
         model.setTag("");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
 
+        header=new MessageNew();
         model = new MessageHeader("餐饮");
         model.setIcon(R.drawable.icon_food);
         model.setSubDoc("美味齐全");
         model.setRedKey(Constants.MESSAGE_FOOD);
         model.setType(1);
         model.setTag("10003");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
 
+        header=new MessageNew();
         model = new MessageHeader("美容美发");
         model.setIcon(R.drawable.icon_hair);
         model.setSubDoc("时尚潮流");
         model.setRedKey(Constants.MESSAGE_HAIR);
         model.setType(1);
         model.setTag("10004");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
 
+        header=new MessageNew();
         model = new MessageHeader("KTV");
         model.setIcon(R.drawable.icon_ktv);
         model.setSubDoc("音乐节");
         model.setRedKey(Constants.MESSAGE_KTV);
         model.setType(1);
         model.setTag("10006");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
 
         model = new MessageHeader("运动健身");
         model.setIcon(R.drawable.icon_sport);
@@ -1218,23 +1246,28 @@ public class MessagePresenter implements OnHttpResultListener {
         model.setRedKey(Constants.MESSAGE_SPORT);
         model.setType(1);
         model.setTag("10002");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
 
+        header=new MessageNew();
         model = new MessageHeader("会所");
         model.setIcon(R.drawable.icon_club);
         model.setSubDoc("预约有优惠");
         model.setRedKey(Constants.MESSAGE_CLUB);
         model.setType(1);
         model.setTag("10005");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
 
+        header=new MessageNew();
         model = new MessageHeader("医院挂号");
         model.setIcon(R.drawable.icon_hospital);
         model.setSubDoc("您的健康助手");
         model.setRedKey(Constants.MESSAGE_HOSPITAL);
         model.setType(1);
         model.setTag("10001");
-        models.add(model);
+        header.setT(model);
+        models.add(header);
         return models;
     }
 

+ 2 - 2
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/imp/IMessageView.java

@@ -2,7 +2,7 @@ package com.modular.appmessages.presenter.imp;
 
 import com.core.model.Friend;
 import com.core.utils.sortlist.BaseSortModel;
-import com.modular.appmessages.model.MessageHeader;
+import com.modular.appmessages.model.MessageNew;
 
 import java.util.List;
 
@@ -20,7 +20,7 @@ public interface IMessageView  {
 
     void changeNet(boolean workConnected);
 
-    void updateHeader(List<MessageHeader> models);
+    void updateHeader(List<MessageNew> models);
 
     void updateSign(String message);
 

+ 31 - 7
app_modular/appmessages/src/main/res/layout/fragment_message.xml

@@ -1,13 +1,37 @@
-<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:background="@color/base_bg">
+    android:background="#ebe9e9"
+    android:orientation="vertical">
+
+    <com.core.widget.VoiceSearchView
+        android:id="@+id/voiceSearchView"
+        android:layout_width="match_parent"
+        android:layout_height="48dp"
+        android:visibility="gone" />
+
+    <com.core.widget.DrawableCenterTextView
+        android:id="@+id/message_net_set"
+        android:layout_width="match_parent"
+        android:layout_height="35dp"
+        android:background="#fcd8d8"
+        android:drawableLeft="@drawable/ic_net_noticce"
+        android:drawablePadding="10dp"
+        android:gravity="center_vertical"
+        android:text="当前网络不可用,请检查您的网络设置"
+        android:textColor="@color/black"
+        android:visibility="gone" />
 
-<android.support.v7.widget.RecyclerView
-    android:id="@+id/messageRecycler"
-    android:layout_width="match_parent"
-    android:layout_height="match_parent"/>
 
+    <com.modular.appmessages.widget.SignRefreshLayout
+        android:id="@+id/mSignRefreshLayout"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent">
 
+        <android.support.v7.widget.RecyclerView
+            android:id="@+id/mRecyclerView"
+            android:layout_width="match_parent"
+            android:layout_height="match_parent" />
+    </com.modular.appmessages.widget.SignRefreshLayout>
 
-</RelativeLayout>
+</LinearLayout>

+ 2 - 2
app_modular/appmessages/src/main/res/layout/item_message_header.xml

@@ -17,8 +17,8 @@
 
         <de.hdodenhof.circleimageview.CircleImageView
             android:id="@+id/headerImg"
-            android:layout_width="wrap_content"
-            android:layout_height="wrap_content"
+            android:layout_width="42dp"
+            android:layout_height="42dp"
             android:layout_gravity="center_vertical"
             android:background="@color/transparent"
             android:contentDescription="@string/app_name"