Browse Source

修改UI前备份

Bitliker 7 years ago
parent
commit
14433fd7f3
22 changed files with 761 additions and 147 deletions
  1. 1 0
      WeiChat/src/main/java/com/xzjmyk/pm/activity/ui/message/MessageFragment.java
  2. 3 3
      WeiChat/version.properties
  3. 2 2
      app_core/message/src/main/java/com/me/message/imp/BaseToastImpl.java
  4. 33 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/fragment/MessageNewFragment.java
  5. 0 24
      app_modular/appmessages/src/main/java/com/modular/appmessages/model/MessageModel.java
  6. 109 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/model/MessageNew.java
  7. 23 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessageNewPresenter.java
  8. 2 12
      app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java
  9. 0 102
      app_modular/appmessages/src/main/java/com/modular/appmessages/ui/MessageHeaderView.java
  10. 472 0
      app_modular/appmessages/src/main/java/com/modular/appmessages/widget/SignRefreshLayout.java
  11. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/bg_message_sign.png
  12. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/ic_sign.png
  13. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/ic_sign_off.png
  14. BIN
      app_modular/appmessages/src/main/res/drawable-xxhdpi/ic_sign_work.png
  15. 7 0
      app_modular/appmessages/src/main/res/drawable/ic_baseutil_simple_load.xml
  16. 9 0
      app_modular/appmessages/src/main/res/drawable/ic_refresh_pull_down.xml
  17. 4 0
      app_modular/appmessages/src/main/res/drawable/ic_refresh_pull_up.xml
  18. 4 3
      app_modular/appmessages/src/main/res/layout/fragment_message.xml
  19. 10 0
      app_modular/appmessages/src/main/res/layout/header_sign.xml
  20. 46 0
      app_modular/appmessages/src/main/res/layout/refresh_sign_header.xml
  21. 36 0
      app_modular/appmessages/src/main/res/layout/refresh_simple_header.xml
  22. 0 1
      app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java

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

@@ -59,6 +59,7 @@ import java.util.List;
 /**
  * Created by Bitliker on 2017/3/1.
  */
+@Deprecated
 public class MessageFragment extends EasyFragment implements IMessageView, View.OnClickListener {
 
     @ViewInject(R.id.voiceSearchView)

+ 3 - 3
WeiChat/version.properties

@@ -1,5 +1,5 @@
-#Wed Apr 25 19:30:39 CST 2018
-debugName=149
+#Wed May 02 17:21:45 CST 2018
+debugName=152
 versionName=613
-debugCode=149
+debugCode=152
 versionCode=152

+ 2 - 2
app_core/message/src/main/java/com/me/message/imp/BaseToastImpl.java

@@ -75,8 +75,8 @@ public class BaseToastImpl implements BaseToast {
         if (ct == null) ct = Utils.getContext();
         NotificationManager mNotificationManager = (NotificationManager) ct.getSystemService(Context.NOTIFICATION_SERVICE);
         NotificationCompat.Builder builder = new NotificationCompat.Builder(ct.getApplicationContext());
-        builder.setSmallIcon(R.drawable.uuu);
-        builder.setLargeIcon(BitmapFactory.decodeResource(ct.getResources(), R.drawable.uuu)); // 设置下拉列表中的图标(大图标)
+        builder.setSmallIcon(0);
+        builder.setLargeIcon(BitmapFactory.decodeResource(ct.getResources(),0)); // 设置下拉列表中的图标(大图标)
         builder.setDefaults(Notification.DEFAULT_SOUND | Notification.DEFAULT_VIBRATE);
         builder.setAutoCancel(true);
         builder.setContentTitle(title);

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

@@ -0,0 +1,33 @@
+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);
+    }
+
+
+}

+ 0 - 24
app_modular/appmessages/src/main/java/com/modular/appmessages/model/MessageModel.java

@@ -1,24 +0,0 @@
-package com.modular.appmessages.model;
-
-import android.content.Context;
-import android.content.Intent;
-
-/**
- * Created by Bitlike on 2017/12/15.
- */
-
-public class MessageModel<T> {
-    private int type;//0.头文件  1.正常数据
-    private int imageId;//头像图片
-    private int unRedNum;//未阅读的个数
-    private long lastTime;//最后一条消息时间
-    private String imageUrl;//头像网址
-    private String title;//标题
-    private String summary;//简介
-    private String remindAble;//是否显示提醒
-    private String remindMessage;//提醒的信息
-    private Class cazz;
-    private T t;
-
-
-}

+ 109 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/model/MessageNew.java

@@ -0,0 +1,109 @@
+package com.modular.appmessages.model;
+
+/**
+ * 新UI的消息对象
+ * Created by Bitlike on 2018/5/2.
+ */
+
+public class MessageNew<T> {
+    private int type;//0.头文件  1.正常数据
+    private int imageId;//头像图片(本地资源)
+    private int unRedNum;//未阅读的个数
+    private long lastTime;//最后一条消息时间
+    private String imageUrl;//头像网址
+    private String title;//标题
+    private String summary;//简介
+    private String remindAble;//是否显示提醒
+    private String remindMessage;//提醒的信息
+    private Class cazz;
+    private T t;
+
+
+    public int getType() {
+        return type;
+    }
+
+    public void setType(int type) {
+        this.type = type;
+    }
+
+    public int getImageId() {
+        return imageId;
+    }
+
+    public void setImageId(int imageId) {
+        this.imageId = imageId;
+    }
+
+    public int getUnRedNum() {
+        return unRedNum;
+    }
+
+    public void setUnRedNum(int unRedNum) {
+        this.unRedNum = unRedNum;
+    }
+
+    public long getLastTime() {
+        return lastTime;
+    }
+
+    public void setLastTime(long lastTime) {
+        this.lastTime = lastTime;
+    }
+
+    public String getImageUrl() {
+        return imageUrl;
+    }
+
+    public void setImageUrl(String imageUrl) {
+        this.imageUrl = imageUrl;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public String getSummary() {
+        return summary;
+    }
+
+    public void setSummary(String summary) {
+        this.summary = summary;
+    }
+
+    public String getRemindAble() {
+        return remindAble;
+    }
+
+    public void setRemindAble(String remindAble) {
+        this.remindAble = remindAble;
+    }
+
+    public String getRemindMessage() {
+        return remindMessage;
+    }
+
+    public void setRemindMessage(String remindMessage) {
+        this.remindMessage = remindMessage;
+    }
+
+    public Class getCazz() {
+        return cazz;
+    }
+
+    public void setCazz(Class cazz) {
+        this.cazz = cazz;
+    }
+
+    public T getT() {
+        return t;
+    }
+
+    public void setT(T t) {
+        this.t = t;
+    }
+}

+ 23 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessageNewPresenter.java

@@ -0,0 +1,23 @@
+package com.modular.appmessages.presenter;
+
+
+import com.modular.appmessages.model.MessageNew;
+
+import java.util.List;
+
+/**
+ * Created by Bitlike on 2018/5/2.
+ */
+
+public class MessageNewPresenter {
+
+    private List<MessageNew> headerModels;
+
+
+
+
+
+
+
+
+}

+ 2 - 12
app_modular/appmessages/src/main/java/com/modular/appmessages/presenter/MessagePresenter.java

@@ -47,7 +47,6 @@ import com.modular.appmessages.activity.ApprovalListActivity;
 import com.modular.appmessages.activity.BusinessTargetsActivity;
 import com.modular.appmessages.activity.MsgsSecondCommonActivity;
 import com.modular.appmessages.activity.ProcessB2BActivity;
-import com.modular.appmessages.activity.ProcessMsgActivity;
 import com.modular.appmessages.activity.RealTimeFormActivity;
 import com.modular.appmessages.activity.Subscription2Activity;
 import com.modular.appmessages.activity.UUHelperActivity;
@@ -73,7 +72,7 @@ import java.util.Map;
 /**
  * Created by Bitliker on 2017/3/1.
  */
-
+@Deprecated
 public class MessagePresenter implements OnHttpResultListener {
     private final int LOAD_EMNEWS = 0x11;
     private final int LOAD_SUBS = 0x12;
@@ -530,16 +529,7 @@ public class MessagePresenter implements OnHttpResultListener {
                 long time = JSONUtil.getLong(array.getJSONObject(0), "CREATEDATE_");
                 sub = TimeUtils.getFriendlyTimeDesc(ct, (int) (time / 1000));
             }
-//            messages = JSON.parseArray(object.getJSONArray("data").toJSONString(), SubscriptionMessage.class);
-//            if (ListUtils.isEmpty(messages)) {
-//                showsubsNum(0, "", "");
-//                return;
-//            }
-//            for (SubscriptionMessage e : messages) {
-//                if (e.getSTATUS_() == 0) {
-//                    num += 1;
-//                }
-//            }
+
         }
         showsubsNum(num, title, sub);
     }

+ 0 - 102
app_modular/appmessages/src/main/java/com/modular/appmessages/ui/MessageHeaderView.java

@@ -1,102 +0,0 @@
-package com.modular.appmessages.ui;
-
-import android.content.Context;
-import android.graphics.drawable.Drawable;
-import android.text.Html;
-import android.util.AttributeSet;
-import android.view.LayoutInflater;
-import android.widget.ImageView;
-import android.widget.RelativeLayout;
-import android.widget.TextView;
-
-import com.core.utils.TimeUtils;
-import com.modular.appmessages.R;
-
-/**
- * Created by Bitliker on 2017/9/11.
- */
-
-public class MessageHeaderView extends RelativeLayout {
-    private TextView timeTV, numUnReadTV, titleTV, messageTV;
-    private ImageView headIMG;
-
-    public MessageHeaderView(Context context) {
-        this(context, null);
-    }
-
-    public MessageHeaderView(Context context, AttributeSet attrs) {
-        super(context, attrs);
-        LayoutInflater.from(context).inflate(R.layout.incule_item_message, this);
-        timeTV = (TextView) findViewById(R.id.timeTV);
-        numUnReadTV = (TextView) findViewById(R.id.numUnReadTV);
-        titleTV = (TextView) findViewById(R.id.titleTV);
-        messageTV = (TextView) findViewById(R.id.messageTV);
-        headIMG = (ImageView) findViewById(R.id.headIMG);
-
-
-    }
-
-    private void initTypedArray(Context context, AttributeSet attrs) {
-//        TypedArray attr = context.getTypedArray(context, attrs, R.styleable.ShadowLayout);
-    }
-
-
-    public void setNumUnRead(int number) {
-        if (number > 0) {
-            numUnReadTV.setText(String.valueOf(number));
-            if (numUnReadTV.getVisibility() == GONE) {
-                numUnReadTV.setVisibility(VISIBLE);
-            }
-        } else {
-            numUnReadTV.setVisibility(GONE);
-        }
-    }
-
-
-    public void setTitle(String title) {
-        if (title != null) {
-            titleTV.setText(title);
-        }
-    }
-
-    public void setMessage(String message) {
-        if (message != null) {
-            messageTV.setText(Html.fromHtml(message));
-        }
-    }
-
-    public void setHeadImg(int reId) {
-        if (reId > 0) {
-            headIMG.setImageResource(reId);
-        }
-    }
-
-    public void setTime(String time) {
-        if (time != null) {
-            timeTV.setText(time);
-            drawablesTimeTV(0);
-        }
-    }
-
-    public void setTime(long time) {
-        if (time > 0) {
-            timeTV.setText(TimeUtils.getFriendlyTimeDesc(getContext(), (int) time));
-            drawablesTimeTV(0);
-        }
-    }
-
-    public void setUnreadTag(String text) {
-        if (text != null) {
-            timeTV.setText(text);
-            drawablesTimeTV(R.drawable.hongdian);
-        }
-    }
-
-    public void drawablesTimeTV(int reId) {
-        Drawable drawable = null;
-        if (reId > 0) {
-            drawable = getContext().getResources().getDrawable(reId);
-        }
-        timeTV.setCompoundDrawables(null, null, null, drawable);
-    }
-}

+ 472 - 0
app_modular/appmessages/src/main/java/com/modular/appmessages/widget/SignRefreshLayout.java

@@ -0,0 +1,472 @@
+package com.modular.appmessages.widget;
+
+import android.content.Context;
+import android.os.Handler;
+import android.os.Looper;
+import android.os.Message;
+import android.support.v7.widget.RecyclerView;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.animation.Animation;
+import android.view.animation.LinearInterpolator;
+import android.view.animation.RotateAnimation;
+import android.widget.ImageView;
+import android.widget.RelativeLayout;
+import android.widget.ScrollView;
+import android.widget.Scroller;
+import android.widget.TextView;
+
+import com.common.LogUtil;
+import com.common.system.DisplayUtil;
+import com.modular.appmessages.R;
+import com.modular.apputils.widget.EmptyRecyclerView;
+
+
+/**
+ * 1.通过代码setSignShow 弹出打卡头布局
+ * Created by Bitlike on 2018/4/28.
+ */
+
+public class SignRefreshLayout extends ViewGroup {
+    private boolean mEnablePullDown;// 是否允许下拉刷新
+    private boolean mShowSign;// 是否正在显示打卡界面
+    private onRefreshListener mListener;// 事件监听接口
+
+    private LayoutInflater mInflater;// 布局填充器对象
+    private Scroller mLayoutScroller;  // 用于平滑滑动的Scroller对象
+    private final int SCROLL_SPEED = 650;  // Scroller的滑动速度
+    private int mReachBottomScroll; // 当滚动到内容最底部时Y轴所需要滑动的举例
+    private int mEffectiveScroll; // 最小有效滑动距离(滑动超过该距离才视作一次有效的滑动刷新/加载操作)
+    private int lastChildIndex;// 最后一个content-child-view的index
+    private int mLayoutContentHeight; // ViewGroup的内容高度(不包括header与footer的高度)
+
+    private View headerView; //头布局
+    private final int headerHeight;
+
+    public SignRefreshLayout(Context context, AttributeSet attrs) {
+        super(context, attrs);
+        mEffectiveScroll = (int) context.getResources().getDimension(R.dimen.refresh_item_height);
+        // 实例化布局填充器
+        mInflater = LayoutInflater.from(context);
+        // 实例化Scroller
+        mLayoutScroller = new Scroller(context);
+        mEffectiveScroll = headerHeight = DisplayUtil.dip2px(context, 160);
+        mEnablePullDown = true;
+    }
+
+    public void setEnablePullDown(boolean mEnablePullDown) {
+        this.mEnablePullDown = mEnablePullDown;
+    }
+
+    @Override
+    protected void onFinishInflate() {
+        super.onFinishInflate();
+        lastChildIndex = getChildCount() - 1;
+        // 添加上拉刷新部分
+        if (mEnablePullDown) {
+            addLayoutHeader();
+        }
+
+    }
+
+    private void addLayoutHeader() {
+        headerView = getHeader(mInflater);
+        // 通过LayoutInflater获取从布局文件中获取header的view对象
+        // 设置布局参数(宽度为MATCH_PARENT,高度为MATCH_PARENT)
+        RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams
+                (RelativeLayout.LayoutParams.MATCH_PARENT, headerHeight);
+        // 将Header添加进Layout当中
+        addView(headerView, params);
+    }
+
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
+        // 遍历进行子视图的测量工作
+        for (int i = 0; i < getChildCount(); i++) {
+            // 通知子视图进行测量
+            View child = getChildAt(i);
+            measureChild(child, widthMeasureSpec, heightMeasureSpec);
+        }
+    }
+
+    @Override
+    protected void onLayout(boolean changed, int l, int t, int r, int b) {
+        // 重置(避免重复累加)
+        mLayoutContentHeight = 0;
+        // 遍历进行子视图的置位工作
+        for (int index = 0; index < getChildCount(); index++) {
+            View child = getChildAt(index);
+            if (child == headerView) { // 头视图隐藏在ViewGroup的顶端
+                child.layout(0, -DisplayUtil.dip2px(getContext(), 160), child.getMeasuredWidth(), 0);
+            } else { // 内容视图根据定义(插入)顺序,按由上到下的顺序在垂直方向进行排列
+                child.layout(0, mLayoutContentHeight, child.getMeasuredWidth(), mLayoutContentHeight + child.getMeasuredHeight());
+                if (index <= lastChildIndex) {
+                    if (child instanceof ScrollView) {
+                        mLayoutContentHeight += getMeasuredHeight();
+                        continue;
+                    }
+                    mLayoutContentHeight += child.getMeasuredHeight();
+                }
+            }
+        }
+        // 计算到达内容最底部时ViewGroup的滑动距离
+        mReachBottomScroll = mLayoutContentHeight - getMeasuredHeight();
+    }
+
+
+    // 普通状态
+    protected final int NORMAL = 0;
+    // 意图刷新
+    protected final int TRY_REFRESH = 1;
+    // 刷新状态
+    protected final int REFRESH = 2;
+    protected final int SIGN_TRY_REFRESH = 3;
+    protected final int SIGN_REFRESH = 4;
+
+
+    // Layout状态
+    private int status = NORMAL;
+    // 用于计算滑动距离的Y坐标中介
+    private int mLastYMoved, mDownYMoved;
+    // 用于判断是否拦截触摸事件的Y坐标中介
+    private int mLastYIntercept;
+
+    @Override
+    public boolean onInterceptTouchEvent(MotionEvent event) {
+        boolean intercept = false;
+        // 记录此次触摸事件的y坐标
+        int y = (int) event.getY();
+        // 判断触摸事件类型
+        switch (event.getAction()) {
+            // Down事件
+            case MotionEvent.ACTION_DOWN: {
+                // 记录下本次系列触摸事件的起始点Y坐标
+                mDownYMoved = mLastYMoved = y;
+                // 不拦截ACTION_DOWN,因为当ACTION_DOWN被拦截,后续所有触摸事件都会被拦截
+                intercept = false;
+                break;
+            }
+            // Move事件
+            case MotionEvent.ACTION_MOVE: {
+                if (y > mLastYIntercept && mEnablePullDown) { // 下滑操作
+                    // 获取最顶部的子视图
+                    View child = getChildAt(0);
+                    if (child instanceof RecyclerView) {
+                        intercept = rvPullDownIntercept(child);
+                    } else if (child instanceof EmptyRecyclerView) {
+                        RecyclerView recycler = ((EmptyRecyclerView) child);
+                        intercept = rvPullDownIntercept(recycler);
+                    }
+                } else if (y < mLastYIntercept && status != NORMAL) {
+                    intercept = true;
+                } else {
+                    intercept = false;
+                }
+                break;
+            }
+            // Up事件
+            case MotionEvent.ACTION_UP: {
+                intercept = false;
+                break;
+            }
+        }
+        mLastYIntercept = y;
+        Log.i("gong", "intercept=" + intercept);
+        return intercept;
+    }
+
+
+    private boolean rvPullDownIntercept(View child) {
+        boolean intercept = false;
+        RecyclerView recyclerChild = (RecyclerView) child;
+        if (recyclerChild.computeVerticalScrollOffset() <= 0)
+            intercept = true;
+        return intercept;
+    }
+
+
+    private final float effectiveScrollMultiple = 2f;
+
+    @Override
+    public boolean onTouchEvent(MotionEvent event) {
+        int y = (int) event.getY();
+        switch (event.getAction()) {
+            case MotionEvent.ACTION_MOVE: {
+                // 计算本次滑动的Y轴增量(距离)
+                int dy = mLastYMoved - y;
+                // 如果滑动增量小于0,即下拉操作
+                if (dy < 0) {//表示往下滑
+                    if (mEnablePullDown) {
+                        // 如果下拉的距离小于mLayoutHeader1/2的高度,则允许滑动
+                        if (getScrollY() > 0 || Math.abs(getScrollY()) <= mEffectiveScroll * effectiveScrollMultiple) {
+                            scrollBy(0, dy / 2);
+                            if (status != REFRESH) {
+                                if (getScrollY() <= 0) {
+                                    if (status != TRY_REFRESH) {
+                                        updateStatus(TRY_REFRESH);
+                                    } else if (Math.abs(getScrollY()) > mEffectiveScroll) {
+                                        updateStatus(REFRESH);
+                                    }
+                                }
+                            }
+                        }
+                    } else if (mShowSign && Math.abs(getScrollY()) <= mEffectiveScroll) {
+                        scrollBy(0, dy / 2);
+                        if (Math.abs(getScrollY()) > mEffectiveScroll / 2) {
+                            updateStatus(SIGN_REFRESH);
+                        } else {
+                            updateStatus(SIGN_TRY_REFRESH);
+                        }
+                    }
+                } else if (dy > 0) {//上拉
+                    if (mEnablePullDown) {
+                        if (getScrollY() <= mReachBottomScroll + mEffectiveScroll * effectiveScrollMultiple) {
+                            // 进行Y轴上的滑动
+                            if (status != TRY_REFRESH && status != REFRESH) {
+                                scrollBy(0, dy / 2);
+                            } else {
+                                if (getScrollY() <= 0) {
+                                    dy = dy > 30 ? 30 : dy;
+                                    scrollBy(0, dy / 2);
+                                    if (Math.abs(getScrollY()) < mEffectiveScroll)
+                                        updateStatus(TRY_REFRESH);
+                                }
+                            }
+                        }
+                    } else if (mShowSign) {
+                        scrollBy(0, dy / 2);
+                        if (Math.abs(getScrollY()) > mEffectiveScroll / 2) {
+                            updateStatus(SIGN_REFRESH);
+                        } else {
+                            updateStatus(SIGN_TRY_REFRESH);
+                        }
+                    }
+                }
+                // 记录y坐标
+                mLastYMoved = y;
+                break;
+            }
+            case MotionEvent.ACTION_UP: {
+                // 判断本次触摸系列事件结束时,Layout的状态
+                LogUtil.i("gong", "status=" + status);
+                switch (status) {
+                    case NORMAL:
+                        upWithStatusNormal();
+                        break;
+                    case TRY_REFRESH:
+                        upWithStatusTryRefresh();
+                        break;
+                    case REFRESH:
+                        upWithStatusRefresh();
+                        break;
+                    case SIGN_REFRESH:
+                        mLayoutScroller.startScroll(0, getScrollY(), 0, -(getScrollY() - (-mEffectiveScroll)), SCROLL_SPEED);
+                        break;
+                    case SIGN_TRY_REFRESH:
+                        mLayoutScroller.startScroll(0, getScrollY(), 0, -getScrollY(), SCROLL_SPEED);
+                        mUIHandler.postDelayed(new Runnable() {
+                            @Override
+                            public void run() {
+                                showSignView(false);
+                                setEnablePullDown(true);
+                            }
+                        }, SCROLL_SPEED);
+                        break;
+                }
+            }
+        }
+        mLastYIntercept = 0;
+        postInvalidate();
+        return true;
+    }
+
+    private void updateStatus(int status) {
+        if (headerView != null) {
+            upStatus(status);
+        }
+        if (status != NORMAL) {
+            this.status = status;
+        }
+    }
+
+    private void upWithStatusNormal() {
+
+    }
+
+    private void upWithStatusTryRefresh() {
+        // 取消本次的滑动
+        mLayoutScroller.startScroll(0, getScrollY(), 0, -getScrollY(), SCROLL_SPEED);
+        status = NORMAL;
+        if (headerView != null) {
+            stopAnim();
+        }
+    }
+
+
+    private void upWithStatusRefresh() {
+        mLayoutScroller.startScroll(0, getScrollY(), 0, -(getScrollY() - (-mEffectiveScroll)), SCROLL_SPEED);
+        if (headerView != null) {
+            startAnim();
+        }
+        // 通过Listener接口执行刷新时的监听事件
+        if (mListener != null) {
+            mListener.onRefresh();
+        }
+    }
+
+
+    @Override
+    public void computeScroll() {
+        super.computeScroll();
+        if (mLayoutScroller.computeScrollOffset()) {
+            scrollTo(0, mLayoutScroller.getCurrY());
+        }
+        postInvalidate();
+    }
+
+    private final int STOP_REFRESH = 1;
+
+    private Handler mUIHandler = new Handler(Looper.getMainLooper()) {
+        @Override
+        public void handleMessage(Message msg) {
+            switch (msg.what) {
+                case STOP_REFRESH: {
+                    mLayoutScroller.startScroll(0, getScrollY(), 0, -getScrollY(), SCROLL_SPEED);
+                    status = NORMAL;
+                    if (headerView != null) {
+                        stopAnim();
+                    }
+                    break;
+                }
+            }
+        }
+    };
+
+
+    private void stopTryRefresh() {
+        Message msg = mUIHandler.obtainMessage(STOP_REFRESH);
+        mUIHandler.sendMessage(msg);
+    }
+
+
+    public void stopRefresh() {
+        if (status == REFRESH) {
+            stopTryRefresh();
+        }
+        status = NORMAL;
+    }
+
+    public boolean isRefreshing() {
+        return status == REFRESH;
+    }
+
+
+    public void setOnRefreshListener(onRefreshListener listener) {
+        mListener = listener;
+    }
+
+    public interface onRefreshListener {
+        void onRefresh();
+
+    }
+
+    private View signView;
+    private View simplyView;
+    private ImageView statusImg;
+    private TextView statusTV;
+
+    private void showSignView(boolean sign) {
+        if (sign) {
+            mEffectiveScroll = DisplayUtil.dip2px(getContext(), 160);
+            simplyView.setVisibility(GONE);
+            signView.setVisibility(VISIBLE);
+        } else {
+            mEffectiveScroll = DisplayUtil.dip2px(getContext(), 80);
+            simplyView.setVisibility(VISIBLE);
+            signView.setVisibility(GONE);
+        }
+    }
+
+
+    public void setSignShow() {
+        showSignView(true);
+        mLayoutScroller.startScroll(0, getScrollY(), 0, -(getScrollY() - (-mEffectiveScroll)), SCROLL_SPEED);
+        setEnablePullDown(false);
+        updateStatus(SIGN_REFRESH);
+        mShowSign = true;
+    }
+
+
+    private boolean isEnablePullDown() {
+        return simplyView != null && simplyView.getVisibility() == VISIBLE;
+    }
+
+    protected View getHeader(LayoutInflater mInflater) {
+        View view = mInflater.inflate(R.layout.header_sign, null);
+        signView = view.findViewById(R.id.signView);
+        simplyView = view.findViewById(R.id.simplyView);
+        initSimpleView();
+        showSignView(false);
+        return view;
+    }
+
+    private void initSimpleView() {
+        statusImg = simplyView.findViewById(R.id.statusImg);
+        statusTV = simplyView.findViewById(R.id.statusTV);
+
+    }
+
+
+    private void upStatus(int status) {
+        statusImg.setAnimation(null);
+        if (isEnablePullDown()) {
+            switch (status) {
+                case TRY_REFRESH:
+                    statusTV.setText(R.string.pull_down_to_refresh);
+                    statusImg.setImageResource(R.drawable.ic_refresh_pull_down);
+                    break;
+                case REFRESH:
+                    statusTV.setText(R.string.up_to_refresh);
+                    statusImg.setImageResource(R.drawable.ic_refresh_pull_up);
+                    break;
+            }
+        }
+    }
+
+    private void stopAnim() {
+        Log.i("gong", "stopAnim");
+        statusImg.setAnimation(null);
+        statusImg.setImageResource(R.drawable.ic_refresh_pull_down);
+        statusTV.setText(R.string.pull_down_to_refresh);
+
+    }
+
+    private void startAnim() {
+        Log.i("gong", "startAnim");
+        statusTV.setText(R.string.refreshing);
+        statusImg.setImageResource(R.drawable.ic_baseutil_simple_load);
+        statusImg.setAnimation(getImgAnimation());
+    }
+
+    private RotateAnimation rotate;
+
+    private Animation getImgAnimation() {
+        if (rotate == null) {
+            rotate = new RotateAnimation(0f, 360f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
+            LinearInterpolator lin = new LinearInterpolator();
+            rotate.setInterpolator(lin);
+            rotate.setDuration(1000);//设置动画持续时间
+            rotate.setRepeatCount(-1);//设置重复次数
+            rotate.setFillAfter(true);//动画执行完后是否停留在执行完的状态
+            rotate.setStartOffset(10);//执行前的等待时间
+        }
+        return rotate;
+    }
+
+}

BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/bg_message_sign.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/ic_sign.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/ic_sign_off.png


BIN
app_modular/appmessages/src/main/res/drawable-xxhdpi/ic_sign_work.png


File diff suppressed because it is too large
+ 7 - 0
app_modular/appmessages/src/main/res/drawable/ic_baseutil_simple_load.xml


+ 9 - 0
app_modular/appmessages/src/main/res/drawable/ic_refresh_pull_down.xml

@@ -0,0 +1,9 @@
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+    android:width="24dp"
+    android:height="24dp"
+    android:viewportHeight="1024.0"
+    android:viewportWidth="1024.0">
+    <path
+        android:fillColor="#8a8a8a"
+        android:pathData="M512.2,908.7c26.8,0 48.5,-21.7 48.5,-48.5L560.7,112.6c0,-26.8 -21.7,-48.5 -48.5,-48.5l0,0c-26.8,0 -48.5,21.7 -48.5,48.5l0,747.6C463.7,887 485.4,908.7 512.2,908.7L512.2,908.7zM477.8,944.5c18.9,18.9 48.6,20 66.2,2.4l357.2,-357.2c17.6,-17.6 16.5,-47.2 -2.4,-66.2l0,0c-18.9,-18.9 -48.6,-20 -66.2,-2.4l-357.2,357.2C457.8,895.9 458.9,925.6 477.8,944.5L477.8,944.5zM546.6,944.5c18.9,-18.9 20,-48.6 2.4,-66.2l-357.2,-357.2c-17.6,-17.6 -47.2,-16.5 -66.2,2.4l0,0c-18.9,18.9 -20,48.6 -2.4,66.2l357.2,357.2C498.1,964.5 527.7,963.4 546.6,944.5L546.6,944.5z" />
+</vector>

+ 4 - 0
app_modular/appmessages/src/main/res/drawable/ic_refresh_pull_up.xml

@@ -0,0 +1,4 @@
+<vector android:height="24dp" android:viewportHeight="1024.0"
+    android:viewportWidth="1024.0" android:width="24dp" xmlns:android="http://schemas.android.com/apk/res/android">
+    <path android:fillColor="#8a8a8a" android:pathData="M512,113.9c-26.9,0 -48.6,21.8 -48.6,48.6L463.4,912.4c0,26.9 21.8,48.6 48.6,48.6l0,0c26.9,0 48.6,-21.8 48.6,-48.6L560.6,162.5C560.6,135.6 538.9,113.9 512,113.9L512,113.9zM546.5,78c-19,-19 -48.7,-20.1 -66.4,-2.4L121.9,433.8c-17.6,17.7 -16.6,47.4 2.4,66.4l0,0c19,19 48.7,20.1 66.4,2.4l358.3,-358.3C566.6,126.7 565.5,97 546.5,78L546.5,78zM477.5,78c-19,19 -20.1,48.7 -2.4,66.4l358.3,358.3c17.6,17.6 47.4,16.6 66.4,-2.4l0,0c19,-19 20.1,-48.7 2.4,-66.4L543.8,75.5C526.2,57.9 496.5,59 477.5,78L477.5,78z"/>
+</vector>

+ 4 - 3
WeiChat/src/main/res/layout/fragment_message.xml → app_modular/appmessages/src/main/res/layout/fragment_message.xml

@@ -3,9 +3,10 @@
     android:layout_height="match_parent"
     android:background="@color/base_bg">
 
-
-
-
+<android.support.v7.widget.RecyclerView
+    android:id="@+id/messageRecycler"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"/>
 
 
 

+ 10 - 0
app_modular/appmessages/src/main/res/layout/header_sign.xml

@@ -0,0 +1,10 @@
+<?xml version="1.0" encoding="utf-8"?>
+<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="160dp">
+
+    <include layout="@layout/refresh_sign_header" />
+
+    <include layout="@layout/refresh_simple_header" />
+
+</FrameLayout>

+ 46 - 0
app_modular/appmessages/src/main/res/layout/refresh_sign_header.xml

@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    xmlns:app="http://schemas.android.com/apk/res-auto"
+    android:layout_width="match_parent"
+    android:layout_height="160dp"
+    android:id="@+id/signView"
+    android:background="@drawable/bg_message_sign">
+
+    <android.support.v7.widget.AppCompatImageView
+        android:id="@+id/itemSignImage"
+        android:layout_width="66dp"
+        android:layout_height="66dp"
+        android:src="@drawable/ic_sign"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/itemWorkTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:drawableLeft="@drawable/ic_sign_work"
+        android:drawablePadding="4dp"
+        android:text="08:26:20"
+        android:textColor="#FFFFFFFF"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toLeftOf="parent"
+        app:layout_constraintRight_toLeftOf="@id/itemSignImage"
+        app:layout_constraintTop_toTopOf="parent" />
+
+    <android.support.v7.widget.AppCompatTextView
+        android:id="@+id/itemOffkTv"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:drawableLeft="@drawable/ic_sign_off"
+        android:drawablePadding="4dp"
+        android:text="08:26:20"
+        android:textColor="#FFFFFFFF"
+        android:textSize="12sp"
+        app:layout_constraintBottom_toBottomOf="parent"
+        app:layout_constraintLeft_toRightOf="@id/itemSignImage"
+        app:layout_constraintRight_toRightOf="parent"
+        app:layout_constraintTop_toTopOf="parent" />
+</android.support.constraint.ConstraintLayout>

+ 36 - 0
app_modular/appmessages/src/main/res/layout/refresh_simple_header.xml

@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/simplyView"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content"
+    android:background="@color/white"
+    android:gravity="center_horizontal|bottom">
+
+    <LinearLayout
+        android:layout_width="160dp"
+        android:layout_height="wrap_content"
+        android:layout_alignParentBottom="true"
+        android:gravity="center"
+        android:orientation="horizontal"
+        android:paddingBottom="20dp">
+
+        <ImageView
+            android:id="@+id/statusImg"
+            android:layout_width="20dp"
+            android:layout_height="20dp"
+            android:src="@drawable/ic_refresh_pull_down" />
+
+        <TextView
+            android:id="@+id/statusTV"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_centerInParent="true"
+            android:layout_marginLeft="5dp"
+            android:layout_toRightOf="@+id/statusImg"
+            android:gravity="center"
+            android:text="@string/pull_down_to_refresh"
+            android:textSize="16sp" />
+    </LinearLayout>
+
+
+</RelativeLayout>

+ 0 - 1
app_modular/apputils/src/main/java/com/modular/apputils/utils/SwitchUtil.java

@@ -1,7 +1,6 @@
 package com.modular.apputils.utils;
 
 
-import com.common.config.BaseConfig;
 
 /**
  * Created by Bitlike on 2017/11/22.

Some files were not shown because too many files changed in this diff