Forráskód Böngészése

Merge remote-tracking branch 'origin/master' into sheep_tinker_3.0.2

zengjiebin 7 éve
szülő
commit
b3ee69907e
41 módosított fájl, 1438 hozzáadás és 106 törlés
  1. 2 0
      app/build.gradle
  2. 7 0
      app/src/main/java/com/kfzs/duanduan/ActMain.java
  3. 58 0
      app/src/main/java/com/kfzs/duanduan/cardview/BitmapUtils.java
  4. 74 0
      app/src/main/java/com/kfzs/duanduan/cardview/BlurBitmapUtils.java
  5. 61 0
      app/src/main/java/com/kfzs/duanduan/cardview/CardAdapter.java
  6. 46 0
      app/src/main/java/com/kfzs/duanduan/cardview/CardAdapterHelper.java
  7. 24 0
      app/src/main/java/com/kfzs/duanduan/cardview/CardLinearSnapHelper.java
  8. 150 0
      app/src/main/java/com/kfzs/duanduan/cardview/CardScaleHelper.java
  9. 147 0
      app/src/main/java/com/kfzs/duanduan/cardview/LogUtils.java
  10. 38 0
      app/src/main/java/com/kfzs/duanduan/cardview/ScreenUtil.java
  11. 44 0
      app/src/main/java/com/kfzs/duanduan/cardview/SpeedRecyclerView.java
  12. 42 0
      app/src/main/java/com/kfzs/duanduan/cardview/ViewSwitchUtils.java
  13. 87 0
      app/src/main/java/com/kfzs/duanduan/cardview/ViewUtil.java
  14. 1 0
      app/src/main/java/com/kfzs/duanduan/event/EventTypes.java
  15. 72 44
      app/src/main/java/com/kfzs/duanduan/fragment/FgtFindChild.java
  16. 6 0
      app/src/main/java/com/kfzs/duanduan/fragment/FgtMiDong.java
  17. 38 9
      app/src/main/java/com/kfzs/duanduan/fragment/FgtPersonalCenter.java
  18. 45 9
      app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java
  19. 29 1
      app/src/main/java/com/kfzs/duanduan/utils/StatusBarUtils.java
  20. 2 2
      app/src/main/java/com/sheep/gamegroup/helper/TaskHelper.java
  21. 4 5
      app/src/main/java/com/sheep/gamegroup/model/entity/FindItem.java
  22. 1 1
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  23. 19 5
      app/src/main/java/com/sheep/gamegroup/util/Jump2View.java
  24. 13 0
      app/src/main/java/com/sheep/gamegroup/util/ListUtil.java
  25. 161 5
      app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java
  26. 1 1
      app/src/main/java/com/sheep/gamegroup/view/activity/LoginAct.java
  27. 14 6
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAudit.java
  28. 24 0
      app/src/main/java/com/sheep/gamegroup/view/fragment/FgtMainAudit.java
  29. 9 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java
  30. 46 0
      app/src/main/java/com/sheep/jiuyan/samllsheep/utils/G.java
  31. 2 2
      app/src/main/java/org/afinal/simplecache/ApiKey.java
  32. 6 0
      app/src/main/res/drawable/shape_blue_stroke_withe_radius_5.xml
  33. 1 0
      app/src/main/res/layout/activity_main.xml
  34. 78 10
      app/src/main/res/layout/ask_to_share.xml
  35. 30 0
      app/src/main/res/layout/common_foot_view.xml
  36. 0 1
      app/src/main/res/layout/common_tab_vp.xml
  37. 1 1
      app/src/main/res/layout/dialog_redpackage_after_invitation.xml
  38. 30 0
      app/src/main/res/layout/net_empty_xrecycler.xml
  39. 2 0
      app/src/main/res/layout/pop_get_redpackage.xml
  40. 19 0
      app/src/main/res/layout/view_card_item.xml
  41. 4 4
      app/src/main/res/values/strings.xml

+ 2 - 0
app/build.gradle

@@ -127,6 +127,8 @@ repositories {
 }
 
 dependencies {
+    //noinspection GradleCompatible
+    compile 'com.android.support:cardview-v7:28.0.0-rc01'
     compile "com.android.support:design:$supportLibVersion"
     compile 'com.android.support.constraint:constraint-layout:1.0.2'
     testCompile 'junit:junit:4.12'

+ 7 - 0
app/src/main/java/com/kfzs/duanduan/ActMain.java

@@ -1,6 +1,7 @@
 package com.kfzs.duanduan;
 
 import android.annotation.SuppressLint;
+import android.app.Activity;
 import android.content.Intent;
 import android.graphics.Color;
 import android.os.Build;
@@ -11,6 +12,7 @@ import android.view.ViewGroup;
 import android.view.WindowManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 
 import com.kfzs.appstore.utils.restful.KFZSNetwork;
 import com.kfzs.duanduan.event.BigEvent;
@@ -22,6 +24,7 @@ import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.entity.Container;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.G;
 import com.umeng.socialize.UMShareAPI;
 
 import org.greenrobot.eventbus.EventBus;
@@ -42,6 +45,8 @@ public class ActMain extends BaseActivity implements TabsHelper.ItemPosition {
 
     @BindView(R.id.other_container)
     LinearLayout other_container;
+    @BindView(R.id.main_layout)
+    RelativeLayout main_layout;
 
     public final static String INTENT_GAME_ID = "INTEN_GAME_ID";
 
@@ -107,6 +112,7 @@ public class ActMain extends BaseActivity implements TabsHelper.ItemPosition {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
             getWindow().setStatusBarColor(Color.TRANSPARENT);
             getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION	 | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
+            main_layout.setPadding(0, 0, 0, G.getHasVirtualKey(KFZSApp.actMain) -G.getNoHasVirtualKey(KFZSApp.actMain) );
         }
     }
 
@@ -116,6 +122,7 @@ public class ActMain extends BaseActivity implements TabsHelper.ItemPosition {
     private void setStatusVI() {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
             getWindow().setStatusBarColor(Color.parseColor("#29d6fd"));
+            main_layout.setPadding(0, 0, 0, G.getHasVirtualKey(KFZSApp.actMain) -G.getNoHasVirtualKey(KFZSApp.actMain) );
            //getWindow().getDecorView().setSystemUiVisibility(View.SYSTEM_UI_FLAG_VISIBLE | View.SYSTEM_UI_FLAG_LIGHT_STATUS_BAR);
         }
     }

+ 58 - 0
app/src/main/java/com/kfzs/duanduan/cardview/BitmapUtils.java

@@ -0,0 +1,58 @@
+package com.kfzs.duanduan.cardview;
+
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
+
+public class BitmapUtils {
+    public static int MIN_WIDTH = 100;
+
+    /**
+     * 按最大边按一定大小缩放图片
+     *
+     * @param resources
+     * @param resId
+     * @param maxSize 压缩后最大长度
+     * @return
+     */
+    public static Bitmap scaleImage(Resources resources, int resId, int maxSize) {
+        BitmapFactory.Options options = new BitmapFactory.Options();
+        options.inJustDecodeBounds = true;
+        BitmapFactory.decodeResource(resources, resId, options);
+        options.inSampleSize = calculateInSampleSize(options, maxSize, maxSize);
+        options.inJustDecodeBounds = false;
+
+        return BitmapFactory.decodeResource(resources, resId, options);
+    }
+
+    /**
+     * 计算inSampleSize
+     * @param options
+     * @param reqWidth
+     * @param reqHeight
+     * @return
+     */
+    private static int calculateInSampleSize(BitmapFactory.Options options, int reqWidth, int reqHeight) {
+        int height = options.outHeight;
+        int width = options.outWidth;
+        int inSampleSize = 1;
+        if (width < MIN_WIDTH) {
+            return inSampleSize;
+        } else {
+            int heightRatio;
+            if (width > height && reqWidth < reqHeight || width < height && reqWidth > reqHeight) {
+                heightRatio = reqWidth;
+                reqWidth = reqHeight;
+                reqHeight = heightRatio;
+            }
+
+            if (height > reqHeight || width > reqWidth) {
+                heightRatio = Math.round((float) height / (float) reqHeight);
+                int widthRatio = Math.round((float) width / (float) reqWidth);
+                inSampleSize = heightRatio < widthRatio ? widthRatio : heightRatio;
+            }
+
+            return inSampleSize;
+        }
+    }
+}

+ 74 - 0
app/src/main/java/com/kfzs/duanduan/cardview/BlurBitmapUtils.java

@@ -0,0 +1,74 @@
+package com.kfzs.duanduan.cardview;
+
+import android.content.Context;
+import android.graphics.Bitmap;
+
+import android.renderscript.Allocation;
+import android.renderscript.Element;
+import android.renderscript.RenderScript;
+import android.renderscript.ScriptIntrinsicBlur;
+import android.widget.ImageView;
+
+/**
+ * RenderScript图片高斯模糊
+ * Created by jameson on 9/2/16.
+ */
+public class BlurBitmapUtils {
+    /**
+     * 建议模糊度(在0.0到25.0之间)
+     */
+    private static final int BLUR_RADIUS = 20;
+    private static final int SCALED_WIDTH = 100;
+    private static final int SCALED_HEIGHT = 100;
+
+    public static void blur(ImageView imageView, Bitmap bitmap) {
+        blur(imageView, bitmap, BLUR_RADIUS);
+    }
+
+    public static void blur(ImageView imageView, Bitmap bitmap, int radius) {
+        imageView.setImageBitmap(getBlurBitmap(imageView.getContext(), bitmap, radius));
+    }
+
+    public static Bitmap getBlurBitmap(Context context, Bitmap bitmap) {
+        return getBlurBitmap(context, bitmap, BLUR_RADIUS);
+    }
+
+    /**
+     * 得到模糊后的bitmap
+     * thanks http://wl9739.github.io/2016/07/14/教你一分钟实现模糊效果/
+     *
+     * @param context
+     * @param bitmap
+     * @param radius
+     * @return
+     */
+    public static Bitmap getBlurBitmap(Context context, Bitmap bitmap, int radius) {
+        // 将缩小后的图片做为预渲染的图片。
+        Bitmap inputBitmap = Bitmap.createScaledBitmap(bitmap, SCALED_WIDTH, SCALED_HEIGHT, false);
+        // 创建一张渲染后的输出图片。
+        Bitmap outputBitmap = Bitmap.createBitmap(inputBitmap);
+
+        // 创建RenderScript内核对象
+        RenderScript rs = RenderScript.create(context);
+        // 创建一个模糊效果的RenderScript的工具对象
+        ScriptIntrinsicBlur blurScript = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
+
+        // 由于RenderScript并没有使用VM来分配内存,所以需要使用Allocation类来创建和分配内存空间。
+        // 创建Allocation对象的时候其实内存是空的,需要使用copyTo()将数据填充进去。
+        Allocation tmpIn = Allocation.createFromBitmap(rs, inputBitmap);
+        Allocation tmpOut = Allocation.createFromBitmap(rs, outputBitmap);
+
+        // 设置渲染的模糊程度, 25f是最大模糊度
+        blurScript.setRadius(radius);
+        // 设置blurScript对象的输入内存
+        blurScript.setInput(tmpIn);
+        // 将输出数据保存到输出内存中
+        blurScript.forEach(tmpOut);
+
+        // 将数据填充到Allocation中
+        tmpOut.copyTo(outputBitmap);
+
+        return outputBitmap;
+    }
+
+}

+ 61 - 0
app/src/main/java/com/kfzs/duanduan/cardview/CardAdapter.java

@@ -0,0 +1,61 @@
+package com.kfzs.duanduan.cardview;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.utils.G;
+
+import java.util.ArrayList;
+import java.util.List;
+
+
+/**
+ * Created by jameson on 8/30/16.
+ */
+public class CardAdapter extends RecyclerView.Adapter<CardAdapter.ViewHolder> {
+    private List<Integer> mList = new ArrayList<>();
+    private CardAdapterHelper mCardAdapterHelper = new CardAdapterHelper();
+
+    public CardAdapter(List<Integer> mList) {
+        this.mList = mList;
+    }
+
+    @Override
+    public ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
+        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.view_card_item, parent, false);
+        mCardAdapterHelper.onCreateViewHolder(parent, itemView);
+        return new ViewHolder(itemView);
+    }
+
+    @Override
+    public void onBindViewHolder(final ViewHolder holder, final int position) {
+        mCardAdapterHelper.onBindViewHolder(holder.itemView, position, getItemCount());
+        holder.mImageView.setImageResource(mList.get(position));
+        holder.mImageView.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+               G.showToast( "" + position);
+            }
+        });
+    }
+
+    @Override
+    public int getItemCount() {
+        return mList.size();
+    }
+
+    public class ViewHolder extends RecyclerView.ViewHolder {
+        public final ImageView mImageView;
+
+        public ViewHolder(final View itemView) {
+            super(itemView);
+            mImageView = (ImageView) itemView.findViewById(R.id.imageView);
+        }
+
+    }
+
+}

+ 46 - 0
app/src/main/java/com/kfzs/duanduan/cardview/CardAdapterHelper.java

@@ -0,0 +1,46 @@
+package com.kfzs.duanduan.cardview;
+
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.view.ViewGroup;
+
+
+
+/**
+ * adapter中调用onCreateViewHolder, onBindViewHolder
+ * Created by jameson on 9/1/16.
+ */
+public class CardAdapterHelper {
+    private int mPagePadding = 15;
+    private int mShowLeftCardWidth = 15;
+
+    public void onCreateViewHolder(ViewGroup parent, View itemView) {
+        RecyclerView.LayoutParams lp = (RecyclerView.LayoutParams) itemView.getLayoutParams();
+        lp.width = parent.getWidth() - ScreenUtil.dip2px(itemView.getContext(), 2 * (mPagePadding + mShowLeftCardWidth));
+        itemView.setLayoutParams(lp);
+    }
+
+    public void onBindViewHolder(View itemView, final int position, int itemCount) {
+        int padding = ScreenUtil.dip2px(itemView.getContext(), mPagePadding);
+        itemView.setPadding(padding, 0, padding, 0);
+        int leftMarin = position == 0 ? padding + ScreenUtil.dip2px(itemView.getContext(), mShowLeftCardWidth) : 0;
+        int rightMarin = position == itemCount - 1 ? padding + ScreenUtil.dip2px(itemView.getContext(), mShowLeftCardWidth) : 0;
+        setViewMargin(itemView, leftMarin, 0, rightMarin, 0);
+    }
+
+    private void setViewMargin(View view, int left, int top, int right, int bottom) {
+        ViewGroup.MarginLayoutParams lp = (ViewGroup.MarginLayoutParams) view.getLayoutParams();
+        if (lp.leftMargin != left || lp.topMargin != top || lp.rightMargin != right || lp.bottomMargin != bottom) {
+            lp.setMargins(left, top, right, bottom);
+            view.setLayoutParams(lp);
+        }
+    }
+
+    public void setPagePadding(int pagePadding) {
+        mPagePadding = pagePadding;
+    }
+
+    public void setShowLeftCardWidth(int showLeftCardWidth) {
+        mShowLeftCardWidth = showLeftCardWidth;
+    }
+}

+ 24 - 0
app/src/main/java/com/kfzs/duanduan/cardview/CardLinearSnapHelper.java

@@ -0,0 +1,24 @@
+package com.kfzs.duanduan.cardview;
+
+import android.support.annotation.NonNull;
+import android.support.v7.widget.LinearSnapHelper;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+/**
+ * 防止卡片在第一页和最后一页因无法"居中"而一直循环调用onScrollStateChanged-->SnapHelper.snapToTargetExistingView-->onScrollStateChanged
+ * Created by jameson on 9/3/16.
+ */
+public class CardLinearSnapHelper extends LinearSnapHelper {
+    public boolean mNoNeedToScroll = false;
+
+    @Override
+    public int[] calculateDistanceToFinalSnap(@NonNull RecyclerView.LayoutManager layoutManager, @NonNull View targetView) {
+        if (mNoNeedToScroll) {
+            return new int[]{0, 0};
+        } else {
+            return super.calculateDistanceToFinalSnap(layoutManager, targetView);
+        }
+    }
+
+}

+ 150 - 0
app/src/main/java/com/kfzs/duanduan/cardview/CardScaleHelper.java

@@ -0,0 +1,150 @@
+package com.kfzs.duanduan.cardview;
+
+import android.content.Context;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+
+/**
+ * Created by jameson on 8/30/16.
+ */
+public class CardScaleHelper {
+    private RecyclerView mRecyclerView;
+    private Context mContext;
+
+    private float mScale = 0.9f; // 两边视图scale
+    private int mPagePadding = 15; // 卡片的padding, 卡片间的距离等于2倍的mPagePadding
+    private int mShowLeftCardWidth = 15;   // 左边卡片显示大小
+
+    private int mCardWidth; // 卡片宽度
+    private int mOnePageWidth; // 滑动一页的距离
+    private int mCardGalleryWidth;
+
+    private int mCurrentItemPos;
+    private int mCurrentItemOffset;
+
+    private CardLinearSnapHelper mLinearSnapHelper = new CardLinearSnapHelper();
+
+    public void attachToRecyclerView(final RecyclerView mRecyclerView) {
+        // 开启log会影响滑动体验, 调试时才开启
+        LogUtils.mLogEnable = false;
+        this.mRecyclerView = mRecyclerView;
+        mContext = mRecyclerView.getContext();
+        mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
+            @Override
+            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+                super.onScrollStateChanged(recyclerView, newState);
+                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
+                    mLinearSnapHelper.mNoNeedToScroll = mCurrentItemOffset == 0 || mCurrentItemOffset == getDestItemOffset(mRecyclerView.getAdapter().getItemCount() - 1);
+                } else {
+                    mLinearSnapHelper.mNoNeedToScroll = false;
+                }
+            }
+
+            @Override
+            public void onScrolled(RecyclerView recyclerView, int dx, int dy) {
+                super.onScrolled(recyclerView, dx, dy);
+                // dx>0则表示右滑, dx<0表示左滑, dy<0表示上滑, dy>0表示下滑
+                if(dx != 0){//去掉奇怪的内存疯涨问题
+                    mCurrentItemOffset += dx;
+                    computeCurrentItemPos();
+                    LogUtils.v(String.format("dx=%s, dy=%s, mScrolledX=%s", dx, dy, mCurrentItemOffset));
+                    onScrolledChangedCallback();
+                }
+            }
+        });
+
+        initWidth();
+        mLinearSnapHelper.attachToRecyclerView(mRecyclerView);
+    }
+
+    /**
+     * 初始化卡片宽度
+     */
+    private void initWidth() {
+        mRecyclerView.post(new Runnable() {
+            @Override
+            public void run() {
+                mCardGalleryWidth = mRecyclerView.getWidth();
+                mCardWidth = mCardGalleryWidth - ScreenUtil.dip2px(mContext, 2 * (mPagePadding + mShowLeftCardWidth));
+                mOnePageWidth = mCardWidth;
+                mRecyclerView.smoothScrollToPosition(mCurrentItemPos);
+                onScrolledChangedCallback();
+            }
+        });
+    }
+
+    public void setCurrentItemPos(int currentItemPos) {
+        this.mCurrentItemPos = currentItemPos;
+    }
+
+    public int getCurrentItemPos() {
+        return mCurrentItemPos;
+    }
+
+    private int getDestItemOffset(int destPos) {
+        return mOnePageWidth * destPos;
+    }
+
+    /**
+     * 计算mCurrentItemOffset
+     */
+    private void computeCurrentItemPos() {
+        if (mOnePageWidth <= 0) return;
+        boolean pageChanged = false;
+        // 滑动超过一页说明已翻页
+        if (Math.abs(mCurrentItemOffset - mCurrentItemPos * mOnePageWidth) >= mOnePageWidth) {
+            pageChanged = true;
+        }
+        if (pageChanged) {
+            int tempPos = mCurrentItemPos;
+
+            mCurrentItemPos = mCurrentItemOffset / mOnePageWidth;
+            LogUtils.d(String.format("=======onCurrentItemPos Changed======= tempPos=%s, mCurrentItemPos=%s", tempPos, mCurrentItemPos));
+        }
+    }
+
+    /**
+     * RecyclerView位移事件监听, view大小随位移事件变化
+     */
+    private void onScrolledChangedCallback() {
+        int offset = mCurrentItemOffset - mCurrentItemPos * mOnePageWidth;
+        float percent = (float) Math.max(Math.abs(offset) * 1.0 / mOnePageWidth, 0.0001);
+
+        LogUtils.d(String.format("offset=%s, percent=%s", offset, percent));
+        View leftView = null;
+        View currentView;
+        View rightView = null;
+        if (mCurrentItemPos > 0) {
+            leftView = mRecyclerView.getLayoutManager().findViewByPosition(mCurrentItemPos - 1);
+        }
+        currentView = mRecyclerView.getLayoutManager().findViewByPosition(mCurrentItemPos);
+        if (mCurrentItemPos < mRecyclerView.getAdapter().getItemCount() - 1) {
+            rightView = mRecyclerView.getLayoutManager().findViewByPosition(mCurrentItemPos + 1);
+        }
+
+        if (leftView != null) {
+            // y = (1 - mScale)x + mScale
+            leftView.setScaleY((1 - mScale) * percent + mScale);
+        }
+        if (currentView != null) {
+            // y = (mScale - 1)x + 1
+            currentView.setScaleY((mScale - 1) * percent + 1);
+        }
+        if (rightView != null) {
+            // y = (1 - mScale)x + mScale
+            rightView.setScaleY((1 - mScale) * percent + mScale);
+        }
+    }
+
+    public void setScale(float scale) {
+        mScale = scale;
+    }
+
+    public void setPagePadding(int pagePadding) {
+        mPagePadding = pagePadding;
+    }
+
+    public void setShowLeftCardWidth(int showLeftCardWidth) {
+        mShowLeftCardWidth = showLeftCardWidth;
+    }
+}

+ 147 - 0
app/src/main/java/com/kfzs/duanduan/cardview/LogUtils.java

@@ -0,0 +1,147 @@
+package com.kfzs.duanduan.cardview;
+
+import android.util.Log;
+
+import java.lang.reflect.Method;
+import java.util.ArrayList;
+
+/**
+ * 很好用的Log打印类,自动输出方法和行数
+ * Created by jameson on 12/19/15.
+ */
+public class LogUtils {
+
+    public static boolean mLogEnable = true;
+    public static final String PREFIX = "LogUtils--";
+
+    private static String mClassname;
+    private static ArrayList<String> mMethods;
+
+    static {
+        mClassname = LogUtils.class.getName();
+        mMethods = new ArrayList<>();
+
+        Method[] ms = LogUtils.class.getDeclaredMethods();
+        for (Method m : ms) {
+            mMethods.add(m.getName());
+        }
+    }
+
+    public static void init(boolean logEnable) {
+        mLogEnable = logEnable;
+    }
+
+    public static void d(String tag, String msg) {
+        if (mLogEnable) {
+            Log.d(tag, getMsgWithLineNumber(msg));
+        }
+    }
+
+    public static void e(String tag, String msg) {
+        if (mLogEnable) {
+            Log.e(tag, getMsgWithLineNumber(msg));
+        }
+    }
+
+    public static void i(String tag, String msg) {
+        if (mLogEnable) {
+            Log.i(tag, getMsgWithLineNumber(msg));
+        }
+    }
+
+    public static void w(String tag, String msg) {
+        if (mLogEnable) {
+            Log.w(tag, getMsgWithLineNumber(msg));
+        }
+    }
+
+    public static void v(String tag, String msg) {
+        if (mLogEnable) {
+            Log.v(tag, getMsgWithLineNumber(msg));
+        }
+    }
+
+
+    public static void d(String msg) {
+        if (mLogEnable) {
+            String[] content = getMsgAndTagWithLineNumber(msg);
+            Log.d(content[0], content[1]);
+        }
+    }
+
+    public static void e(String msg) {
+        if (mLogEnable) {
+            String[] content = getMsgAndTagWithLineNumber(msg);
+            Log.e(content[0], content[1]);
+        }
+    }
+
+    public static void i(String msg) {
+        if (mLogEnable) {
+            String[] content = getMsgAndTagWithLineNumber(msg);
+            Log.i(content[0], content[1]);
+        }
+    }
+
+    public static void i() {
+        if (mLogEnable) {
+            String[] content = getMsgAndTagWithLineNumber("");
+            Log.i(content[0], content[1]);
+        }
+    }
+
+    public static void w(String msg) {
+        if (mLogEnable) {
+            String[] content = getMsgAndTagWithLineNumber(msg);
+            Log.w(content[0], content[1]);
+        }
+    }
+
+    public static void v(String msg) {
+        if (mLogEnable) {
+            String[] content = getMsgAndTagWithLineNumber(msg);
+            Log.v(content[0], content[1]);
+        }
+    }
+
+    public static String getMsgWithLineNumber(String msg) {
+        try {
+            for (StackTraceElement st : (new Throwable()).getStackTrace()) {
+                if (mClassname.equals(st.getClassName()) || mMethods.contains(st.getMethodName())) {
+                    continue;
+                } else {
+                    int b = st.getClassName().lastIndexOf(".") + 1;
+                    String message = new StringBuilder(st.getClassName().substring(b)).append("->").append(st.getMethodName())
+                            .append("():").append(st.getLineNumber()).append(msg).toString();
+                    return message;
+                }
+
+            }
+        } catch (Exception e) {
+
+        }
+        return msg;
+    }
+
+    public static String[] getMsgAndTagWithLineNumber(String msg) {
+        try {
+            for (StackTraceElement st : (new Throwable()).getStackTrace()) {
+                if (mClassname.equals(st.getClassName()) || mMethods.contains(st.getMethodName())) {
+                    continue;
+                } else {
+                    int b = st.getClassName().lastIndexOf(".") + 1;
+                    String TAG = PREFIX + st.getClassName().substring(b);
+                    String message = st.getMethodName() + "():" + st.getLineNumber() + "->" + msg;
+                    String[] content = new String[]{TAG, message};
+                    return content;
+                }
+
+            }
+        } catch (Exception e) {
+
+        }
+        return new String[]{"universal tag", msg};
+    }
+
+
+}

+ 38 - 0
app/src/main/java/com/kfzs/duanduan/cardview/ScreenUtil.java

@@ -0,0 +1,38 @@
+package com.kfzs.duanduan.cardview;
+
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.graphics.Point;
+import android.os.Build;
+import android.view.WindowManager;
+
+/**
+ * Created by jameson on 12/19/15.
+ */
+public class ScreenUtil {
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+    public static int getScreenWidth(Context context) {
+        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+        Point p = new Point();
+        wm.getDefaultDisplay().getSize(p);
+        return p.x;
+    }
+
+    @TargetApi(Build.VERSION_CODES.HONEYCOMB_MR2)
+    public static int getScreenHeight(Context context) {
+        WindowManager wm = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
+        Point p = new Point();
+        wm.getDefaultDisplay().getSize(p);
+        return p.y;
+    }
+
+    public static int dip2px(Context context, float dpValue) {
+        final float scale = context.getResources().getDisplayMetrics().density;
+        return (int) (dpValue * scale + 0.5f);
+    }
+
+    public static int px2dip(Context context, float pxValue) {
+        final float scale = context.getResources().getDisplayMetrics().density;
+        return (int) (pxValue / scale + 0.5f);
+    }
+}

+ 44 - 0
app/src/main/java/com/kfzs/duanduan/cardview/SpeedRecyclerView.java

@@ -0,0 +1,44 @@
+package com.kfzs.duanduan.cardview;
+
+import android.content.Context;
+import android.support.annotation.Nullable;
+import android.support.v7.widget.RecyclerView;
+import android.util.AttributeSet;
+
+/**
+ * 控制fling速度的RecyclerView
+ *
+ * Created by jameson on 9/1/16.
+ */
+public class SpeedRecyclerView extends RecyclerView {
+    private static final float FLING_SCALE_DOWN_FACTOR = 0.5f; // 减速因子
+    private static final int FLING_MAX_VELOCITY = 8000; // 最大顺时滑动速度
+
+    public SpeedRecyclerView(Context context) {
+        super(context);
+    }
+
+    public SpeedRecyclerView(Context context, @Nullable AttributeSet attrs) {
+        super(context, attrs);
+    }
+
+    public SpeedRecyclerView(Context context, @Nullable AttributeSet attrs, int defStyle) {
+        super(context, attrs, defStyle);
+    }
+
+    @Override
+    public boolean fling(int velocityX, int velocityY) {
+        velocityX = solveVelocity(velocityX);
+        velocityY = solveVelocity(velocityY);
+        return super.fling(velocityX, velocityY);
+    }
+
+    private int solveVelocity(int velocity) {
+        if (velocity > 0) {
+            return Math.min(velocity, FLING_MAX_VELOCITY);
+        } else {
+            return Math.max(velocity, -FLING_MAX_VELOCITY);
+        }
+    }
+
+}

+ 42 - 0
app/src/main/java/com/kfzs/duanduan/cardview/ViewSwitchUtils.java

@@ -0,0 +1,42 @@
+package com.kfzs.duanduan.cardview;
+
+import android.graphics.Bitmap;
+import android.graphics.drawable.BitmapDrawable;
+import android.graphics.drawable.ColorDrawable;
+import android.graphics.drawable.Drawable;
+import android.graphics.drawable.TransitionDrawable;
+import android.widget.ImageView;
+
+/**
+ * 图片背景切换动画帮助类
+ *
+ * Created by jameson on 9/3/16.
+ */
+public class ViewSwitchUtils {
+
+    public static void startSwitchBackgroundAnim(ImageView view, Bitmap bitmap) {
+        Drawable oldDrawable = view.getDrawable();
+        Drawable oldBitmapDrawable ;
+        TransitionDrawable oldTransitionDrawable = null;
+        if (oldDrawable instanceof TransitionDrawable) {
+            oldTransitionDrawable = (TransitionDrawable) oldDrawable;
+            oldBitmapDrawable = oldTransitionDrawable.findDrawableByLayerId(oldTransitionDrawable.getId(1));
+        } else if (oldDrawable instanceof BitmapDrawable) {
+            oldBitmapDrawable = oldDrawable;
+        } else {
+            oldBitmapDrawable = new ColorDrawable(0xffc2c2c2);
+        }
+
+        if (oldTransitionDrawable == null) {
+            oldTransitionDrawable = new TransitionDrawable(new Drawable[]{oldBitmapDrawable, new BitmapDrawable(bitmap)});
+            oldTransitionDrawable.setId(0, 0);
+            oldTransitionDrawable.setId(1, 1);
+            oldTransitionDrawable.setCrossFadeEnabled(true);
+            view.setImageDrawable(oldTransitionDrawable);
+        } else {
+            oldTransitionDrawable.setDrawableByLayerId(oldTransitionDrawable.getId(0), oldBitmapDrawable);
+            oldTransitionDrawable.setDrawableByLayerId(oldTransitionDrawable.getId(1), new BitmapDrawable(bitmap));
+        }
+        oldTransitionDrawable.startTransition(1000);
+    }
+}

+ 87 - 0
app/src/main/java/com/kfzs/duanduan/cardview/ViewUtil.java

@@ -0,0 +1,87 @@
+package com.kfzs.duanduan.cardview;
+
+import android.content.Context;
+import android.graphics.Rect;
+import android.view.View;
+import android.widget.AbsListView;
+
+/**
+ * ViewUtil
+ * <p>
+ * Created by jameson on 12/19/15.
+ */
+public class ViewUtil {
+    /**
+     * 返回AbsListView scrollY
+     *
+     * @param view          view
+     * @param mHeaderHeight absListView header高度
+     * @return
+     */
+    public static int getScrollY(AbsListView view, int mHeaderHeight) {
+        if (view == null) return 0;
+
+        View c = view.getChildAt(0);
+        if (c == null) {
+            return 0;
+        }
+
+        int firstVisiblePosition = view.getFirstVisiblePosition();
+        int top = c.getTop();
+
+        int headerHeight = 0;
+        if (firstVisiblePosition >= view.getChildCount()) {
+            headerHeight = mHeaderHeight;
+        }
+
+        return -top + firstVisiblePosition * c.getHeight() + headerHeight;
+    }
+
+    /**
+     * 返回View的矩阵(减去statusBar高度)
+     *
+     * @param view view
+     * @return
+     */
+    public static Rect getOnScreenRect(View view) {
+        return getOnScreenRect(view, true);
+    }
+
+    /**
+     * 返回View的矩阵
+     *
+     * @param view            view
+     * @param removeStatusBar 是否包含算StatusBar高度
+     * @return
+     */
+    public static Rect getOnScreenRect(View view, boolean removeStatusBar) {
+        Rect rect = new Rect();
+        final int[] location = new int[2];
+        view.getLocationOnScreen(location);
+
+        int statusBarHeight = 0;
+        if (removeStatusBar) {
+            Rect windowRect = new Rect();
+            view.getWindowVisibleDisplayFrame(windowRect);
+            statusBarHeight = windowRect.top;
+        }
+
+        rect.set(location[0], location[1] - statusBarHeight, location[0] + view.getWidth(), location[1] - statusBarHeight + view.getHeight());
+        return rect;
+    }
+
+    /**
+     * 获取statusBar高度
+     *
+     * @param context context
+     * @return
+     */
+    public int getStatusBarHeight(Context context) {
+        int result = 0;
+        int resourceId = context.getResources().getIdentifier("status_bar_height", "dimen", "android");
+        if (resourceId > 0) {
+            result = context.getResources().getDimensionPixelSize(resourceId);
+        }
+        return result;
+    }
+}

+ 1 - 0
app/src/main/java/com/kfzs/duanduan/event/EventTypes.java

@@ -43,4 +43,5 @@ public enum EventTypes {
     REFRESH_XIAOMI_GAME_LIST,//刷新界面
     FGT_SHEEP_REFRESH_H , //刷新fgtSmallSheep高度
     FGT_SHEEP_SHOW_NEW_USER_HONG_BAO , //显示红包
+    REFRESH_AUDITACTIVITY_DATA,//审核数据刷新
 }

+ 72 - 44
app/src/main/java/com/kfzs/duanduan/fragment/FgtFindChild.java

@@ -4,9 +4,7 @@ import android.app.Activity;
 import android.content.Intent;
 import android.os.Bundle;
 import android.support.annotation.Nullable;
-import android.support.v4.widget.SwipeRefreshLayout;
 import android.support.v7.widget.LinearLayoutManager;
-import android.support.v7.widget.RecyclerView;
 import android.text.TextUtils;
 import android.view.LayoutInflater;
 import android.view.View;
@@ -16,6 +14,7 @@ import android.widget.TextView;
 import com.arialyy.annotations.Download;
 import com.arialyy.aria.core.Aria;
 import com.arialyy.aria.core.download.DownloadTask;
+import com.jcodecraeer.xrecyclerview.XRecyclerView;
 import com.kfzs.android.view.tag.FlowLayout;
 import com.kfzs.android.view.tag.TagAdapter;
 import com.kfzs.android.view.tag.TagFlowLayout;
@@ -65,6 +64,8 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_ITEM;
  */
 public class FgtFindChild extends BaseCompatFragment {
 
+    private int page = 1;//页数
+    private int per_page = 10;
     private int type;
     public static FgtFindChild newInstance(int type){
         FgtFindChild fgt = new FgtFindChild();
@@ -88,7 +89,7 @@ public class FgtFindChild extends BaseCompatFragment {
     private Activity activity;
     @Override
     protected void initView(Bundle savedInstanceState) {
-        setContentView(R.layout.net_empty_fresh_list);
+        setContentView(R.layout.net_empty_xrecycler);
         activity = getActivity();
         ButterKnife.bind(this, mContentView);
         initView();
@@ -97,24 +98,40 @@ public class FgtFindChild extends BaseCompatFragment {
 
     @BindView(R.id.title)
     View title;
-    @BindView(R.id.refresh)
-    SwipeRefreshLayout refresh;
+//    @BindView(R.id.refresh)
+//    SwipeRefreshLayout refresh;
     @BindView(R.id.empty_view)
     View empty_view;
     @BindView(R.id.check_net_ll)
     View check_net_ll;
     @BindView(R.id.view_list)
-    RecyclerView view_list;
+    XRecyclerView view_list;
     private void initView(){
         title.setVisibility(View.GONE);
-        refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+//        refresh.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
+//            @Override
+//            public void onRefresh() {
+//                refreshData();
+//                refresh.setRefreshing(false);
+//            }
+//        });
+        view_list.setLoadingListener(new XRecyclerView.LoadingListener() {
             @Override
             public void onRefresh() {
                 refreshData();
-                refresh.setRefreshing(false);
             }
-        });
 
+            @Override
+            public void onLoadMore() {
+                if(ListUtil.size(list) >= per_page*page){
+                    page += 1;
+                    initData();
+                }else {
+                    view_list.setNoMore(true);
+                }
+            }
+        });
+        ViewUtil.setBottomLine(view_list);
         view_list.setLayoutManager(new LinearLayoutManager(SheepApp.getInstance()));
         view_list.setAdapter(new AdbCommonRecycler<FindItem>(SheepApp.getInstance(), list){
 
@@ -124,20 +141,20 @@ public class FgtFindChild extends BaseCompatFragment {
             }
             @Override
             public int getViewIdByType(int type) {//type来源于 getItemViewType 返回的值
-                if(type == -1 + list.size()){
-                   return R.layout.find_item_bottom;
-                }
                 return R.layout.find_item;
             }
 
             @Override
-            public void convert(ViewHolder holder, final FindItem item) {
+            public void convert(final ViewHolder holder, final FindItem item) {
                 if(item == null){
                     return;
                 }
                 View rootConvertView = holder.itemView;
                 View padding = rootConvertView.findViewById(R.id.padding);
-                padding.setVisibility(holder.getAdapterPosition() == 0 ? View.GONE : View.VISIBLE);
+                if(padding == null){
+                    return;
+                }
+                padding.setVisibility(holder.getAdapterPosition() == 1 ? View.GONE : View.VISIBLE);
                 TextView find_item_name = (TextView)rootConvertView.findViewById(R.id.find_item_name);
                 TextView find_item_time = (TextView)rootConvertView.findViewById(R.id.find_item_time);
                 ImageView find_item_iv = (ImageView)rootConvertView.findViewById(R.id.find_item_iv);
@@ -175,7 +192,15 @@ public class FgtFindChild extends BaseCompatFragment {
                     };
                     find_item_tags.setAdapter(adapter);
                 }
-
+//                if(BuildConfig.DEBUG){
+//                    rootConvertView.setOnLongClickListener(new View.OnLongClickListener() {
+//                        @Override
+//                        public boolean onLongClick(View view) {
+//                            G.showToast(""+holder.getAdapterPosition());
+//                            return true;
+//                        }
+//                    });
+//                }
                 rootConvertView.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
@@ -272,12 +297,8 @@ public class FgtFindChild extends BaseCompatFragment {
 
     public void initData(){
         //先尝试获取缓存数据
-        List<FindItem> newList = DataUtil.getInstance().getCacheList(ApiKey.articles(type), FindItem.class);
+        List<FindItem> newList = DataUtil.getInstance().getCacheList(ApiKey.articles(page, per_page, type), FindItem.class);
         loadList(newList);
-        refreshData();
-    }
-
-    public void refreshData(){
         empty_view.setVisibility(View.INVISIBLE);
         SysAppUtil.checkNet(new Action1<Integer>() {
             @Override
@@ -291,38 +312,45 @@ public class FgtFindChild extends BaseCompatFragment {
                 }
             }
         });
-        SheepApp.getInstance().getNetComponent().getApiService().getFindList(1, 100, type)
-                        .subscribeOn(Schedulers.io())
-                        .observeOn(AndroidSchedulers.mainThread())
-                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                            @Override
-                            public void onNext(BaseMessage baseMessage) {
-                                boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.articles(type));
-                                if(isNewData) {
-                                    List<FindItem> newList = baseMessage.getDatas(FindItem.class);
-                                    loadList(newList);
-                                }
-                            }
+        SheepApp.getInstance().getNetComponent().getApiService().getFindList(page, per_page, type)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.articles(page, per_page, type));
+                        if(isNewData) {
+                            List<FindItem> newList = baseMessage.getDatas(FindItem.class);
+                            loadList(newList);
+                        }
+                    }
 
-                            @Override
-                            public void onError(BaseMessage baseMessage) {
-                                notifyDataSetChanged();
-                            }
-                        });
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        notifyDataSetChanged();
+                    }
+                });
+    }
+
+    public void refreshData(){
+        list.clear();
+        view_list.getAdapter().notifyDataSetChanged();
+        page = 1;
+        initData();
     }
     private void loadList(List<FindItem> newList){
-        if(!ListUtil.isEmpty(newList)){
-            list.clear();
-            ListUtil.addAll(list, newList);
-            if(!list.isEmpty())
-                list.add(null);//底部部分----我是有底线的
-        }
+        ListUtil.addAll(list, newList);
         notifyDataSetChanged();
     }
 
     private void notifyDataSetChanged(){
         CommonUtil.getInstance().updateEmptyView(empty_view, list.isEmpty());
-        refresh.setRefreshing(false);
+//        refresh.setRefreshing(false);
+        if(page == 1){
+            view_list.refreshComplete();
+        } else {
+            view_list.loadMoreComplete();
+        }
         view_list.getAdapter().notifyDataSetChanged();
     }
     private List<FindItem> list = ListUtil.emptyList();

+ 6 - 0
app/src/main/java/com/kfzs/duanduan/fragment/FgtMiDong.java

@@ -61,6 +61,8 @@ public class FgtMiDong extends BaseCompatFragment {
     private int pageSize = 30;
     private List<AdDataSon> listData = ListUtil.emptyList();
 
+    private int refresh_init_false = 1;
+
     public static FgtMiDong newInstance(int type) {
         FgtMiDong fgtMiDong = new FgtMiDong();
         Bundle bundle = new Bundle();
@@ -186,6 +188,10 @@ public class FgtMiDong extends BaseCompatFragment {
 
                 @Override
                 public void onLoadAdFailure() {
+                    if(refresh_init_false == 1){
+                        initData(isRefresh);
+                    }
+                    refresh_init_false++;
                     refresh.setRefreshing(false);
                     if (isRefresh)
                         G.showToast(activity, "网络异常,请稍后再试", Toast.LENGTH_SHORT);

+ 38 - 9
app/src/main/java/com/kfzs/duanduan/fragment/FgtPersonalCenter.java

@@ -176,7 +176,7 @@ public class FgtPersonalCenter extends BaseCompatFragment {
     @Override
     public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
         super.onViewCreated(view, savedInstanceState);
-        isShowRedPackage();
+      getLastUserInfo(null);
     }
 
 
@@ -188,16 +188,13 @@ public class FgtPersonalCenter extends BaseCompatFragment {
         if (userEntity == null) {
             userEntity = DataUtil.getInstance().getUserEntity();
         }
-        if (userEntity.getParent_code() != null) {
+
+        if (!userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1)) {
             ivRedpackage.setVisibility(View.GONE);
-            return;
         } else {
-            if (!userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1)) {
-                ivRedpackage.setVisibility(View.GONE);
-            } else {
-                ivRedpackage.setVisibility(View.VISIBLE);
-            }
+            ivRedpackage.setVisibility(View.VISIBLE);
         }
+
     }
 
     /**
@@ -305,6 +302,38 @@ public class FgtPersonalCenter extends BaseCompatFragment {
                 });
     }
 
+    public void getLastUserInfo(final Action1<UserEntity> action1) {
+        SheepApp.get(SheepApp.getInstance())
+                .getNetComponent()
+                .getApiService()
+                .getInfo()
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        if (action1 != null)
+                            action1.call(null);
+
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        UserEntity userEntity = baseMessage.getData(UserEntity.class);
+                        if (userEntity != null) {
+                            DataUtil.getInstance().setUserEntity(userEntity);
+                            if (!userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1)) {
+                                ivRedpackage.setVisibility(View.GONE);
+                            } else {
+                                ivRedpackage.setVisibility(View.VISIBLE);
+                            }
+                        }
+                     //   initUserInfo();
+                        if (action1 != null)
+                            action1.call(userEntity);
+                    }
+                });
+    }
     @Override
     public void onDestroyView() {
         super.onDestroyView();
@@ -397,7 +426,7 @@ public class FgtPersonalCenter extends BaseCompatFragment {
 
     @Override
     public void onResume() {
-        isShowRedPackage();
+       getLastUserInfo(null);
         super.onResume();
         try {
             initData();

+ 45 - 9
app/src/main/java/com/kfzs/duanduan/fragment/FgtSmallSheep.java

@@ -3,6 +3,8 @@ package com.kfzs.duanduan.fragment;
 import android.annotation.SuppressLint;
 import android.app.ActionBar;
 import android.app.Activity;
+import android.content.ClipData;
+import android.content.ClipboardManager;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.graphics.Color;
@@ -274,15 +276,13 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         if (userEntity == null) {
             userEntity = DataUtil.getInstance().getUserEntity();
         }
-        if (userEntity.getParent_code() != null) {
-            return;
-        } else {
-            if (!userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1)) {
+//userEntity.getParent_code()获取到的不会存在null,没有时,时"",所以不用判断为null的情况
+        if (!userEntity.getParent_code().equals("") || (userEntity.getCreate_time_line() < 2) || (userEntity.getPackage_cate() == 1)) {
 
-            } else {
-                changeRedPackage(getActivity(), LayoutInflater.from(getContext()).inflate(R.layout.activity_main, null), this);
-            }
+        } else {
+            changeRedPackage(getActivity(), LayoutInflater.from(getContext()).inflate(R.layout.activity_main, null), this);
         }
+
     }
 
     /**
@@ -323,6 +323,24 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
                 }
             }
         });
+        edInvitationCode.setOnLongClickListener(new View.OnLongClickListener() {
+            @Override
+            public boolean onLongClick(View view) {
+                // 获取系统剪贴板
+                ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
+                // 获取剪贴板的剪贴数据集
+                ClipData clipData = clipboard.getPrimaryClip();
+
+                if (clipData != null && clipData.getItemCount() > 0) {
+                    // 从数据集中获取(粘贴)第一条文本数据
+                    CharSequence codetext = clipData.getItemAt(0).getText();
+                    if (!TextUtils.isEmpty(codetext)){
+                        edInvitationCode.setText(codetext);
+                    }
+                }
+                return false;
+            }
+        });
         ivClose.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
@@ -458,7 +476,22 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
         if (userEntity == null) {
             userEntity = DataUtil.getInstance().getUserEntity();
         }
+        if(userEntity == null){
+            CommonUtil.getInstance().updateUserInfo(new Action1<UserEntity>() {
+                @Override
+                public void call(UserEntity result) {
+                    if(result != null){
+                        userEntity = result;
+                        showRedPackageNext();
+                    }
+                }
+            });
+        } else {
+            showRedPackageNext();
+        }
+    }
 
+    private void showRedPackageNext() {
         if (SpUtils.getFirst("first" + userEntity.getId())) {//不是第一次进入APP
             return;
         }
@@ -825,10 +858,13 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
 
     @OnClick({R.id.recharge, R.id.withdrawal, R.id.view_rob_duty,
             R.id.newbie_task, R.id.icon_img_iv, R.id.user_layout,
-            R.id.bottom_line
+            R.id.bottom_line,R.id.homepage_item_money_tv
     })
     public void onViewClicked(View view) {
         switch (view.getId()) {
+            case R.id.homepage_item_money_tv:
+                Jump2View.getInstance().goTryplayView(activity,null);
+                break;
             case R.id.withdrawal://提现
                 Jump2View.getInstance().tryGoWithdrawal(activity, userEntity);
                 break;
@@ -1456,7 +1492,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
     /**
      * popwindow消失监听类,消失恢复window透明度
      */
-      class PopDismissListener implements PopupWindow.OnDismissListener {
+    class PopDismissListener implements PopupWindow.OnDismissListener {
         Activity mActivity;
 
         public PopDismissListener(Activity activity) {

+ 29 - 1
app/src/main/java/com/kfzs/duanduan/utils/StatusBarUtils.java

@@ -4,11 +4,13 @@ package com.kfzs.duanduan.utils;
 import android.annotation.TargetApi;
 import android.app.Activity;
 import android.content.Context;
+import android.content.res.Resources;
 import android.graphics.Color;
 import android.os.Build;
 import android.support.annotation.ColorInt;
 import android.support.design.widget.CoordinatorLayout;
 import android.support.v4.widget.DrawerLayout;
+import android.util.Log;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.WindowManager;
@@ -16,6 +18,8 @@ import android.widget.LinearLayout;
 
 import com.sheep.jiuyan.samllsheep.R;
 
+import java.lang.reflect.Method;
+
 public class StatusBarUtils {
 
     public static final int DEFAULT_STATUS_BAR_ALPHA = 112;
@@ -601,7 +605,8 @@ public class StatusBarUtils {
         if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
             activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_DRAWS_SYSTEM_BAR_BACKGROUNDS);
             activity.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
-            activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
+            if (!isHaveNavigationBar(activity))
+                activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_NAVIGATION);
             activity.getWindow().setStatusBarColor(Color.TRANSPARENT);
         } else {
             activity.getWindow().addFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
@@ -657,4 +662,27 @@ public class StatusBarUtils {
         blue = (int) (blue * a + 0.5);
         return 0xff << 24 | red << 16 | green << 8 | blue;
     }
+
+    public static boolean isHaveNavigationBar(Activity context) {
+
+        boolean isHave = false;
+        Resources rs = context.getResources();
+        int id = rs.getIdentifier("config_showNavigationBar", "bool", "android");
+        if (id > 0) {
+            isHave = rs.getBoolean(id);
+        }
+        try {
+            Class systemPropertiesClass = Class.forName("android.os.SystemProperties");
+            Method m = systemPropertiesClass.getMethod("get", String.class);
+            String navBarOverride = (String) m.invoke(systemPropertiesClass, "qemu.hw.mainkeys");
+            if ("1".equals(navBarOverride)) {
+                isHave = false;
+            } else if ("0".equals(navBarOverride)) {
+                isHave = true;
+            }
+        } catch (Exception e) {
+            Log.w("TAG", e);
+        }
+        return isHave;
+    }
 }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/helper/TaskHelper.java

@@ -453,13 +453,13 @@ public class TaskHelper {
         for (TaskChild taskChild : taskChildList) {
             switch (taskChild.getStatus()) {
                 case 2:
+                case 4:
                 case 3:
-                case 6://找到可领取或者进行中或者审核失败则直接退出循环
+                case 6://找到可领取或者进行中或者审核失败或者审核中则直接退出循环
                     selectTaskChild = taskChild;
                     break outFor;
                 case 0:
                 case 1:
-                case 4:
                 case 5:
                     if (selectTaskChild == null)
                         selectTaskChild = taskChild;

+ 4 - 5
app/src/main/java/com/sheep/gamegroup/model/entity/FindItem.java

@@ -7,8 +7,6 @@ import com.sheep.gamegroup.util.ListUtil;
 
 import java.util.List;
 
-import rx.functions.Action1;
-
 /**
  * Created by realicing on 2018/6/27.
  * realicing@sina.com
@@ -180,9 +178,10 @@ public class FindItem {
     }
 
 
-
-
-
+    @Override
+    public boolean equals(Object obj) {
+        return obj instanceof FindItem && ((FindItem) obj).getId() == id;
+    }
 
     //是否是游戏,游戏要显示下载游戏与评分
     public boolean isGame() {

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java

@@ -1598,8 +1598,8 @@ public class CommonUtil {
      */
     public boolean initMiDong(Activity activity, String id) {
         if (!SheepApp.getInstance().isInitMidong() && !TextUtils.isEmpty(id)) {
-            SheepApp.getInstance().setInitMidong(true);
             AdManager.getInstance(activity).init(activity, "40", id + "");
+            SheepApp.getInstance().setInitMidong(true);
             return true;
         }
         return false;

+ 19 - 5
app/src/main/java/com/sheep/gamegroup/util/Jump2View.java

@@ -6,6 +6,7 @@ import android.content.Intent;
 import android.content.pm.PackageManager;
 import android.net.Uri;
 import android.os.Bundle;
+import android.os.Handler;
 import android.text.TextUtils;
 import android.view.Gravity;
 import android.view.View;
@@ -1452,17 +1453,30 @@ public class Jump2View {
     /**
      * 幂动科技
      */
-    public void goMiDong(Activity activity, Object o){
+    public void goMiDong(final Activity activity, Object o){
         if(!SheepApp.getInstance().isShowMidong()){
             G.showToast("敬请期待");
             return;
         }
         CommonUtil.getInstance().initMiDong(activity, DataUtil.getInstance().getUserId());
-        if(SheepApp.getInstance().isInitMidong()){
-            Intent intent = new Intent(activity, ActMiDong.class);
-            activity.startActivity(intent);
-            MI_DONG_VIEW.onEvent();
+        long l ;
+        if(SheepApp.getInstance().getMidongTimeCount() == 1){
+            l = 1000;
+        }else {
+            l = 0;
         }
+        SheepApp.getInstance().setMidongTimeCount(SheepApp.getInstance().getMidongTimeCount()+1);
+        new Handler().postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                if(SheepApp.getInstance().isInitMidong()){
+                    Intent intent = new Intent(activity, ActMiDong.class);
+                    activity.startActivity(intent);
+                    MI_DONG_VIEW.onEvent();
+                }
+
+            }
+        }, l);
     }
     /**
      * 小米游戏列表

+ 13 - 0
app/src/main/java/com/sheep/gamegroup/util/ListUtil.java

@@ -114,6 +114,19 @@ public class ListUtil {
             list.set(position, t);
     }
 
+    /**
+     * 清除末尾的空数据
+     * @param list
+     */
+    public static <T> void removeNull(List<T> list) {
+        removeItem(list, new CallBack<T, Boolean>() {
+            @Override
+            public Boolean call(T t) {
+                return t == null;
+            }
+        });
+    }
+
     public static interface CallBack<I, R>{
         public R call(I i);
     }

+ 161 - 5
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -4,10 +4,13 @@ import android.app.ActionBar;
 import android.app.Activity;
 import android.app.Dialog;
 import android.app.ProgressDialog;
+import android.content.ClipData;
+import android.content.ClipboardManager;
 import android.content.Context;
 import android.content.DialogInterface;
 import android.content.Intent;
 import android.graphics.Bitmap;
+import android.graphics.BitmapFactory;
 import android.graphics.Color;
 import android.graphics.drawable.BitmapDrawable;
 import android.graphics.drawable.Drawable;
@@ -18,6 +21,7 @@ import android.provider.MediaStore;
 import android.support.v4.app.FragmentActivity;
 import android.support.v7.app.AlertDialog;
 import android.support.v7.widget.GridLayoutManager;
+import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.text.Html;
 import android.text.TextUtils;
@@ -43,6 +47,13 @@ import com.bumptech.glide.Glide;
 import com.bumptech.glide.RequestBuilder;
 import com.bumptech.glide.request.RequestOptions;
 import com.google.gson.Gson;
+import com.jcodecraeer.xrecyclerview.CustomFooterViewCallBack;
+import com.jcodecraeer.xrecyclerview.XRecyclerView;
+import com.kfzs.duanduan.cardview.BlurBitmapUtils;
+import com.kfzs.duanduan.cardview.CardAdapter;
+import com.kfzs.duanduan.cardview.CardScaleHelper;
+import com.kfzs.duanduan.cardview.SpeedRecyclerView;
+import com.kfzs.duanduan.cardview.ViewSwitchUtils;
 import com.kfzs.duanduan.fragment.FgtPersonalCenter;
 import com.sheep.gamegroup.dateview.DatePickerDialog;
 import com.sheep.gamegroup.dateview.DateUtil;
@@ -79,6 +90,7 @@ import java.io.File;
 import java.io.FileNotFoundException;
 import java.io.FileOutputStream;
 import java.io.IOException;
+import java.util.ArrayList;
 import java.util.List;
 import java.util.Locale;
 import java.util.Map;
@@ -102,6 +114,9 @@ public class ViewUtil {
     public static final int REQUEST_CODE_TASK_LIST = 110;
     private static ViewUtil viewUtil;
     static RobTask mRobTask;
+    private static int mLastPos = -1;
+    private static CardScaleHelper mCardScaleHelper = new CardScaleHelper();
+    private static Runnable mBlurRunnable;
 
     public static ViewUtil newInstance() {
         if (viewUtil == null) {
@@ -266,7 +281,7 @@ public class ViewUtil {
             @Override
             public void onClick(View v) {
                 mRobTask = getTask(ivIcon, tvTitel, tvDutyMoney);
-                LogUtil.logI("抢任务---"+new Gson().toJson(mRobTask));
+                LogUtil.logI("抢任务---" + new Gson().toJson(mRobTask));
 
             }
         });
@@ -298,6 +313,7 @@ public class ViewUtil {
 
     /**
      * 设置默认方块文本
+     *
      * @param textView
      */
     public static void setDefaultText(TextView textView) {
@@ -349,6 +365,24 @@ public class ViewUtil {
                 }
             }
         });
+        edInvitationCode.setOnLongClickListener(new View.OnLongClickListener() {
+            @Override
+            public boolean onLongClick(View view) {
+                // 获取系统剪贴板
+                ClipboardManager clipboard = (ClipboardManager) mActivity.getSystemService(Context.CLIPBOARD_SERVICE);
+               // 获取剪贴板的剪贴数据集
+                ClipData clipData = clipboard.getPrimaryClip();
+
+                if (clipData != null && clipData.getItemCount() > 0) {
+                    // 从数据集中获取(粘贴)第一条文本数据
+                    CharSequence codetext = clipData.getItemAt(0).getText();
+                    if (!TextUtils.isEmpty(codetext)){
+                        edInvitationCode.setText(codetext);
+                    }
+                }
+                return false;
+            }
+        });
         ivClose.setOnClickListener(new View.OnClickListener() {
             @Override
             public void onClick(View view) {
@@ -443,6 +477,35 @@ public class ViewUtil {
 
     }
 
+    public static void setBottomLine(final XRecyclerView view_list) {
+        View view = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.common_foot_view, null);
+        view_list.setFootView(view, new CustomFooterViewCallBack() {
+            @Override
+            public void onLoadingMore(View yourFooterView) {
+                TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
+                bottom_line_text.setText("羊羊努力加载中...");
+            }
+
+            @Override
+            public void onLoadMoreComplete(View yourFooterView) {
+                TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
+                bottom_line_text.setText("羊羊努力加载中...");
+            }
+
+            @Override
+            public void onSetNoMore(View yourFooterView, boolean noMore) {
+                TextView bottom_line_text = yourFooterView.findViewById(R.id.bottom_line_text);
+                bottom_line_text.setText("我是有底线的,点击我回到顶部");
+                yourFooterView.setOnClickListener(new View.OnClickListener() {
+                    @Override
+                    public void onClick(View view) {
+                        view_list.scrollToPosition(0);
+                    }
+                });
+            }
+        });
+    }
+
     /**
      * popwindow消失监听类,消失恢复window透明度
      */
@@ -535,6 +598,7 @@ public class ViewUtil {
         }
 
     }
+
     /**
      * 领取福利成功的对话框
      *
@@ -686,6 +750,7 @@ public class ViewUtil {
                 new StringBuilder("<html><head><meta name=\"viewport\" content=\"width=device-width,height=auto, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes\" /><style>img{max-width:100% !important;height:auto !important;}</style><style>body{max-width:100% !important;}</style></head><body>").append(content).append("</body></html>").toString()
                 , "text/html", "utf-8", null);
     }
+
     public static void loadDataWithBaseURL(WebView webView, String content) {
         webView.loadDataWithBaseURL(null,
                 new StringBuilder("<html><head><meta name=\"viewport\" content=\"width=device-width,height=auto, initial-scale=1.0, minimum-scale=0.5, maximum-scale=2.0, user-scalable=yes\" /><style>img{max-width:100% !important;height:auto !important;}</style><style>body{max-width:100% !important;}</style></head><body>").append(content).append("</body></html>").toString()
@@ -1273,6 +1338,79 @@ public class ViewUtil {
     }
 
     /**
+     * 初始化画廊
+     *
+     * @param mRecyclerView ,recycleView
+     * @param mBlurView     显示的ImageView
+     * @param mList         图片文件地址集合,
+     * @param context       。。。
+     */
+    private static void init(SpeedRecyclerView mRecyclerView, ImageView mBlurView, List<Integer> mList, Context context) {
+        if (mList == null) {
+            mList = new ArrayList<>();
+        }
+        for (int i = 0; i < 10; i++) {
+            mList.add(R.drawable.kaipin);
+            mList.add(R.drawable.kaipin);
+            mList.add(R.drawable.kaipin);
+        }
+
+        final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
+        mRecyclerView.setLayoutManager(linearLayoutManager);
+        mRecyclerView.setAdapter(new CardAdapter(mList));
+        // mRecyclerView绑定scale效果
+        mCardScaleHelper.setCurrentItemPos(2);
+        mCardScaleHelper.attachToRecyclerView(mRecyclerView);
+
+        initBlurBackground(mBlurView, mRecyclerView, mList, context);
+    }
+
+    /**
+     * 给画廊设置背景
+     *
+     * @param mBlurView
+     * @param mRecyclerView
+     * @param mList
+     * @param context
+     */
+    private static void initBlurBackground(ImageView mBlurView, RecyclerView mRecyclerView, final List<Integer> mList, final Context context) {
+        final ImageView finalMBlurView = mBlurView;
+        mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
+            @Override
+            public void onScrollStateChanged(RecyclerView recyclerView, int newState) {
+                super.onScrollStateChanged(recyclerView, newState);
+                if (newState == RecyclerView.SCROLL_STATE_IDLE) {
+                    notifyBackgroundChange(finalMBlurView, mList, context);
+                }
+            }
+        });
+
+        notifyBackgroundChange(mBlurView, mList, context);
+    }
+
+    /**
+     * 检测画廊图片变化
+     *
+     * @param mBlurView
+     * @param mList
+     * @param context
+     */
+    private static void notifyBackgroundChange(final ImageView mBlurView, List<Integer> mList, final Context context) {
+        if (mLastPos == mCardScaleHelper.getCurrentItemPos()) return;
+        mLastPos = mCardScaleHelper.getCurrentItemPos();
+        final int resId = mList.get(mCardScaleHelper.getCurrentItemPos());
+        mBlurView.removeCallbacks(mBlurRunnable);
+        mBlurRunnable = new Runnable() {
+            @Override
+            public void run() {
+                Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), resId);
+                ViewSwitchUtils.startSwitchBackgroundAnim(mBlurView, BlurBitmapUtils.getBlurBitmap(mBlurView.getContext(), bitmap, 15));
+            }
+        };
+        mBlurView.postDelayed(mBlurRunnable, 500);
+    }
+
+    /**
      * 添加游戏账户
      */
     public void showAddAccount(Activity activity, Action1<Integer> action1) {
@@ -1282,8 +1420,19 @@ public class ViewUtil {
     public static void showShareDialog(final Activity activity, final String url, final String description) {
         View dialog_parent = View.inflate(activity, R.layout.ask_to_share, null);
         final AlertDialog dialog = new AlertDialog.Builder(activity, R.style.AppTheme_Dialog_Alert)
-                .setView(dialog_parent)
+                .setView(dialog_parent).setCancelable(true)
                 .create();
+        Window windows = dialog.getWindow();
+        windows.setGravity(Gravity.BOTTOM); //Dialog在屏幕底部弹出来
+        WindowManager.LayoutParams layoutParams = windows.getAttributes();//获得布局属性
+        layoutParams.width = 400; //设置Dialog的宽
+        layoutParams.height = 200; //设置Dialog的高
+        windows.setWindowAnimations(R.style.Rising);//设置动画效果
+        View viewEmpty = dialog_parent.findViewById(R.id.empty_view);
+       // SpeedRecyclerView speedRecyclerView = dialog_parent.findViewById(R.id.recyclerView);
+       // ImageView card = dialog_parent.findViewById(R.id.blurView);
+       // List<Integer> mList = new ArrayList<>();
+       // init(speedRecyclerView, card, mList, activity);
 //        TextView ask_share_title = dialog_parent.findViewById(R.id.ask_share_title);
         RecyclerView ask_share_list = dialog_parent.findViewById(R.id.ask_share_list);
         GridLayoutManager gridLayoutManager = new GridLayoutManager(activity, 5);
@@ -1308,6 +1457,12 @@ public class ViewUtil {
         nameList.add("QQ好友");
         nameList.add("朋友圈");
         nameList.add("复制链接");
+        viewEmpty.setOnClickListener(new View.OnClickListener() {
+            @Override
+            public void onClick(View view) {
+                dialog.cancel();
+            }
+        });
         AdbCommonRecycler<String> adapter = new AdbCommonRecycler<String>(activity, list) {
 
             @Override
@@ -1371,23 +1526,24 @@ public class ViewUtil {
                 textView.setBackgroundResource(R.drawable.shape_red_stroke_rectangle_no_lb);
                 textView.setTextColor(context.getResources().getColor(R.color.red_FD2D54));
                 textView.setText("现金");
-                textView.setPadding( padding2, padding1,  padding2, padding1);
+                textView.setPadding(padding2, padding1, padding2, padding1);
                 break;
             case 4:
                 textView.setVisibility(View.VISIBLE);
                 textView.setBackgroundResource(R.drawable.shape_red_f07422_stroke_retangle_no_lb);
                 textView.setTextColor(context.getResources().getColor(R.color.red_F07422));
                 textView.setText("活跃");
-                textView.setPadding( padding2, padding1,  padding2, padding1);
+                textView.setPadding(padding2, padding1, padding2, padding1);
                 break;
         }
 
     }
+
     /**
      * 获取状态栏高度
      *
-     * @return , 状态栏高度
      * @param activity
+     * @return , 状态栏高度
      */
     public static int getBarHeight(FragmentActivity activity) {
         int result = 0;

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/view/activity/LoginAct.java

@@ -356,7 +356,7 @@ public class LoginAct extends BaseUMActivity implements LoginContract.View {
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
                     @Override
                     public void onError(BaseMessage baseMessage) {
-                        action1.call(null);
+                        G.showToast(baseMessage);
                     }
 
                     @Override

+ 14 - 6
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtAudit.java

@@ -7,15 +7,20 @@ import android.support.annotation.Nullable;
 import android.view.View;
 import android.widget.ListView;
 
+import com.kfzs.duanduan.event.BigEvent;
+import com.kfzs.duanduan.event.EventTypes;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.ListUtil;
+import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.view.adapter.TaskListItemAdp;
 import com.sheep.gamegroup.view.customview.RefreshLayout;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.base.BaseFragment;
 
+import org.greenrobot.eventbus.EventBus;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -77,6 +82,7 @@ public class FgtAudit extends BaseFragment {
         swipe_container.setOnRefreshListener(new RefreshLayout.OnRefreshListener() {
             @Override
             public void onRefresh() {
+                EventBus.getDefault().post(BigEvent.get().setEventTypes(EventTypes.REFRESH_AUDITACTIVITY_DATA));
                 refreshData();
             }
         });
@@ -114,14 +120,16 @@ public class FgtAudit extends BaseFragment {
             CommonUtil.getInstance().getAudit(new Action1<BaseMessage>() {
                 @Override
                 public void call(BaseMessage baseMessage) {
-                    int count = 0;
                     if(baseMessage != null){
                         List<TaskAcceptedEty> releaseEtyList = baseMessage.getDataList(TaskAcceptedEty.class);
-                        count = ListUtil.addAll(etyList, releaseEtyList);
-                    }
-                    if(count < per_page){//添加最后一条底线
-                        if(!etyList.isEmpty())
-                            etyList.add(null);
+                        ListUtil.removeNull(etyList);
+                        ListUtil.addAll(etyList, releaseEtyList);
+//                        int count = ListUtil.addAll(etyList, releaseEtyList);
+//                        LogUtil.println("FgtAuditAddLine", count, ListUtil.size(releaseEtyList));
+                        if(ListUtil.size(releaseEtyList) < per_page){//添加最后一条底线
+                            if(!etyList.isEmpty())
+                                etyList.add(null);
+                        }
                     }
                     notifyDataSetChanged();
                 }

+ 24 - 0
app/src/main/java/com/sheep/gamegroup/view/fragment/FgtMainAudit.java

@@ -10,6 +10,7 @@ import android.widget.LinearLayout;
 import android.widget.TextView;
 
 import com.kfzs.duanduan.BaseCompatFragment;
+import com.kfzs.duanduan.event.BigEvent;
 import com.kfzs.duanduan.mine.GiftpackListAdapter;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.TaskAuditEntity;
@@ -20,6 +21,9 @@ import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+
 import butterknife.BindView;
 import butterknife.ButterKnife;
 import butterknife.Unbinder;
@@ -56,6 +60,7 @@ public class FgtMainAudit extends BaseCompatFragment {
 
     @Override
     protected void initView(Bundle savedInstanceState) {
+        EventBus.getDefault().register(this);
         setContentView(R.layout.act_audit_layout);
         activity = getActivity();
 
@@ -169,5 +174,24 @@ public class FgtMainAudit extends BaseCompatFragment {
             e.printStackTrace();
         }
     }
+
+    @Subscribe
+    public void onEventMainThread(BigEvent event) {
+        switch (event.getEventTypes()) {
+            case REFRESH_AUDITACTIVITY_DATA:
+                try {
+                    initData();
+                } catch (Exception e) {
+                    e.printStackTrace();
+                }
+                break;
+        }
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        EventBus.getDefault().unregister(this);
+    }
 }
 

+ 9 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -51,6 +51,15 @@ public class SheepApp extends BaseApplication {
     private String packgeName;
     private boolean isInitMidong = false;
     private boolean isShowMidong = false;
+    private int midongTimeCount = 1;
+
+    public int getMidongTimeCount() {
+        return midongTimeCount;
+    }
+
+    public void setMidongTimeCount(int midongTimeCount) {
+        this.midongTimeCount = midongTimeCount;
+    }
 
     public boolean isShowMidong() {
         return isShowMidong;

+ 46 - 0
app/src/main/java/com/sheep/jiuyan/samllsheep/utils/G.java

@@ -1,7 +1,10 @@
 package com.sheep.jiuyan.samllsheep.utils;
 
+import android.app.Activity;
 import android.content.Context;
 import android.text.TextUtils;
+import android.util.DisplayMetrics;
+import android.view.Display;
 import android.view.Gravity;
 import android.view.ViewGroup;
 import android.widget.TextView;
@@ -12,6 +15,8 @@ import com.sheep.jiuyan.samllsheep.BuildConfig;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
+import java.lang.reflect.Method;
+
 
 /**
  * Created by Dlg on 2015/6/17.
@@ -81,4 +86,45 @@ public class G {
             G.showToast(baseMessage.getMsg() + (BuildConfig.DEBUG ? "[" + baseMessage.getCode() + "]" : ""));
         }
     }
+    /**
+     * 获取底部虚拟键盘的高度
+     */
+    public static int getBottomKeyboardHeight(Activity activity){
+        int screenHeight =  G.HEIGHT;
+        DisplayMetrics dm = new DisplayMetrics();
+        activity.getWindowManager().getDefaultDisplay().getMetrics(dm);
+        int heightDifference = screenHeight - dm.heightPixels;
+        return heightDifference;
+    }
+    /**
+     * 通过反射,获取包含虚拟键的整体屏幕高度
+     *
+     * @return
+     */
+    public static int getHasVirtualKey(Activity activity) {
+        int dpi = 0;
+        Display display = activity.getWindowManager().getDefaultDisplay();
+        DisplayMetrics dm = new DisplayMetrics();
+        @SuppressWarnings("rawtypes")
+        Class c;
+        try {
+            c = Class.forName("android.view.Display");
+            @SuppressWarnings("unchecked")
+            Method method = c.getMethod("getRealMetrics", DisplayMetrics.class);
+            method.invoke(display, dm);
+            dpi = dm.heightPixels;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return dpi;
+    }
+    /**
+     * 获取屏幕尺寸,但是不包括虚拟功能高度
+     *
+     * @return
+     */
+    public static int getNoHasVirtualKey(Activity activity) {
+        int height = activity.getWindowManager().getDefaultDisplay().getHeight();
+        return height;
+    }
 }

+ 2 - 2
app/src/main/java/org/afinal/simplecache/ApiKey.java

@@ -53,8 +53,8 @@ public class ApiKey {
     //发现模块标签列表
     public static final String articles_tags = "app/find/articles_tags/list";
     //发现模块发现列表
-    public static String articles(int tag_id){
-        return "app/find/articles/list?page=1&per_page=100&tag_id="+tag_id;
+    public static String articles(int page, int per_page, int tag_id){
+        return String.format(Locale.CHINA, "app/find/articles/list?page=%d&per_page=%d&tag_id=%d", page, per_page, tag_id);
     }
     //发现模块资讯
     public static String articlesItem(int id){

+ 6 - 0
app/src/main/res/drawable/shape_blue_stroke_withe_radius_5.xml

@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<shape xmlns:android="http://schemas.android.com/apk/res/android"
+    android:shape="rectangle">
+<corners android:radius="5dp"/>
+    <solid android:color="@color/blue_2EC2F7"/>
+</shape>

+ 1 - 0
app/src/main/res/layout/activity_main.xml

@@ -1,5 +1,6 @@
 <?xml version="1.0" encoding="utf-8"?>
 <RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/main_layout"
     android:layout_width="match_parent"
     android:layout_height="match_parent">
 

+ 78 - 10
app/src/main/res/layout/ask_to_share.xml

@@ -1,30 +1,98 @@
 <?xml version="1.0" encoding="utf-8"?>
-<FrameLayout 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="match_parent">
+    android:layout_height="wrap_content">
 
     <RelativeLayout
+        android:id="@+id/layout_f"
         android:layout_width="match_parent"
         android:layout_height="wrap_content"
-        android:layout_gravity="bottom"
+        android:layout_alignParentBottom="true"
         android:background="#ffffffff">
 
         <TextView
             android:id="@+id/ask_share_title"
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
+            android:padding="@dimen/content_padding_15"
             android:text="邀请好友"
             android:textColor="#ff333333"
-            android:textSize="14sp"
-            android:padding="@dimen/content_padding_15"/>
+            android:textSize="14sp" />
+
+        <TextView
+            android:id="@+id/tv_copy"
+            android:layout_width="40dp"
+            android:layout_height="20dp"
+            android:layout_alignParentEnd="true"
+            android:layout_marginEnd="15dp"
+            android:layout_marginTop="20dp"
+            android:background="@drawable/shape_blue_stroke_withe_radius_5"
+            android:gravity="center"
+            android:text="复制"
+            android:visibility="gone"
+            android:textColor="@color/white" />
+
+        <TextView
+            android:id="@+id/tv_invitation_code"
+            android:layout_width="wrap_content"
+            android:layout_height="30dp"
+            android:layout_marginRight="5dp"
+            android:layout_marginTop="15dp"
+            android:layout_toLeftOf="@id/tv_copy"
+            android:gravity="center"
+            android:text="12332"
+            android:visibility="gone"
+            android:textColor="#ff333333" />
+
+        <TextView
+            android:id="@+id/tv_f_invatation"
+            android:layout_width="wrap_content"
+            android:layout_height="30dp"
+            android:layout_marginRight="5dp"
+            android:layout_marginTop="15dp"
+            android:layout_toLeftOf="@id/tv_invitation_code"
+            android:gravity="center"
+            android:text="你的邀请码:"
+            android:visibility="gone"
+            android:textColor="#ff333333" />
+
+
         <android.support.v7.widget.RecyclerView
             android:id="@+id/ask_share_list"
+            android:layout_width="match_parent"
+            android:layout_height="wrap_content"
             android:layout_below="@+id/ask_share_title"
-            android:layout_marginTop="20dp"
-            android:layout_marginStart="@dimen/content_padding_15"
             android:layout_marginBottom="35dp"
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"/>
+            android:layout_marginStart="@dimen/content_padding_15"
+            android:layout_marginTop="20dp" />
     </RelativeLayout>
 
-</FrameLayout>
+   <RelativeLayout
+       android:layout_width="match_parent"
+       android:layout_height="450dp"
+       android:id="@+id/layout_f1"
+       android:layout_above="@id/layout_f"
+       android:visibility="gone">
+       <ImageView
+           android:id="@+id/blurView"
+           android:layout_width="match_parent"
+           android:layout_height="match_parent"
+           android:background="#3f000000"
+           android:scaleType="centerCrop"/>
+
+       <com.kfzs.duanduan.cardview.SpeedRecyclerView
+           android:id="@+id/recyclerView"
+           android:layout_width="match_parent"
+           android:layout_height="match_parent"
+           android:layout_marginBottom="30dp"
+           android:layout_marginTop="30dp"/>
+   </RelativeLayout>
+
+    <View
+        android:id="@+id/empty_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_above="@id/layout_f1"
+        android:visibility="gone"/>
+
+</RelativeLayout>

+ 30 - 0
app/src/main/res/layout/common_foot_view.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:id="@+id/bottom_line"
+    android:layout_width="match_parent"
+    android:layout_height="wrap_content">
+    <!--必须至少两层,否则不能居中-->
+    <LinearLayout
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:gravity="center"
+        android:orientation="horizontal"
+        android:padding="@dimen/content_padding_20">
+
+        <ImageView
+            android:layout_width="30dp"
+            android:layout_height="wrap_content"
+            android:adjustViewBounds="true"
+            android:scaleType="fitXY"
+            android:src="@mipmap/bottom_icon" />
+
+        <TextView
+            android:id="@+id/bottom_line_text"
+            android:layout_width="wrap_content"
+            android:layout_height="wrap_content"
+            android:layout_marginStart="@dimen/content_padding"
+            android:text="我是有底线的"
+            android:textColor="#C0C0C0"
+            android:textSize="14sp" />
+    </LinearLayout>
+</RelativeLayout>

+ 0 - 1
app/src/main/res/layout/common_tab_vp.xml

@@ -15,7 +15,6 @@
     <android.support.design.widget.TabLayout
         android:id="@+id/indicator"
         style="@style/style_tab"
-        android:layout_marginBottom="7dp"
         android:layout_marginTop="7dp" />
 
     <android.support.v4.view.ViewPager

+ 1 - 1
app/src/main/res/layout/dialog_redpackage_after_invitation.xml

@@ -18,7 +18,7 @@
             android:layout_height="wrap_content"
             android:layout_centerHorizontal="true"
             android:layout_marginTop="50dp"
-            android:text="@string/congratunation"
+            android:text="    恭喜你!"
             android:textColor="#ffffe0d7"
             android:textSize="24sp" />
 

+ 30 - 0
app/src/main/res/layout/net_empty_xrecycler.xml

@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="utf-8"?>
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+    android:layout_width="match_parent"
+    android:layout_height="match_parent"
+    android:background="@color/bg_gray">
+
+    <include
+        android:id="@+id/title"
+        layout="@layout/title" />
+
+    <include
+        android:id="@+id/check_net_ll"
+        layout="@layout/check_net_view"
+        android:layout_width="match_parent"
+        android:layout_height="wrap_content"
+        android:layout_below="@+id/title" />
+
+    <include
+        android:id="@+id/empty_view"
+        layout="@layout/empty_view"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_below="@+id/check_net_ll" />
+
+    <com.jcodecraeer.xrecyclerview.XRecyclerView
+        android:id="@+id/view_list"
+        android:layout_width="match_parent"
+        android:layout_height="match_parent"
+        android:layout_below="@+id/check_net_ll"/>
+</RelativeLayout>

+ 2 - 0
app/src/main/res/layout/pop_get_redpackage.xml

@@ -28,6 +28,8 @@
             android:layout_width="wrap_content"
             android:layout_height="wrap_content"
             android:layout_gravity="center_horizontal"
+            android:maxLength="10"
+            android:singleLine="true"
             android:layout_marginTop="20dp"
             android:background="@drawable/shape_get_redpackage_text_white"
             android:gravity="center"

+ 19 - 0
app/src/main/res/layout/view_card_item.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<android.support.v7.widget.CardView
+    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="match_parent"
+    app:cardCornerRadius="8dp"
+    app:cardElevation="6dp"
+    app:cardMaxElevation="12dp"
+    app:cardUseCompatPadding="true">
+
+    <ImageView
+        android:id="@+id/imageView"
+        android:layout_width="250dp"
+        android:layout_height="match_parent"
+        android:scaleType="centerCrop"
+        android:src="@drawable/kaipin"/>
+
+</android.support.v7.widget.CardView>

+ 4 - 4
app/src/main/res/values/strings.xml

@@ -15,11 +15,11 @@
 
     <string name="total_money_lable">绵羊币总余额:</string>
     <string name="total_money">%s元</string>
-    <string name="task_reward">任务奖励额:%s元</string>
-    <string name="agent_extract">推广提成额:%s元</string>
-    <string name="recharge_amount">充值额:%s元</string>
+    <string name="task_reward">任务奖励额:%s元</string>
+    <string name="agent_extract">推广提成额:%s元</string>
+    <string name="recharge_amount">充值额:%s元</string>
     <string name="available_amount">可提现金额:%s元</string>
-    <string name="dingxiang_amount">福利额:%s元</string>
+    <string name="dingxiang_amount">福利额:%s元</string>
 
     <string name="rechargeq_amount">当前绵羊币余额:%s元</string>