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

Merge remote-tracking branch 'origin/sheep_develop' into sheep_develop_jenkins

zengjiebin пре 7 година
родитељ
комит
dacdc4c798
100 измењених фајлова са 5498 додато и 898 уклоњено
  1. 1 0
      .idea/gradle.xml
  2. 1 0
      WaterWaveProgress/.gitignore
  3. 28 0
      WaterWaveProgress/build.gradle
  4. 25 0
      WaterWaveProgress/proguard-rules.pro
  5. 26 0
      WaterWaveProgress/src/androidTest/java/com/bingfor/waterwaveprogress/ExampleInstrumentedTest.java
  6. 12 0
      WaterWaveProgress/src/main/AndroidManifest.xml
  7. 103 0
      WaterWaveProgress/src/main/java/cn/modificator/waterwave_progress/WaterWaveAttrInit.java
  8. 462 0
      WaterWaveProgress/src/main/java/cn/modificator/waterwave_progress/WaterWaveProgress.java
  9. 15 0
      WaterWaveProgress/src/main/java/cn/modificator/waterwave_progress/WidgetUtil.java
  10. 19 0
      WaterWaveProgress/src/main/res/values/attrs.xml
  11. 3 0
      WaterWaveProgress/src/main/res/values/strings.xml
  12. 17 0
      WaterWaveProgress/src/test/java/com/bingfor/waterwaveprogress/ExampleUnitTest.java
  13. 9 6
      app/build.gradle
  14. 1 0
      app/proguard-rules.pro
  15. 61 12
      app/src/main/AndroidManifest.xml
  16. 162 16
      app/src/main/java/com/kfzs/duanduan/utils/ApkUtils.java
  17. 0 79
      app/src/main/java/com/kfzs/duanduan/view/ViewPagerAutoHeigh.java
  18. 315 0
      app/src/main/java/com/lqr/emoji/EmotionKeyboard.java
  19. 205 0
      app/src/main/java/com/lqr/emoji/EmotionLayout.java
  20. 7 0
      app/src/main/java/com/lqr/emoji/IEmotionSelectedListener.java
  21. 46 0
      app/src/main/java/com/lqr/emoji/ListPagerAdapter.java
  22. 8 3
      app/src/main/java/com/sheep/gamegroup/absBase/AbsChooseImageActivity.java
  23. 119 0
      app/src/main/java/com/sheep/gamegroup/absBase/AbsDownloadListener.java
  24. 154 0
      app/src/main/java/com/sheep/gamegroup/absBase/AbsGetDownloadListener.java
  25. 2 2
      app/src/main/java/com/sheep/gamegroup/absBase/BaseActivity.java
  26. 38 0
      app/src/main/java/com/sheep/gamegroup/absBase/BaseContainerActivity.java
  27. 19 6
      app/src/main/java/com/sheep/gamegroup/view/activity/BaseListActivity2.java
  28. 56 0
      app/src/main/java/com/sheep/gamegroup/absBase/BaseRefreshLoadMoreFragment.java
  29. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/ICallBack2.java
  30. 9 0
      app/src/main/java/com/sheep/gamegroup/absBase/IContentContainer.java
  31. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/IContentTypeContainer.java
  32. 27 0
      app/src/main/java/com/sheep/gamegroup/absBase/IHomePageSearch.java
  33. 14 0
      app/src/main/java/com/sheep/gamegroup/absBase/IJump.java
  34. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/ILoadMore.java
  35. 10 0
      app/src/main/java/com/sheep/gamegroup/absBase/IRefresh.java
  36. 9 0
      app/src/main/java/com/sheep/gamegroup/absBase/ISearch.java
  37. 9 0
      app/src/main/java/com/sheep/gamegroup/absBase/ISearchRecord.java
  38. 9 0
      app/src/main/java/com/sheep/gamegroup/absBase/ITag.java
  39. 82 2
      app/src/main/java/com/sheep/gamegroup/greendao/DDProviderHelper.java
  40. 5 2
      app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java
  41. 14 0
      app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java
  42. 81 0
      app/src/main/java/com/sheep/gamegroup/greendao/download/SearchRecord.java
  43. 145 0
      app/src/main/java/com/sheep/gamegroup/greendao/download/SearchRecordDao.java
  44. 2 1
      app/src/main/java/com/sheep/gamegroup/helper/DownloadHelper.java
  45. 37 67
      app/src/main/java/com/sheep/gamegroup/helper/FindAppHelper.java
  46. 2 8
      app/src/main/java/com/sheep/gamegroup/helper/ImageListHelper.java
  47. 6 6
      app/src/main/java/com/sheep/gamegroup/helper/TaskHelper.java
  48. 291 5
      app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java
  49. 92 0
      app/src/main/java/com/sheep/gamegroup/model/entity/ApkFileInfo.java
  50. 121 0
      app/src/main/java/com/sheep/gamegroup/model/entity/AppScoreDetail.java
  51. 158 72
      app/src/main/java/com/sheep/gamegroup/model/entity/FindApp.java
  52. 10 10
      app/src/main/java/com/sheep/gamegroup/model/entity/FindItem.java
  53. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/FindTag.java
  54. 21 0
      app/src/main/java/com/sheep/gamegroup/model/entity/BaseMessage.java
  55. 6 7
      app/src/main/java/com/sheep/gamegroup/model/entity/CommendApp.java
  56. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/CreditCardProgressQuery.java
  57. 31 0
      app/src/main/java/com/sheep/gamegroup/model/entity/Entry.java
  58. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/FindAppReservation.java
  59. 12 3
      app/src/main/java/com/sheep/gamegroup/model/entity/FindAppScore.java
  60. 67 19
      app/src/main/java/com/sheep/gamegroup/model/entity/GameEntity.java
  61. 0 39
      app/src/main/java/com/sheep/gamegroup/model/entity/GameEntityList.java
  62. 123 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameInfoList.java
  63. 19 0
      app/src/main/java/com/sheep/gamegroup/model/entity/GameRecommend.java
  64. 3 3
      app/src/main/java/com/sheep/gamegroup/model/entity/GiftBagApp.java
  65. 4 1
      app/src/main/java/com/sheep/gamegroup/model/entity/HomeListEntity.java
  66. 81 0
      app/src/main/java/com/sheep/gamegroup/model/entity/HomePageSearch.java
  67. 29 0
      app/src/main/java/com/sheep/gamegroup/model/entity/InputAndUrlList.java
  68. 28 0
      app/src/main/java/com/sheep/gamegroup/model/entity/LatelyGame.java
  69. 7 6
      app/src/main/java/com/sheep/gamegroup/model/entity/GameListTypeList.java
  70. 83 0
      app/src/main/java/com/sheep/gamegroup/model/entity/Lp.java
  71. 145 0
      app/src/main/java/com/sheep/gamegroup/model/entity/NoviceGuidance.java
  72. 0 398
      app/src/main/java/com/sheep/gamegroup/model/entity/PlayGameEntity.java
  73. 24 0
      app/src/main/java/com/sheep/gamegroup/model/entity/RechargeLogEntity.java
  74. 2 2
      app/src/main/java/com/sheep/gamegroup/model/entity/TaskReleaseEty.java
  75. 41 0
      app/src/main/java/com/sheep/gamegroup/model/entity/SheepSignResult.java
  76. 116 0
      app/src/main/java/com/sheep/gamegroup/model/entity/ShowAll.java
  77. 16 3
      app/src/main/java/com/sheep/gamegroup/model/entity/TaskAcceptedEty.java
  78. 10 1
      app/src/main/java/com/sheep/gamegroup/model/entity/TaskEty.java
  79. 99 0
      app/src/main/java/com/sheep/gamegroup/model/entity/TitleInfoList.java
  80. 131 0
      app/src/main/java/com/sheep/gamegroup/model/entity/TopSearchStatistics.java
  81. 237 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserComment.java
  82. 29 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentDetail.java
  83. 135 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentReply.java
  84. 30 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentUserData.java
  85. 124 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentWithReply.java
  86. 140 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserFocus.java
  87. 120 0
      app/src/main/java/com/sheep/gamegroup/model/entity/UserSign.java
  88. 1 1
      app/src/main/java/com/sheep/gamegroup/presenter/LoginPresenter.java
  89. 5 5
      app/src/main/java/com/sheep/gamegroup/presenter/PhonePresenter.java
  90. 1 1
      app/src/main/java/com/sheep/gamegroup/presenter/TaskDetailContract.java
  91. 4 3
      app/src/main/java/com/sheep/gamegroup/presenter/TaskDetailPresenter.java
  92. 32 8
      app/src/main/java/com/sheep/gamegroup/receiver/AppAddOrDelReceiver.java
  93. 11 1
      app/src/main/java/com/sheep/gamegroup/usage/AppUsageManager.java
  94. 73 0
      app/src/main/java/com/sheep/gamegroup/util/ApiJSONUtil.java
  95. 125 0
      app/src/main/java/com/sheep/gamegroup/util/ApiUtil.java
  96. 137 85
      app/src/main/java/com/sheep/gamegroup/util/CommonUtil.java
  97. 16 0
      app/src/main/java/com/sheep/gamegroup/util/DataKey.java
  98. 38 6
      app/src/main/java/com/sheep/gamegroup/util/DataUtil.java
  99. 56 0
      app/src/main/java/com/sheep/gamegroup/util/DownloadTextUtl.java
  100. 0 0
      app/src/main/java/com/sheep/gamegroup/util/DownloadUtil.java

+ 1 - 0
.idea/gradle.xml

@@ -8,6 +8,7 @@
         <option name="modules">
           <set>
             <option value="$PROJECT_DIR$" />
+            <option value="$PROJECT_DIR$/WaterWaveProgress" />
             <option value="$PROJECT_DIR$/app" />
             <option value="$PROJECT_DIR$/ucrop" />
             <option value="$PROJECT_DIR$/view" />

+ 1 - 0
WaterWaveProgress/.gitignore

@@ -0,0 +1 @@
+/build

+ 28 - 0
WaterWaveProgress/build.gradle

@@ -0,0 +1,28 @@
+apply plugin: 'com.android.library'
+
+android {
+    compileSdkVersion ANDROID_COMPILE_SDK_VERSION as int
+    buildToolsVersion ANDROID_BUILD_TOOLS_VERSION
+
+    defaultConfig {
+        minSdkVersion ANDROID_MIN_SDK_VERSION as int
+        targetSdkVersion ANDORID_TARGET_SDK_VERSION as int
+        versionCode VERSION_CODE as int
+        versionName VERSION_NAME
+
+    }
+    buildTypes {
+        release {
+            minifyEnabled false
+            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
+        }
+    }
+}
+
+dependencies {
+    implementation fileTree(dir: 'libs', include: ['*.jar'])
+    androidTestImplementation('com.android.support.test.espresso:espresso-core:2.2.2', {
+        exclude group: 'com.android.support', module: 'support-annotations'
+    })
+    implementation "com.android.support:appcompat-v7:$supportLibVersion"
+}

+ 25 - 0
WaterWaveProgress/proguard-rules.pro

@@ -0,0 +1,25 @@
+# Add project specific ProGuard rules here.
+# By default, the flags in this file are appended to flags specified
+# in /home/mod/Android/Sdk/tools/proguard/proguard-android.txt
+# You can edit the include path and order by changing the proguardFiles
+# directive in build.gradle.
+#
+# For more details, see
+#   http://developer.android.com/guide/developing/tools/proguard.html
+
+# Add any project specific keep options here:
+
+# If your project uses WebView with JS, uncomment the following
+# and specify the fully qualified class name to the JavaScript interface
+# class:
+#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
+#   public *;
+#}
+
+# Uncomment this to preserve the line number information for
+# debugging stack traces.
+#-keepattributes SourceFile,LineNumberTable
+
+# If you keep the line number information, uncomment this to
+# hide the original source file name.
+#-renamesourcefileattribute SourceFile

+ 26 - 0
WaterWaveProgress/src/androidTest/java/com/bingfor/waterwaveprogress/ExampleInstrumentedTest.java

@@ -0,0 +1,26 @@
+package com.bingfor.waterwaveprogress;
+
+import android.content.Context;
+import android.support.test.InstrumentationRegistry;
+import android.support.test.runner.AndroidJUnit4;
+
+import org.junit.Test;
+import org.junit.runner.RunWith;
+
+import static org.junit.Assert.*;
+
+/**
+ * Instrumentation test, which will execute on an Android device.
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+@RunWith(AndroidJUnit4.class)
+public class ExampleInstrumentedTest {
+    @Test
+    public void useAppContext() throws Exception {
+        // Context of the app under test.
+        Context appContext = InstrumentationRegistry.getTargetContext();
+
+        assertEquals("com.bingfor.waterwaveprogress.test", appContext.getPackageName());
+    }
+}

+ 12 - 0
WaterWaveProgress/src/main/AndroidManifest.xml

@@ -0,0 +1,12 @@
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+
+    package="cn.modificator.waterwave_progress">
+
+    <application
+        android:allowBackup="true"
+        android:label="@string/app_name"
+        android:supportsRtl="true">
+
+    </application>
+
+</manifest>

+ 103 - 0
WaterWaveProgress/src/main/java/cn/modificator/waterwave_progress/WaterWaveAttrInit.java

@@ -0,0 +1,103 @@
+package cn.modificator.waterwave_progress;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.util.AttributeSet;
+import cn.modificator.waterwave_progress.R;
+
+public class WaterWaveAttrInit {
+
+	private int progressWidth; // 进度条宽度
+	private int progressColor;
+	private int progressBgColor;
+	private int waterWaveColor;
+	private int waterWaveBgColor;
+	private int progress2WaterWidth; // 进度条和水波之间的间距
+	private boolean showProgress; // 是否显示进度条
+	private boolean showNumerical; // 是否显示百分比
+	private int fontSize;
+	private int textColor;
+	private int progress;
+	private int maxProgress;
+
+	@SuppressLint("Recycle")
+	public WaterWaveAttrInit(Context context, AttributeSet attrs, int defStyle) {
+		TypedArray typedArray = context.obtainStyledAttributes(attrs,
+				R.styleable.WaterWaveProgress, defStyle, 0);
+		progressWidth = typedArray.getDimensionPixelOffset(
+				R.styleable.WaterWaveProgress_progressWidth, 0);
+		progressColor = typedArray.getColor(
+				R.styleable.WaterWaveProgress_progressColor, 0xFF33B5E5);
+		progressBgColor = typedArray.getColor(
+				R.styleable.WaterWaveProgress_progressBgColor, 0xFFBEBEBE);
+		waterWaveColor = typedArray.getColor(
+				R.styleable.WaterWaveProgress_waterWaveColor, 0XFF4BBDFE);
+		waterWaveBgColor = typedArray.getColor(
+				R.styleable.WaterWaveProgress_waterWaveBgColor, 0xFFDDDDDD);
+		progress2WaterWidth = typedArray.getDimensionPixelOffset(
+				R.styleable.WaterWaveProgress_progress2WaterWidth, 0);
+		showProgress = typedArray.getBoolean(
+				R.styleable.WaterWaveProgress_showProgress, true);
+		showNumerical = typedArray.getBoolean(
+				R.styleable.WaterWaveProgress_showNumerical, true);
+		fontSize = typedArray.getDimensionPixelOffset(
+				R.styleable.WaterWaveProgress_fontSize, 0);
+		textColor = typedArray.getColor(
+				R.styleable.WaterWaveProgress_textColor, 0xFFFFFFFF);
+		progress = typedArray.getInteger(
+				R.styleable.WaterWaveProgress_progress, 15);
+		maxProgress = typedArray.getInteger(
+				R.styleable.WaterWaveProgress_maxProgress, 100);
+		typedArray.recycle();
+	}
+
+	public int getProgressWidth() {
+		return progressWidth;
+	}
+
+	public int getProgressColor() {
+		return progressColor;
+	}
+
+	public int getProgressBgColor() {
+		return progressBgColor;
+	}
+
+	public int getWaterWaveColor() {
+		return waterWaveColor;
+	}
+
+	public int getWaterWaveBgColor() {
+		return waterWaveBgColor;
+	}
+
+	public int getProgress2WaterWidth() {
+		return progress2WaterWidth;
+	}
+
+	public boolean isShowProgress() {
+		return showProgress;
+	}
+
+	public boolean isShowNumerical() {
+		return showNumerical;
+	}
+
+	public int getFontSize() {
+		return fontSize;
+	}
+
+	public int getTextColor() {
+		return textColor;
+	}
+
+	public int getProgress() {
+		return progress;
+	}
+
+	public int getMaxProgress() {
+		return maxProgress;
+	}
+
+}

+ 462 - 0
WaterWaveProgress/src/main/java/cn/modificator/waterwave_progress/WaterWaveProgress.java

@@ -0,0 +1,462 @@
+package cn.modificator.waterwave_progress;
+
+import java.lang.ref.WeakReference;
+import java.text.DecimalFormat;
+import java.util.Locale;
+
+import android.annotation.SuppressLint;
+import android.content.Context;
+import android.graphics.Canvas;
+import android.graphics.Color;
+import android.graphics.Paint;
+import android.graphics.Path;
+import android.graphics.Point;
+import android.graphics.RectF;
+import android.graphics.Region;
+import android.graphics.Path.Direction;
+import android.graphics.Region.Op;
+import android.os.Handler;
+import android.os.Message;
+import android.os.Build.VERSION;
+import android.os.Build.VERSION_CODES;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.KeyEvent;
+import android.view.View;
+import android.widget.ProgressBar;
+
+/**
+ * @author Administrator
+ */
+public class WaterWaveProgress extends View {
+    // 水的画笔 // 画圆环的画笔// 进度百分比的画笔
+    private Paint mPaintWater = null, mRingPaint = null, mTextPaint = null;
+
+    // 圆环颜色 // 圆环背景颜色 // 当前进度 //水波颜色 // 水波背景色 //进度条和水波之间的距离 //进度百分比字体大小
+    // //进度百分比字体颜色
+    private int mRingColor, mRingBgColor, mWaterColor, mWaterBgColor,
+            mFontSize, mTextColor;
+    // 进度 //浪峰个数
+    float crestCount = 1.5f;
+
+    int mProgress = 10, mMaxProgress = 100;
+
+    // 画布中心点
+    private Point mCenterPoint;
+    // 圆环宽度
+    private float mRingWidth, mProgress2WaterWidth;
+    // 是否显示进度条 //是否显示进度百分比
+    private boolean mShowProgress = false, mShowNumerical = true;
+
+    /**
+     * 产生波浪效果的因子
+     */
+    private long mWaveFactor = 0L;
+    /**
+     * 正在执行波浪动画
+     */
+    private boolean isWaving = false;
+    /**
+     * 振幅
+     */
+    private float mAmplitude = 30.0F; // 20F
+    /**
+     * 波浪的速度
+     */
+    private float mWaveSpeed = 0.070F; // 0.020F
+    /**
+     * 水的透明度
+     */
+    private int mWaterAlpha = 255; // 255
+    WaterWaveAttrInit attrInit;
+
+    private MyHandler mHandler = null;
+
+    private static class MyHandler extends Handler {
+        private WeakReference<WaterWaveProgress> mWeakRef = null;
+
+        private int refreshPeriod = 100;
+
+        public MyHandler(WaterWaveProgress host) {
+            mWeakRef = new WeakReference<WaterWaveProgress>(host);
+        }
+
+        @Override
+        public void handleMessage(Message msg) {
+            super.handleMessage(msg);
+            if (mWeakRef.get() != null) {
+                mWeakRef.get().invalidate();
+                sendEmptyMessageDelayed(0, refreshPeriod);
+            }
+        }
+    }
+
+    public WaterWaveProgress(Context paramContext) {
+        super(paramContext);
+    }
+
+    public WaterWaveProgress(Context context, AttributeSet attributeSet) {
+        this(context, attributeSet, 0);
+    }
+
+    public WaterWaveProgress(Context context, AttributeSet attrs,
+                             int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        attrInit = new WaterWaveAttrInit(context, attrs, defStyleAttr);
+        init(context);
+    }
+
+    @SuppressLint("NewApi")
+    private void init(Context context) {
+        mCenterPoint = new Point();
+        mRingColor = attrInit.getProgressColor();
+        mRingBgColor = attrInit.getProgressBgColor();
+        mWaterColor = attrInit.getWaterWaveColor();
+        mWaterBgColor = attrInit.getWaterWaveBgColor();
+        mRingWidth = attrInit.getProgressWidth();
+        mProgress2WaterWidth = attrInit.getProgress2WaterWidth();
+        mShowProgress = attrInit.isShowProgress();
+        mShowNumerical = attrInit.isShowNumerical();
+        mFontSize = attrInit.getFontSize();
+        mTextColor = attrInit.getTextColor();
+        mProgress = attrInit.getProgress();
+        mMaxProgress = attrInit.getMaxProgress();
+
+        // 如果手机版本在4.0以上,则开启硬件加速
+        if (VERSION.SDK_INT >= VERSION_CODES.ICE_CREAM_SANDWICH) {
+            setLayerType(View.LAYER_TYPE_HARDWARE, null);
+            // setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+        }
+        mRingPaint = new Paint();
+        mRingPaint.setAntiAlias(true);
+        mRingPaint.setColor(mRingColor); // 圆环颜色
+        mRingPaint.setStyle(Paint.Style.STROKE);
+        mRingPaint.setStrokeWidth(mRingWidth); // 圆环宽度
+
+        mPaintWater = new Paint();
+        mPaintWater.setStrokeWidth(1.0F);
+        mPaintWater.setColor(mWaterColor);
+        // mPaintWater.setColor(getResources().getColor(mWaterColor));
+        mPaintWater.setAlpha(mWaterAlpha);
+
+        mTextPaint = new Paint();
+        mTextPaint.setAntiAlias(true);
+        mTextPaint.setColor(mTextColor);
+        mTextPaint.setStyle(Paint.Style.FILL);
+        mTextPaint.setTextSize(mFontSize);
+
+        mHandler = new MyHandler(this);
+
+    }
+
+    public void animateWave() {
+        if (!isWaving) {
+            mWaveFactor = 0L;
+            isWaving = true;
+            mHandler.sendEmptyMessage(0);
+        }
+    }
+
+    @SuppressLint({"DrawAllocation", "NewApi"})
+    protected void onDraw(Canvas canvas) {
+        super.onDraw(canvas);
+        // 获取整个View(容器)的宽、高
+        int width = getWidth();
+        int height = getHeight();
+        width = height = (width < height) ? width : height;
+        mAmplitude = width / 20f;
+
+        mCenterPoint.x = width / 2;
+        mCenterPoint.y = height / 2;
+        { // 重新设置进度条的宽度和水波与进度条的距离,,至于为什么写在这,我脑袋抽了可以不
+            mRingWidth = mRingWidth == 0 ? width / 20 : mRingWidth;
+            mProgress2WaterWidth = mProgress2WaterWidth == 0 ? mRingWidth * 0.6f
+                    : mProgress2WaterWidth;
+            mRingPaint.setStrokeWidth(mRingWidth);
+            mTextPaint.setTextSize(mFontSize == 0 ? width / 5 : mFontSize);
+            if (VERSION.SDK_INT == VERSION_CODES.JELLY_BEAN) {
+                setLayerType(View.LAYER_TYPE_SOFTWARE, null);
+            } else {
+                setLayerType(View.LAYER_TYPE_HARDWARE, null);
+            }
+        }
+
+        RectF oval = new RectF();
+        oval.left = mRingWidth / 2;
+        oval.top = mRingWidth / 2;
+        oval.right = width - mRingWidth / 2;
+        oval.bottom = height - mRingWidth / 2;
+
+        if (isInEditMode()) {
+            mRingPaint.setColor(mRingBgColor);
+            canvas.drawArc(oval, -90, 360, false, mRingPaint);
+            mRingPaint.setColor(mRingColor);
+            canvas.drawArc(oval, -90, 90, false, mRingPaint);
+            canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, mCenterPoint.x
+                    - mRingWidth - mProgress2WaterWidth, mPaintWater);
+            return;
+        }
+
+        // 如果没有执行波浪动画,或者也没有指定容器宽高,就画个简单的矩形
+        if ((width == 0) || (height == 0) || isInEditMode()) {
+            canvas.drawCircle(mCenterPoint.x, mCenterPoint.y, width / 2
+                    - mProgress2WaterWidth - mRingWidth, mPaintWater);
+            return;
+        }
+
+        // 水与边框的距离
+        float waterPadding = mShowProgress ? mRingWidth + mProgress2WaterWidth
+                : 0;
+        // 水最高处
+        int waterHeightCount = mShowProgress ? (int) (height - waterPadding * 2)
+                : height;
+
+        // 重新生成波浪的形状
+        mWaveFactor++;
+        if (mWaveFactor >= Integer.MAX_VALUE) {
+            mWaveFactor = 0L;
+        }
+
+        // 画进度条背景
+        mRingPaint.setColor(mRingBgColor);
+        // canvas.drawArc(oval, -90, 360, false, mRingPaint);
+        // //和下面效果一样,只不过这个是画个360度的弧,下面是画圆环
+        canvas.drawCircle(width / 2, width / 2, waterHeightCount / 2
+                + waterPadding - mRingWidth / 2, mRingPaint);
+        mRingPaint.setColor(mRingColor);
+        // 100为 总进度
+        canvas.drawArc(oval, -90, (mProgress * 1f) / mMaxProgress * 360f, false,
+                mRingPaint);
+
+        // 计算出水的高度
+        float waterHeight = waterHeightCount * (1 - (mProgress * 1f) / mMaxProgress)
+                + waterPadding;
+        int staticHeight = (int) (waterHeight + mAmplitude);
+        Path mPath = new Path();
+        mPath.reset();
+        if (mShowProgress) {
+            mPath.addCircle(width / 2, width / 2, waterHeightCount / 2,
+                    Direction.CCW);
+        } else {
+            mPath.addCircle(width / 2, width / 2, waterHeightCount / 2,
+                    Direction.CCW);
+        }
+        // canvas添加限制,让接下来的绘制都在园内
+        canvas.clipPath(mPath, Op.INTERSECT);
+//		canvas.clipPath(mPath, Op.REPLACE);
+        Paint bgPaint = new Paint();
+        bgPaint.setColor(mWaterBgColor);
+        // 绘制背景
+        canvas.drawRect(waterPadding, waterPadding, waterHeightCount
+                + waterPadding, waterHeightCount + waterPadding, bgPaint);
+        // 绘制静止的水
+        canvas.drawRect(waterPadding, staticHeight, waterHeightCount
+                + waterPadding, waterHeightCount + waterPadding, mPaintWater);
+
+        // 待绘制的波浪线的x坐标
+        int xToBeDrawed = (int) waterPadding;
+        int waveHeight = (int) (waterHeight - mAmplitude
+                * Math.sin(Math.PI
+                * (2.0F * (xToBeDrawed + (mWaveFactor * width)
+                * mWaveSpeed)) / width));
+        // 波浪线新的高度
+        int newWaveHeight = waveHeight;
+        while (true) {
+            if (xToBeDrawed >= waterHeightCount + waterPadding) {
+                break;
+            }
+            // 根据当前x值计算波浪线新的高度
+            newWaveHeight = (int) (waterHeight - mAmplitude
+                    * Math.sin(Math.PI
+                    * (crestCount * (xToBeDrawed + (mWaveFactor * waterHeightCount)
+                    * mWaveSpeed)) / waterHeightCount));
+
+            // 先画出梯形的顶边
+            canvas.drawLine(xToBeDrawed, waveHeight, xToBeDrawed + 1,
+                    newWaveHeight, mPaintWater);
+
+            // 画出动态变化的柱子部分
+            canvas.drawLine(xToBeDrawed, newWaveHeight, xToBeDrawed + 1,
+                    staticHeight, mPaintWater);
+            xToBeDrawed++;
+            waveHeight = newWaveHeight;
+        }
+        if (mShowNumerical) {
+//            String progressTxt = String.format(Locale.CHINA, "%.0f.%%", (mProgress * 1f) / mMaxProgress * 100f);//%进度
+            String progressTxt = text != null ? text : new DecimalFormat("0.0").format((mProgress * 10f) / mMaxProgress);//10分满分制
+            float mTxtWidth = mTextPaint.measureText(progressTxt, 0, progressTxt.length());
+            canvas.drawText(progressTxt, mCenterPoint.x - mTxtWidth / 2,
+                    mCenterPoint.x * 1.5f - mFontSize / 2, mTextPaint);
+        }
+    }
+    //要显示的文本
+    private String text;
+
+    public void setText(String text) {
+        this.text = text;
+    }
+
+    @Override
+    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
+        int width = widthMeasureSpec;
+        int height = heightMeasureSpec;
+        width = height = (width < height) ? width : height;
+        setMeasuredDimension(width, height);
+    }
+
+    /**
+     * 设置波浪的振幅
+     */
+    public void setAmplitude(float amplitude) {
+        mAmplitude = amplitude;
+    }
+
+    /**
+     * 设置水的透明度
+     *
+     * @param alpha 透明的百分比,值为0到1之间的小数,越接近0越透明
+     */
+    public void setWaterAlpha(float alpha) {
+        mWaterAlpha = (int) (255.0F * alpha);
+        mPaintWater.setAlpha(mWaterAlpha);
+    }
+
+    /**
+     * 设置水的颜色
+     */
+    public void setWaterColor(int color) {
+        mWaterColor = color;
+    }
+
+    /**
+     * 设置当前进度
+     */
+    public void setProgress(int progress) {
+        progress = progress > 100 ? 100 : progress < 0 ? 0 : progress;
+        mProgress = progress;
+        invalidate();
+    }
+
+    /**
+     * 获取进度 动画时会用到
+     */
+    public int getProgress() {
+        return mProgress;
+    }
+
+    /**
+     * 设置波浪速度
+     */
+    public void setWaveSpeed(float speed) {
+        mWaveSpeed = speed;
+    }
+
+    /**
+     * 是否显示进度条
+     *
+     * @param b
+     */
+    public void setShowProgress(boolean b) {
+        mShowProgress = b;
+    }
+
+    /**
+     * 是否显示进度值
+     *
+     * @param b
+     */
+    public void setShowNumerical(boolean b) {
+        mShowNumerical = b;
+    }
+
+    /**
+     * 设置进度条前景色
+     *
+     * @param mRingColor
+     */
+    public void setmRingColor(int mRingColor) {
+        this.mRingColor = mRingColor;
+    }
+
+    /**
+     * 设置进度条背景色
+     *
+     * @param mRingBgColor
+     */
+    public void setmRingBgColor(int mRingBgColor) {
+        this.mRingBgColor = mRingBgColor;
+    }
+
+    /**
+     * 设置水波颜色
+     *
+     * @param mWaterColor
+     */
+    public void setmWaterColor(int mWaterColor) {
+        this.mWaterColor = mWaterColor;
+    }
+
+    /**
+     * 设置水波背景色
+     *
+     * @param mWaterBgColor
+     */
+    public void setWaterBgColor(int mWaterBgColor) {
+        this.mWaterBgColor = mWaterBgColor;
+    }
+
+    /**
+     * 设置进度值显示字体大小
+     *
+     * @param mFontSize
+     */
+    public void setFontSize(int mFontSize) {
+        this.mFontSize = mFontSize;
+    }
+
+    /**
+     * 设置进度值显示字体颜色
+     *
+     * @param mTextColor
+     */
+    public void setTextColor(int mTextColor) {
+        this.mTextColor = mTextColor;
+    }
+
+    /**
+     * 设置进度条最大值
+     *
+     * @param mMaxProgress
+     */
+    public void setMaxProgress(int mMaxProgress) {
+        this.mMaxProgress = mMaxProgress;
+    }
+
+    /**
+     * 设置浪峰个数
+     *
+     * @param crestCount
+     */
+    public void setCrestCount(float crestCount) {
+        this.crestCount = crestCount;
+    }
+
+    /**
+     * 设置进度条宽度
+     *
+     * @param mRingWidth
+     */
+    public void setRingWidth(float mRingWidth) {
+        this.mRingWidth = mRingWidth;
+    }
+
+    /**
+     * 设置水波到进度条之间的距离
+     *
+     * @param mProgress2WaterWidth
+     */
+    public void setProgress2WaterWidth(float mProgress2WaterWidth) {
+        this.mProgress2WaterWidth = mProgress2WaterWidth;
+    }
+
+}

+ 15 - 0
WaterWaveProgress/src/main/java/cn/modificator/waterwave_progress/WidgetUtil.java

@@ -0,0 +1,15 @@
+package cn.modificator.waterwave_progress;
+
+import android.content.Context;
+
+public class WidgetUtil {
+	public static int Dp2Px(Context context, float dp) {
+		final float scale = context.getResources().getDisplayMetrics().density;
+		return (int) (dp * scale + 0.5f);
+	}
+
+	public static int Px2Dp(Context context, float px) {
+		final float scale = context.getResources().getDisplayMetrics().density;
+		return (int) (px / scale + 0.5f);
+	}
+}

+ 19 - 0
WaterWaveProgress/src/main/res/values/attrs.xml

@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<resources>
+
+    <declare-styleable name="WaterWaveProgress">
+        <attr name="progressWidth" format="dimension" />
+        <attr name="fontSize" format="dimension" />
+        <attr name="progressColor" format="color" />
+        <attr name="progressBgColor" format="color" />
+        <attr name="waterWaveColor" format="color" />
+        <attr name="waterWaveBgColor" format="color" />
+        <attr name="progress2WaterWidth" format="dimension" />
+        <attr name="showProgress" format="boolean" />
+        <attr name="showNumerical" format="boolean" />
+        <attr name="textColor" format="color" />
+        <attr name="progress" format="integer" />
+        <attr name="maxProgress" format="integer" />
+    </declare-styleable>
+
+</resources>

+ 3 - 0
WaterWaveProgress/src/main/res/values/strings.xml

@@ -0,0 +1,3 @@
+<resources>
+    <string name="app_name">WaterWaveProgress</string>
+</resources>

+ 17 - 0
WaterWaveProgress/src/test/java/com/bingfor/waterwaveprogress/ExampleUnitTest.java

@@ -0,0 +1,17 @@
+package com.bingfor.waterwaveprogress;
+
+import org.junit.Test;
+
+import static org.junit.Assert.*;
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
+ */
+public class ExampleUnitTest {
+    @Test
+    public void addition_isCorrect() throws Exception {
+        assertEquals(4, 2 + 2);
+    }
+}

+ 9 - 6
app/build.gradle

@@ -23,7 +23,7 @@ android {
         flavorDimensions "versionCode"
     }
     greendao {
-        schemaVersion 13
+        schemaVersion 14
         targetGenDir 'src/main/java'
     }
 //    compileOptions{
@@ -275,21 +275,24 @@ dependencies {
     implementation 'com.scwang.smartrefresh:SmartRefreshLayout:1.1.0-alpha-14'
 
     implementation 'org.greenrobot:greendao:3.2.2'
-
+    //okDownload
     // core
-    implementation "com.liulishuo.okdownload:okdownload:1.0.4"
+    implementation "com.liulishuo.okdownload:okdownload:1.0.5"
     // provide sqlite to store breakpoints
-    implementation "com.liulishuo.okdownload:sqlite:1.0.4"
+    implementation "com.liulishuo.okdownload:sqlite:1.0.5"
     // provide okhttp to connect to backend
-    implementation "com.liulishuo.okdownload:okhttp:1.0.4"
+    implementation "com.liulishuo.okdownload:okhttp:1.0.5"
 
     implementation 'com.trello.rxlifecycle2:rxlifecycle-components:2.2.2'
 
     implementation 'com.squareup.retrofit2:adapter-rxjava2:2.4.0'
 
     implementation 'com.github.CymChad:BaseRecyclerViewAdapterHelper:2.9.30'
-
+    //有米科技
     implementation(name: 'YoumiSdk_v8.3.0_2018-09-20', ext: 'aar')
+    implementation project(':WaterWaveProgress')
+    //AndroidVideoCache 网络视频缓存 https://github.com/danikula/AndroidVideoCache
+    implementation 'com.danikula:videocache:2.7.1'
 }
 
 static def releaseTime() {

+ 1 - 0
app/proguard-rules.pro

@@ -152,6 +152,7 @@
 -keep class com.kfzs.duanduan.bean.** { *; }
 -keep class com.kfzs.duanduan.proto.** { *; }
 -keep class com.sheep.gamegroup.model.** { *; }
+-keep class com.sheep.jiuyan.samllsheep.bean.** { *; }
 -keep class com.sheep.gamegroup.greendao.** { *; }
 -keep class com.jcodecraeer.** { *; }
 -keep class com.sheep.jiuyan.samllsheep.service.DownloadService { *; }

+ 61 - 12
app/src/main/AndroidManifest.xml

@@ -173,6 +173,16 @@
             android:launchMode="singleTask"
             android:screenOrientation="portrait"
             android:theme="@style/FullScreenTheme"></activity>
+        <!--<activity-->
+        <!--android:name=".ui.activity.SignActivity"-->
+        <!--android:screenOrientation="portrait"-->
+        <!--android:theme="@style/SplashTheme">-->
+        <!--<intent-filter>-->
+        <!--<action android:name="android.intent.action.MAIN" />-->
+
+        <!--<category android:name="android.intent.category.LAUNCHER" />-->
+        <!--</intent-filter>-->
+        <!--</activity>-->
         <activity
             android:name="com.sheep.gamegroup.view.activity.SplashAct"
             android:screenOrientation="portrait"
@@ -376,7 +386,7 @@
             android:name="com.sheep.gamegroup.view.activity.ActCreditCardWeb"
             android:screenOrientation="portrait" />
         <activity
-            android:name="com.sheep.gamegroup.view.activity.ActXinwanWeb"
+            android:name="com.sheep.gamegroup.view.activity.ActXianWanWeb"
             android:screenOrientation="portrait" />
         <activity
             android:name="com.sheep.gamegroup.view.activity.TaskDetailCreditCardAct"
@@ -412,12 +422,26 @@
             android:name="com.sheep.gamegroup.view.activity.SignRechargeAct"
             android:screenOrientation="portrait" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActUserNoviceGuidance"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActXiaomiGame"
             android:screenOrientation="portrait" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActTestExpression"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.MiddleScreenShotAct"
             android:screenOrientation="user"
             android:theme="@style/MyDialogActivityTheme" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActPlayVideo"
+            android:configChanges="orientation|keyboardHidden|navigation|screenSize"
+            android:screenOrientation="user"
+            android:theme="@style/AppTheme.fullScreen" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActInputAndPickerImg"
+            android:theme="@style/AppTheme.translucent" />
 
         <!-- 友盟start -->
         <meta-data
@@ -615,13 +639,16 @@
         <activity
             android:name="com.sheep.gamegroup.view.activity.ActSheepPngList"
             android:screenOrientation="portrait" />
+        <!--<activity-->
+        <!--android:name="com.sheep.gamegroup.view.activity.ActFindGame"-->
+        <!--android:screenOrientation="portrait" />-->
         <activity
-            android:name="com.sheep.gamegroup.view.activity.ActFindGame"
-            android:screenOrientation="portrait" />
-        <activity
-            android:name="com.sheep.gamegroup.view.activity.ActFindInformation"
+            android:name="com.sheep.gamegroup.view.activity.ActArticle"
             android:configChanges="orientation|screenSize|keyboardHidden" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActArticleComment"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActReservation"
             android:screenOrientation="portrait" />
         <activity
@@ -631,6 +658,9 @@
             android:name="com.sheep.gamegroup.view.activity.ActGameAccount"
             android:screenOrientation="portrait" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActSearchAppOrTask"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActSearchGame"
             android:screenOrientation="portrait" />
         <activity
@@ -673,6 +703,18 @@
             android:name="com.sheep.gamegroup.view.activity.ActPlayGameRecommendList"
             android:screenOrientation="portrait" />
         <activity
+            android:name="com.sheep.gamegroup.view.activity.ActGcGameAppDetail"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActCommentGameApp"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActUserCommentDetail"
+            android:screenOrientation="portrait" />
+        <activity
+            android:name="com.sheep.gamegroup.view.activity.ActUserAppHome"
+            android:screenOrientation="portrait" />
+        <activity
             android:name="com.sheep.gamegroup.view.activity.ActPlayGameDetail"
             android:screenOrientation="portrait" />
         <activity
@@ -732,18 +774,25 @@
             android:name="com.youmi.android.offerdemo.YoumiOffersAdsDemo"
             android:screenOrientation="portrait" />
         <!-- end 有米科技 -->
-        <!-- 搜索界面 -->
-        <activity
-            android:name=".ui.activity.SearchActivity"
-            android:configChanges="orientation|keyboardHidden|screenSize"
-            android:screenOrientation="portrait"
-            android:theme="@style/AppTheme.NoTitleBar.AlphaStatusBar"
-            android:windowSoftInputMode="stateHidden" />
         <!-- 签到 -->
         <activity
             android:name=".ui.activity.SignActivity"
             android:screenOrientation="portrait"
             android:theme="@style/AppTheme.NoTitleBar.AlphaStatusBar" />
+        <!-- 用户引导 -->
+        <activity
+            android:name=".ui.activity.UserNavActivity"
+            android:configChanges="orientation|screenSize"
+            android:screenOrientation="portrait" />
+        <!-- 活动规则 -->
+        <activity
+            android:name=".ui.activity.ActiveRuleActivity"
+            android:screenOrientation="portrait" />
+        <!-- 全屏视频播放 -->
+        <activity
+            android:name=".ui.activity.PlayVideoActivity"
+            android:configChanges="orientation|screenSize"
+            android:screenOrientation="landscape" />
     </application>
 
 </manifest>

+ 162 - 16
app/src/main/java/com/kfzs/duanduan/utils/ApkUtils.java

@@ -11,8 +11,16 @@ import android.graphics.drawable.Drawable;
 import android.net.Uri;
 import android.text.TextUtils;
 import android.util.Base64;
-
+import android.view.View;
+
+import com.sheep.gamegroup.model.entity.ApkFileInfo;
+import com.sheep.gamegroup.model.entity.DialogConfig;
+import com.sheep.gamegroup.util.ActivityManager;
+import com.sheep.gamegroup.util.DataKey;
+import com.sheep.gamegroup.util.DataUtil;
+import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
 
 import java.security.MessageDigest;
@@ -22,6 +30,13 @@ import java.util.List;
 import java.util.Map;
 import java.util.UUID;
 
+import rx.Observable;
+import rx.Subscriber;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.functions.Func1;
+import rx.schedulers.Schedulers;
+
 /**
  * apk helper
  * <p>
@@ -47,6 +62,7 @@ public class ApkUtils {
         installedApkContainer = null;
 
     }
+
     private void setInstalledApkContainer() {
         installedApkContainer = getInstalledApks(SheepApp.getInstance());
 
@@ -77,22 +93,153 @@ public class ApkUtils {
      * @param context Context
      * @param apkPath apkPath
      */
-    public static final void installApk(Context context, String apkPath) {
-        if(TextUtils.isEmpty(apkPath)){
-//            G.showToast(R.string.unknown_error);
-            return;
+    public static final void installApk(final Context context, final String apkPath) {
+        final ApkFileInfo apkFileInfo = new ApkFileInfo();
+        apkFileInfo.setPath(apkPath);
+        Observable.just(apkFileInfo)
+                .filter(new Func1<ApkFileInfo, Boolean>() {
+                    @Override
+                    public Boolean call(ApkFileInfo item) {
+                        return !TextUtils.isEmpty(item.getPath());
+                    }
+                })
+                .filter(new Func1<ApkFileInfo, Boolean>() {
+                    @Override
+                    public Boolean call(ApkFileInfo item) {
+                        return item.existsPath();
+                    }
+                })
+                .filter(new Func1<ApkFileInfo, Boolean>() {
+                    @Override
+                    public Boolean call(ApkFileInfo item) {
+                        return !TextUtils.isEmpty(item.initPackageNameFromPath(context).getPackageName());
+                    }
+                })
+                .filter(new Func1<ApkFileInfo, Boolean>() {
+                    @Override
+                    public Boolean call(ApkFileInfo item) {
+                        //已经安装且签名的md5相同,文件与安装应用的md5也相同,则过滤掉
+                        return !(item.checkInstall(context) && item.checkApkAndFileSignMd5() && item.checkApkAndFileMd5());
+                    }
+                })
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new Subscriber<ApkFileInfo>() {
+                    private boolean doneNext;
+                    @Override
+                    public void onCompleted() {
+                        if(doneNext)
+                            return;
+                        if(apkFileInfo.isAppInstalled()){//在onNext中未处理且应用已经安装的情况下,直接打开应用
+                            PackageUtil.startApp(context, apkFileInfo.getPackageName());
+                            return;
+                        }
+                        G.showToast("无需安装");
+                    }
+
+                    @Override
+                    public void onError(Throwable e) {
+                        G.showToast(e.getMessage());
+                    }
+
+                    @Override
+                    public void onNext(final ApkFileInfo item) {
+                        doneNext = true;
+                        if (!item.isAppInstalled() || (item.isEqualsSignMd5() && item.isCanInstallVersion())) {
+                            PackageUtil.installApk(context, item.getPath());
+                            DataUtil.putAsString(DataKey.KEY_INSTALL_APK_PACKAGE_NAME, item.getPackageName());
+                        } else {//签名不同,则提示卸载
+                            ViewUtil.showMsgDialog(ActivityManager.getInstance().currentActivity(), new DialogConfig()
+                                    .setTitle("提示").setMsg("需要卸载当前应用才能继续安装,是否继续").setBtnLeftText("不用了")
+                                    .setBtnRightText("继续").setBtnRightOnClickListener(new View.OnClickListener() {
+                                        @Override
+                                        public void onClick(View view) {
+                                            //这里卸载后 没法继续,需要在接收卸载广播的地方进行安装操作
+                                            DataUtil.putAsString(DataKey.KEY_WILL_INSTALL_APK_PATH, item.getPath());
+                                            DataUtil.putAsString(DataKey.KEY_WILL_INSTALL_APK_PACKAGE_NAME, item.getPackageName());
+                                            uninstallApk(SheepApp.getInstance(), item.getPackageName());
+                                        }
+                                    }));
+                        }
+                    }
+                });
+    }
+
+    /**
+     * MD5加密
+     *
+     * @param byteStr 需要加密的内容
+     * @return 返回 byteStr的md5值
+     */
+    public static String encryptionMD5(byte[] byteStr) {
+        MessageDigest messageDigest;
+        StringBuilder md5Sb = new StringBuilder();
+        try {
+            messageDigest = MessageDigest.getInstance("MD5");
+            messageDigest.reset();
+            messageDigest.update(byteStr);
+            byte[] byteArray = messageDigest.digest();
+//            return Base64.encodeToString(byteArray,Base64.NO_WRAP);
+            for (int i = 0; i < byteArray.length; i++) {
+                if (Integer.toHexString(0xFF & byteArray[i]).length() == 1) {
+                    md5Sb.append("0").append(Integer.toHexString(0xFF & byteArray[i]));
+                } else {
+                    md5Sb.append(Integer.toHexString(0xFF & byteArray[i]));
+                }
+            }
+        } catch (NoSuchAlgorithmException e) {
+            e.printStackTrace();
         }
+        return md5Sb.toString();
+    }
 
-        PackageUtil.installApk(context, apkPath);
+    /**
+     * 获取app签名md5值
+     */
+    public static String getApkSignMd5StrByPackageName(String packageName, Action1<PackageInfo> action1) {
+        try {
+            PackageInfo packageInfo = SheepApp.getInstance().getPackageManager().getPackageInfo(
+                    packageName, PackageManager.GET_ACTIVITIES | PackageManager.GET_SIGNATURES);
+            Signature[] signs = packageInfo.signatures;
+            Signature sign = signs[0];
+            String signStr = encryptionMD5(sign.toByteArray());
+            if (action1 != null)
+                action1.call(packageInfo);
+            return signStr;
+        } catch (PackageManager.NameNotFoundException e) {
+            e.printStackTrace();
+        } catch (Exception e2) {
+            e2.printStackTrace();
+        }
+        return "";
+    }
 
-        /*
-          设置包名
-         */
-        SheepApp.getInstance()
-                .setPackgeName(
-                        getUnInstallApkPackageName(context, apkPath));
+    /**
+     * 获取未安装app签名md5值
+     */
+    public static String getApkSignMd5StrByPath(String apkPath, Action1<PackageInfo> action1) {
+        try {
+            PackageInfo packageInfo = SheepApp.getInstance().getPackageManager().getPackageArchiveInfo(
+                    apkPath, PackageManager.GET_ACTIVITIES | PackageManager.GET_SIGNATURES);
+            Signature[] signs = packageInfo.signatures;
+            Signature sign = signs[0];
+            String signStr = encryptionMD5(sign.toByteArray());
+            if (action1 != null)
+                action1.call(packageInfo);
+            return signStr;
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return "";
     }
 
+    /* 卸载apk */
+    public static void uninstallApk(Context context, String packageName) {
+        Uri uri = Uri.parse("package:" + packageName);
+        Intent intent = new Intent(Intent.ACTION_DELETE, uri);
+        intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
+        context.startActivity(intent);
+    }
 
     /**
      * get alll installed apks
@@ -116,8 +263,6 @@ public class ApkUtils {
     }
 
 
-
-
     /**
      * Open a application by packagename
      *
@@ -179,7 +324,7 @@ public class ApkUtils {
             setInstalledApkContainer();
         }
         PackageInfo pkg = installedApkContainer.get(packageName);
-        if(null == pkg){
+        if (null == pkg) {
             return EQUALS;
         }
         if (pkg.versionCode == versionCode) {
@@ -286,6 +431,7 @@ public class ApkUtils {
             return "0.0.0";
         }
     }
+
     public static PackageInfo getPackageInfo(String packageName) {
         try {
             PackageManager pm = SheepApp.getInstance().getPackageManager();
@@ -308,7 +454,7 @@ public class ApkUtils {
     }
 
 
-    public static void invokeBroswer(Context context ,String targetUrl){
+    public static void invokeBroswer(Context context, String targetUrl) {
         Uri uri = Uri.parse(targetUrl);
         Intent intent = new Intent(Intent.ACTION_VIEW);
         intent.setData(uri);

+ 0 - 79
app/src/main/java/com/kfzs/duanduan/view/ViewPagerAutoHeigh.java

@@ -1,79 +0,0 @@
-package com.kfzs.duanduan.view;
-
-import android.content.Context;
-import android.support.v4.view.ViewPager;
-import android.util.AttributeSet;
-import android.util.Log;
-import android.view.MotionEvent;
-import android.view.View;
-
-import java.util.HashMap;
-import java.util.LinkedHashMap;
-
-/**
- * @ Created by Dlg
- * @ <p>TiTle:  ViewPagerAutoHeigh</p>
- * @ <p>Description:</p>
- * @ date:  2017/6/19 16:45
- * @ QQ:    315096953
- */
-
-public class ViewPagerAutoHeigh extends ViewPager {
-
-    private int current;
-    private int[] mHeight = new int[10];
-    /**
-     * 保存position与对于的View
-     */
-    private HashMap<Integer, View> mChildrenViews = new LinkedHashMap<Integer, View>();
-    private HashMap<Integer, Integer> mChildrenHeight = new LinkedHashMap<Integer, Integer>();
-
-    private boolean scrollble = true;
-
-    public ViewPagerAutoHeigh(Context context) {
-        super(context);
-    }
-
-    public ViewPagerAutoHeigh(Context context, AttributeSet attrs) {
-        super(context, attrs);
-    }
-
-    @Override
-    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-
-        for (int i = 0; i < getChildCount(); i++) {
-            View child = getChildAt(i);
-            child.measure(widthMeasureSpec, MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
-            int h = child.getMeasuredHeight();
-            mHeight[i] = h < 300 ? 300:h;
-        }
-        heightMeasureSpec = MeasureSpec.makeMeasureSpec(mHeight[getCurrentItem()], MeasureSpec.EXACTLY);
-//        Log.e("-----------onMeasure", mChildrenHeight.get(current) + ",minHeight:" + mIntHeight);
-        super.onMeasure(widthMeasureSpec, heightMeasureSpec);
-    }
-
-    public void reSetHeight() {
-        invalidate();
-//        ViewGroup.LayoutParams layoutParams = getLayoutParams();
-//        layoutParams.height = mHeight[getCurrentItem()];
-//        setLayoutParams(layoutParams);
-    }
-
-    @Override
-    public boolean onTouchEvent(MotionEvent ev) {
-        if (!scrollble) {
-            return true;
-        }
-        return super.onTouchEvent(ev);
-    }
-
-
-    public boolean isScrollble() {
-        return scrollble;
-    }
-
-    public void setScrollble(boolean scrollble) {
-        this.scrollble = scrollble;
-    }
-}

+ 315 - 0
app/src/main/java/com/lqr/emoji/EmotionKeyboard.java

@@ -0,0 +1,315 @@
+package com.lqr.emoji;
+
+import android.annotation.TargetApi;
+import android.app.Activity;
+import android.content.Context;
+import android.content.SharedPreferences;
+import android.graphics.Rect;
+import android.os.Build;
+import android.util.DisplayMetrics;
+import android.util.Log;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.WindowManager;
+import android.view.inputmethod.InputMethodManager;
+import android.widget.EditText;
+import android.widget.LinearLayout;
+
+/**
+ * CSDN_LQR
+ * 表情键盘协调工具
+ */
+
+public class EmotionKeyboard {
+
+    private static final String SHARE_PREFERENCE_NAME = "EmotionKeyBoard";
+    private static final String SHARE_PREFERENCE_SOFT_INPUT_HEIGHT = "sofe_input_height";
+    private Activity mActivity;
+    private InputMethodManager mInputManager;//软键盘管理类
+    private SharedPreferences mSp;
+    private View mEmotionLayout;//表情布局
+    private EditText mEditText;
+    private View mContentView;//内容布局view,即除了表情布局或者软键盘布局以外的布局,用于固定bar的高度,防止跳闪
+
+    public EmotionKeyboard() {
+    }
+
+    public static EmotionKeyboard with(Activity activity) {
+        EmotionKeyboard emotionInputDetector = new EmotionKeyboard();
+        emotionInputDetector.mActivity = activity;
+        emotionInputDetector.mInputManager = (InputMethodManager) activity.getSystemService(Context.INPUT_METHOD_SERVICE);
+        emotionInputDetector.mSp = activity.getSharedPreferences(SHARE_PREFERENCE_NAME, Context.MODE_PRIVATE);
+        return emotionInputDetector;
+    }
+
+    /**
+     * 绑定内容view,此view用于固定bar的高度,防止跳闪
+     */
+    public EmotionKeyboard bindToContent(View contentView) {
+        mContentView = contentView;
+        return this;
+    }
+
+    /**
+     * 绑定编辑框
+     */
+    public EmotionKeyboard bindToEditText(EditText editText) {
+        mEditText = editText;
+        mEditText.requestFocus();
+        mEditText.setOnTouchListener(new View.OnTouchListener() {
+            @Override
+            public boolean onTouch(View v, MotionEvent event) {
+                if (event.getAction() == MotionEvent.ACTION_UP && mEmotionLayout.isShown()) {
+                    lockContentHeight();//显示软件盘时,锁定内容高度,防止跳闪。
+                    hideEmotionLayout(true);//隐藏表情布局,显示软件盘
+                    //软件盘显示后,释放内容高度
+                    mEditText.postDelayed(new Runnable() {
+                        @Override
+                        public void run() {
+                            unlockContentHeightDelayed();
+                        }
+                    }, 200L);
+                }
+                return false;
+            }
+        });
+        return this;
+    }
+
+    /**
+     * 绑定表情按钮(可以有多个表情按钮)
+     *
+     * @param emotionButton
+     * @return
+     */
+    public EmotionKeyboard bindToEmotionButton(View... emotionButton) {
+        for (View view : emotionButton) {
+            view.setOnClickListener(getOnEmotionButtonOnClickListener());
+        }
+        return this;
+    }
+
+    private View.OnClickListener getOnEmotionButtonOnClickListener() {
+        return new View.OnClickListener() {
+            @Override
+            public void onClick(View v) {
+                if (mOnEmotionButtonOnClickListener != null) {
+                    if (mOnEmotionButtonOnClickListener.onEmotionButtonOnClickListener(v)) {
+                        return;
+                    }
+                }
+
+                if (mEmotionLayout.isShown()) {
+                    lockContentHeight();//显示软件盘时,锁定内容高度,防止跳闪。
+                    hideEmotionLayout(true);//隐藏表情布局,显示软件盘
+                    unlockContentHeightDelayed();//软件盘显示后,释放内容高度
+                } else {
+                    if (isSoftInputShown()) {//同上
+                        lockContentHeight();
+                        showEmotionLayout();
+                        unlockContentHeightDelayed();
+                    } else {
+                        showEmotionLayout();//两者都没显示,直接显示表情布局
+                    }
+                }
+            }
+        };
+    }
+
+    /*================== 表情按钮点击事件回调 begin ==================*/
+    public interface OnEmotionButtonOnClickListener {
+        /**
+         * 主要是为了适用仿微信的情况,微信有一个表情按钮和一个功能按钮,这2个按钮都是控制了底部区域的显隐
+         *
+         * @param view
+         * @return true:拦截切换输入法,false:让输入法正常切换
+         */
+        boolean onEmotionButtonOnClickListener(View view);
+    }
+
+    OnEmotionButtonOnClickListener mOnEmotionButtonOnClickListener;
+
+    public void setOnEmotionButtonOnClickListener(OnEmotionButtonOnClickListener onEmotionButtonOnClickListener) {
+        mOnEmotionButtonOnClickListener = onEmotionButtonOnClickListener;
+    }
+    /*================== 表情按钮点击事件回调 end ==================*/
+
+    /**
+     * 设置表情内容布局
+     *
+     * @param emotionLayout
+     * @return
+     */
+    public EmotionKeyboard setEmotionLayout(View emotionLayout) {
+        mEmotionLayout = emotionLayout;
+        return this;
+    }
+
+    public EmotionKeyboard build() {
+        //设置软件盘的模式:SOFT_INPUT_ADJUST_RESIZE  这个属性表示Activity的主窗口总是会被调整大小,从而保证软键盘显示空间。
+        //从而方便我们计算软件盘的高度
+        mActivity.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN |
+                WindowManager.LayoutParams.SOFT_INPUT_ADJUST_RESIZE);
+        //隐藏软件盘
+        hideSoftInput();
+        return this;
+    }
+
+    /**
+     * 点击返回键时先隐藏表情布局
+     *
+     * @return
+     */
+    public boolean interceptBackPress(boolean showSoftInput) {
+        if (mEmotionLayout.isShown()) {
+            hideEmotionLayout(showSoftInput);
+            return true;
+        }
+        return false;
+    }
+
+    private void showEmotionLayout() {
+        int softInputHeight = getSupportSoftInputHeight();
+        if (softInputHeight == 0) {
+            softInputHeight = mSp.getInt(SHARE_PREFERENCE_SOFT_INPUT_HEIGHT, dip2Px(270));
+        }
+        hideSoftInput();
+        mEmotionLayout.getLayoutParams().height = softInputHeight;
+        mEmotionLayout.setVisibility(View.VISIBLE);
+    }
+
+    public int dip2Px(int dip) {
+        float density = mActivity.getApplicationContext().getResources().getDisplayMetrics().density;
+        int px = (int) (dip * density + 0.5f);
+        return px;
+    }
+
+    /**
+     * 隐藏表情布局
+     *
+     * @param showSoftInput 是否显示软件盘
+     */
+    private void hideEmotionLayout(boolean showSoftInput) {
+        if (mEmotionLayout.isShown()) {
+            mEmotionLayout.setVisibility(View.GONE);
+            if (showSoftInput) {
+                showSoftInput();
+            }
+        }
+    }
+
+    /**
+     * 锁定内容高度,防止跳闪
+     */
+    private void lockContentHeight() {
+        LinearLayout.LayoutParams params = (LinearLayout.LayoutParams) mContentView.getLayoutParams();
+        params.height = mContentView.getHeight();
+        params.weight = 0.0F;
+    }
+
+    /**
+     * 释放被锁定的内容高度
+     */
+    public void unlockContentHeightDelayed() {
+        mEditText.postDelayed(new Runnable() {
+            @Override
+            public void run() {
+                ((LinearLayout.LayoutParams) mContentView.getLayoutParams()).weight = 1.0F;
+            }
+        }, 200L);
+    }
+
+    /**
+     * 编辑框获取焦点,并显示软件盘
+     */
+    public void showSoftInput() {
+        mEditText.requestFocus();
+        mEditText.post(new Runnable() {
+            @Override
+            public void run() {
+                mInputManager.showSoftInput(mEditText, 0);
+            }
+        });
+    }
+
+    /**
+     * 隐藏软件盘
+     */
+    public void hideSoftInput() {
+        mInputManager.hideSoftInputFromWindow(mEditText.getWindowToken(), 0);
+    }
+
+    /**
+     * 是否显示软件盘
+     *
+     * @return
+     */
+    public boolean isSoftInputShown() {
+        return getSupportSoftInputHeight() != 0;
+    }
+
+    /**
+     * 获取软件盘的高度
+     *
+     * @return
+     */
+    private int getSupportSoftInputHeight() {
+        Rect r = new Rect();
+        /**
+         * decorView是window中的最顶层view,可以从window中通过getDecorView获取到decorView。
+         * 通过decorView获取到程序显示的区域,包括标题栏,但不包括状态栏。
+         */
+        mActivity.getWindow().getDecorView().getWindowVisibleDisplayFrame(r);
+        //获取屏幕的高度
+        int screenHeight = mActivity.getWindow().getDecorView().getRootView().getHeight();
+        //计算软件盘的高度
+        int softInputHeight = screenHeight - r.bottom;
+        /**
+         * 某些Android版本下,没有显示软键盘时减出来的高度总是144,而不是零,
+         * 这是因为高度是包括了虚拟按键栏的(例如华为系列),所以在API Level高于20时,
+         * 我们需要减去底部虚拟按键栏的高度(如果有的话)
+         */
+        if (Build.VERSION.SDK_INT >= 20) {
+            // When SDK Level >= 20 (Android L), the softInputHeight will contain the height of softButtonsBar (if has)
+            softInputHeight = softInputHeight - getSoftButtonsBarHeight();
+        }
+        if (softInputHeight < 0) {
+            Log.w("LQR", "EmotionKeyboard--Warning: value of softInputHeight is below zero!");
+        }
+        //存一份到本地
+        if (softInputHeight > 0) {
+            mSp.edit().putInt(SHARE_PREFERENCE_SOFT_INPUT_HEIGHT, softInputHeight).apply();
+        }
+        return softInputHeight;
+    }
+
+    /**
+     * 底部虚拟按键栏的高度
+     *
+     * @return
+     */
+    @TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR1)
+    private int getSoftButtonsBarHeight() {
+        DisplayMetrics metrics = new DisplayMetrics();
+        //这个方法获取可能不是真实屏幕的高度
+        mActivity.getWindowManager().getDefaultDisplay().getMetrics(metrics);
+        int usableHeight = metrics.heightPixels;
+        //获取当前屏幕的真实高度
+        mActivity.getWindowManager().getDefaultDisplay().getRealMetrics(metrics);
+        int realHeight = metrics.heightPixels;
+        if (realHeight > usableHeight) {
+            return realHeight - usableHeight;
+        } else {
+            return 0;
+        }
+    }
+
+    /**
+     * 获取软键盘高度
+     *
+     * @return
+     */
+    public int getKeyBoardHeight() {
+        return mSp.getInt(SHARE_PREFERENCE_SOFT_INPUT_HEIGHT, 400);
+    }
+}

+ 205 - 0
app/src/main/java/com/lqr/emoji/EmotionLayout.java

@@ -0,0 +1,205 @@
+package com.lqr.emoji;
+
+import android.content.Context;
+import android.support.annotation.Nullable;
+import android.support.v4.view.ViewPager;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.EditText;
+import android.widget.GridView;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+
+import com.sheep.gamegroup.view.adapter.ArrayAdapter;
+import com.sheep.jiuyan.samllsheep.BuildConfig;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Locale;
+import java.util.Map;
+
+/**
+ * CSDN_LQR
+ * 表情布局
+ */
+public class EmotionLayout extends LinearLayout implements View.OnClickListener {
+
+    public static int EMOJI_COLUMNS = 3;
+    public static int EMOJI_ROWS = 3;
+    public static int EMOJI_PER_PAGE = EMOJI_COLUMNS * EMOJI_ROWS;
+
+    private Context mContext;
+    private ViewPager mVpEmotioin;
+    private LinearLayout mLlPageNumber;
+
+    private IEmotionSelectedListener mEmotionSelectedListener;
+
+    public EmotionLayout(Context context) {
+        this(context, null);
+    }
+
+    public EmotionLayout(Context context, @Nullable AttributeSet attrs) {
+        this(context, attrs, 0);
+    }
+
+    public EmotionLayout(Context context, @Nullable AttributeSet attrs, int defStyleAttr) {
+        super(context, attrs, defStyleAttr);
+        mContext = context;
+    }
+
+    public void setEmotionSelectedListener(IEmotionSelectedListener emotionSelectedListener) {
+        if (emotionSelectedListener != null) {
+            this.mEmotionSelectedListener = emotionSelectedListener;
+        } else {
+            Log.i("CSDN_LQR", "IEmotionSelectedListener is null");
+        }
+    }
+
+    @Override
+    protected void onSizeChanged(int w, int h, int oldw, int oldh) {
+        super.onSizeChanged(w, h, oldw, oldh);
+        init();
+        initListener();
+    }
+
+    private void init() {
+        LayoutInflater.from(mContext).inflate(R.layout.emotion_layout, this);
+        mVpEmotioin = findViewById(R.id.vpEmotioin);
+        mLlPageNumber = findViewById(R.id.llPageNumber);
+
+        initViews();
+        mVpEmotioin.setAdapter(new ListPagerAdapter(viewList));
+
+    }
+
+    private List<View> viewList;
+    private List<View> dianViewList;
+
+    private void initViews() {
+        int totalCount = PNG_NAMES.length;
+        int pageTotal = (totalCount - 1) / EMOJI_PER_PAGE + 1;
+        int perPageCount = EMOJI_PER_PAGE;
+        viewList = new ArrayList<>(pageTotal);
+        dianViewList = new ArrayList<>(pageTotal);
+        for (int i = 0; i < pageTotal; i++) {
+            //组装图片数据
+            List<String> pngList = new ArrayList<>(perPageCount);
+            for (int j = 0; j < perPageCount; j++) {
+                int index = i * ( perPageCount - 1) + j;
+                if (index + 1 >= totalCount) {
+                    break;
+                }
+                pngList.add(PNG_NAMES[index]);
+            }
+            //添加每页GridView
+            View itemView = LayoutInflater.from(SheepApp.getInstance()).inflate(R.layout.emotion_item_page, null);
+            GridView gridView = itemView.findViewById(R.id.emotion_item_page_gv);
+            gridView.setNumColumns(EMOJI_COLUMNS);
+            gridView.setAdapter(new ArrayAdapter<String>(mContext, R.layout.emotion_item, pngList) {
+                @Override
+                public boolean convert(int position, View convertView, ViewGroup parent, String item) {
+                    ImageView imageView = convertView.findViewById(R.id.emotion_item_iv);
+                    if (imageView != null) {
+                        imageView.setTag(item);
+                        imageView.setImageResource(mContext.getResources().getIdentifier(item, "mipmap", BuildConfig.APPLICATION_ID));
+                        imageView.setOnClickListener(EmotionLayout.this);
+                    }
+                    return true;
+                }
+            });
+            viewList.add(itemView);
+
+            //tabs
+            View dianView = View.inflate(mContext, R.layout.emotion_dian, null);
+            int radius = getResources().getDimensionPixelSize(R.dimen.content_padding_10);
+            LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(radius, radius);
+            if (i != 0)
+                layoutParams.leftMargin = radius;
+            mLlPageNumber.addView(dianView, layoutParams);
+            dianViewList.add(dianView);
+            dianViewList.get(i).setEnabled(i == 0);
+        }
+    }
+
+    private void initListener() {
+
+        mVpEmotioin.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
+            @Override
+            public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
+            }
+
+            @Override
+            public void onPageSelected(int position) {
+                for (int i = 0; i < dianViewList.size(); i++) {
+                    dianViewList.get(i).setEnabled(i == position);
+                }
+            }
+
+            @Override
+            public void onPageScrollStateChanged(int state) {
+
+            }
+        });
+
+    }
+
+    @Override
+    public void onClick(View v) {
+        Object tag = v.getTag();
+        if (tag instanceof String) {
+            selectEmotionItem(tag.toString());
+        }
+    }
+
+    private void selectEmotionItem(String name) {
+        if (mMessageEditText != null) {
+            mMessageEditText.append(String.format(Locale.CHINA, "[%s]", nameToTagMap.get(name)));
+        }
+    }
+
+
+    EditText mMessageEditText;
+
+    public void attachEditText(EditText messageEditText) {
+        mMessageEditText = messageEditText;
+    }
+
+
+
+    public static final String[] PNG_NAMES = {"exp_666", "exp_ccc", "exp_ggl", "exp_hjz", "exp_kbjbg", "exp_lll", "exp_sxyj", "exp_wxll", "exp_xq", "exp_yd", "exp_yx"};
+    public static final String[] PNG_TAGS = {"666", "戳", "尴尬了", "好紧张", "苦逼加班狗", "略略略~", "伤心欲绝", "我心凉凉", "嫌弃", "悠闲", "有毒"};
+    public static final Map<String, String> nameToTagMap = new HashMap<>();
+    public static final Map<String, String> tagToNameMap = new HashMap<>();
+    static {
+        for (int i = 0; i < PNG_NAMES.length; i++) {
+            nameToTagMap.put(PNG_NAMES[i], PNG_TAGS[i]);
+            tagToNameMap.put(PNG_TAGS[i], PNG_NAMES[i]);
+        }
+    }
+    //转换内容
+    public static String changeContent(String content) {
+        for (String pngTag : PNG_TAGS) {
+            String replaceContent = String.format(Locale.CHINA, "<img src=\"%s\" />", tagToNameMap.get(pngTag));
+            content = content.replaceAll(String.format(Locale.CHINA, "\\[%s\\]", pngTag), replaceContent);
+        }
+        content = content.replaceAll("\n", "<br>");//替换换行
+        return content;
+    }
+    //转换内容
+    public static boolean hasExp(String content) {
+        if(content != null && content.contains("[")) {
+            for (String pngTag : PNG_TAGS) {
+                if (content.contains(String.format(Locale.CHINA, "[%s]", pngTag))) {
+                    return true;
+                }
+            }
+        }
+        return false;
+    }
+}

+ 7 - 0
app/src/main/java/com/lqr/emoji/IEmotionSelectedListener.java

@@ -0,0 +1,7 @@
+package com.lqr.emoji;
+
+public interface IEmotionSelectedListener {
+    void onEmojiSelected(String key);
+
+    void onStickerSelected(String categoryName, String stickerName, String stickerBitmapPath);
+}

+ 46 - 0
app/src/main/java/com/lqr/emoji/ListPagerAdapter.java

@@ -0,0 +1,46 @@
+package com.lqr.emoji;
+
+import android.support.annotation.NonNull;
+import android.support.v4.view.PagerAdapter;
+import android.view.View;
+import android.view.ViewGroup;
+
+import java.util.List;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ */
+public class ListPagerAdapter extends PagerAdapter {
+    private List<View> views;
+
+    public ListPagerAdapter(List<View> views) {
+        this.views = views;
+    }
+
+    @Override
+    public int getCount() {
+        return views.size();
+    }
+
+    @NonNull
+    @Override
+    public boolean isViewFromObject(@NonNull View view, @NonNull Object object) {
+        return view == object;
+    }
+
+    @NonNull
+    @Override
+    public Object instantiateItem(@NonNull ViewGroup container, int position) {
+        View view = views.get(position);
+        container.addView(view);
+        return view;
+    }
+
+    @NonNull
+    @Override
+    public void destroyItem(@NonNull ViewGroup container, int position, @NonNull Object object) {
+        container.removeView(views.get(position));
+    }
+
+}

+ 8 - 3
app/src/main/java/com/sheep/gamegroup/absBase/AbsChooseImageActivity.java

@@ -30,7 +30,7 @@ import me.iwf.photopicker.PhotoPicker;
 public abstract class AbsChooseImageActivity extends BaseActivity implements UpFileListener {
     private boolean isUpload = true;
     private boolean isCrop = true;
-    private int photoCount = 1;
+    protected int photoCount = 1;
 
     protected ArrayList<String> photos;
     protected String path;
@@ -185,14 +185,19 @@ public abstract class AbsChooseImageActivity extends BaseActivity implements UpF
             path = sb.toString();
             onGetImage(path);
             if (isUpload) {
-                AbsChooseImageActivity.this.dialogShowLoading = DialogProgress.showDialog(AbsChooseImageActivity.this);
-                UpFileUtils.upImages(photos, AbsChooseImageActivity.this, getCallBack());
+                upImages();
             }
         } else {
             onNotGetImage("没有数据");
         }
     }
 
+    //上传图片列表
+    protected void upImages() {
+        AbsChooseImageActivity.this.dialogShowLoading = DialogProgress.showDialog(AbsChooseImageActivity.this);
+        UpFileUtils.upImages(photos, AbsChooseImageActivity.this, getCallBack());
+    }
+
     /**
      * 上传图片前的回调
      * @return

+ 119 - 0
app/src/main/java/com/sheep/gamegroup/absBase/AbsDownloadListener.java

@@ -0,0 +1,119 @@
+package com.sheep.gamegroup.absBase;
+
+import android.content.Intent;
+
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+
+
+import static android.content.Intent.ACTION_PACKAGE_ADDED;
+import static android.content.Intent.ACTION_PACKAGE_REMOVED;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 下载和应用安装的回调,使用时请在Activity的onCreate中注册并在onDestroy中取消注册
+ * 并在onEventMainThread(Intent intent)和onEventMainThread(BigEvent event)中添加org.greenrobot.eventbus.Subscribe注解
+ * 如:
+ EventBus.getDefault().register(this);
+ private AbsDownloadListener absDownloadListener = new AbsDownloadListener() {
+@Override public void removedApk(String packageName) {
+
+}
+
+@Override public void addedApk(String packageName) {
+
+}
+
+@Override public void running(DownLoadInfo task) {
+
+}
+
+@Override public void taskStop(DownLoadInfo task) {
+
+}
+
+@Override public void taskComplete(DownLoadInfo task) {
+
+}
+
+@Override public void taskCancel(DownLoadInfo task) {
+
+}
+
+@Override public void taskFail(DownLoadInfo task) {
+
+}
+};
+ @Subscribe public void onEventMainThread(Intent intent) {
+ absDownloadListener.onEventMainThread(intent);
+ }
+ @Subscribe public void onEventMainThread(BigEvent event) {
+ absDownloadListener.onEventMainThread(event);
+ }
+ @Override protected void onDestroy() {
+ super.onDestroy();
+ EventBus.getDefault().unregister(this);
+ }
+
+ */
+public abstract class AbsDownloadListener {
+
+    public void onEventMainThread(Intent intent) {
+        if (intent != null && intent.getAction() != null && intent.getDataString() != null && intent.getDataString().contains("package:")) {
+            String packageName = intent.getDataString().replace("package:", "");
+            switch (intent.getAction()) {
+                case ACTION_PACKAGE_ADDED:
+                    addedApk(packageName);
+                    break;
+                case ACTION_PACKAGE_REMOVED:
+                    removedApk(packageName);
+                    break;
+            }
+        }
+    }
+
+    //卸载应用的回调
+    public abstract void removedApk(String packageName);
+
+    //安装应用的回调
+    public abstract void addedApk(String packageName);
+
+    public void onEventMainThread(BigEvent event) {
+        if (event.getData() instanceof DownLoadInfo) {
+            DownLoadInfo task = (DownLoadInfo) event.getData();
+            switch (event.getEventTypes()) {
+                case DOWNLOAD_RUNNING:
+                    running(task);
+                    break;
+                case DOWNLOAD_STOP:
+                    taskStop(task);
+                    break;
+                case DOWNLOAD_COMPLETE:
+                    taskComplete(task);
+                    break;
+                case DOWNLOAD_CANCEL:
+                    taskCancel(task);
+                    break;
+                case DOWNLOAD_FAIL:
+                    taskFail(task);
+                    break;
+            }
+        }
+    }
+
+    //下载中的的回调
+    public abstract void running(DownLoadInfo task);
+
+    //下载暂停的回调
+    public abstract void taskStop(DownLoadInfo task);
+
+    //下载完成的回调
+    public abstract void taskComplete(DownLoadInfo task);
+
+    //取消下载的回调
+    public abstract void taskCancel(DownLoadInfo task);
+
+    //下载失败的回调
+    public abstract void taskFail(DownLoadInfo task);
+}

+ 154 - 0
app/src/main/java/com/sheep/gamegroup/absBase/AbsGetDownloadListener.java

@@ -0,0 +1,154 @@
+package com.sheep.gamegroup.absBase;
+
+import android.content.Intent;
+import android.text.TextUtils;
+import android.widget.TextView;
+
+import com.sheep.gamegroup.event.BigEvent;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.gamegroup.helper.DownloadHelper;
+import com.sheep.gamegroup.util.DownloadTextUtl;
+import com.sheep.gamegroup.util.DownloadUtil;
+import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
+
+import rx.functions.Action1;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ */
+public abstract class AbsGetDownloadListener {
+    private boolean showSimpleText;
+
+    public AbsGetDownloadListener(boolean showSimpleText) {
+        this.showSimpleText = showSimpleText;
+    }
+
+    private AbsDownloadListener absDownloadListener = new AbsDownloadListener() {
+        @Override
+        public void removedApk(final String packageName) {
+            checkPackageName(packageName, new ICallBack2<TextView, String>() {
+                @Override
+                public void call(TextView textView, String downloadUrl) {
+                    String path = PackageUtil.isExistsFile(packageName, downloadUrl);
+                    if (TextUtils.isEmpty(path)) {
+                        textView.setText(DownloadTextUtl.getStartDownloadText(showSimpleText));
+                    } else {
+                        textView.setText(DownloadTextUtl.getStartInstallText(showSimpleText));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void addedApk(String packageName) {
+            checkPackageName(packageName, new ICallBack2<TextView, String>() {
+                @Override
+                public void call(TextView textView, String downloadUrl) {
+                    textView.setText(DownloadTextUtl.getStartOpenText(showSimpleText));
+                }
+            });
+        }
+
+        @Override
+        public void running(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getProgressText(showSimpleText, task));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskStop(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getContinueDownloadText(showSimpleText));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskComplete(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getStartInstallText(showSimpleText));
+                        DownloadHelper downloadHelper = getDownloadHelper(task.getMDownloadUrl());
+                        if (downloadHelper != null)
+                            downloadHelper.updateState(DownloadUtil.STATUS_FINISH);
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskCancel(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getTaskCancelText(showSimpleText));
+                    }
+                }
+            });
+        }
+
+        @Override
+        public void taskFail(final DownLoadInfo task) {
+            checkUrl(task.getMDownloadUrl(), new Action1<TextView>() {
+                @Override
+                public void call(TextView textView) {
+                    if (textView != null) {
+                        textView.setText(DownloadTextUtl.getFailDownloadText(showSimpleText));
+                    }
+                }
+            });
+        }
+    };
+
+
+    private void checkUrl(String downloadUrl, Action1<TextView> action1) {
+        try {
+            action1.call(getTextView(downloadUrl));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    private void checkPackageName(String packageName, ICallBack2<TextView, String> action1) {
+        try {
+            action1.call(getTextView2(packageName), getDownloadUrl(packageName));
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+    }
+
+    //根据包名获取下载地址
+    public abstract String getDownloadUrl(String packageName);
+
+    //根据包名获取TextView
+    public abstract TextView getTextView2(String packageName);
+
+    //根据下载地址获取TextView
+    public abstract TextView getTextView(String downloadUrl);
+
+    //根据下载地址获取DownloadHelper
+    public abstract DownloadHelper getDownloadHelper(String downloadUrl);
+
+
+    public void onEventMainThread(Intent intent) {
+        absDownloadListener.onEventMainThread(intent);
+    }
+
+    public void onEventMainThread(BigEvent bigEvent) {
+        absDownloadListener.onEventMainThread(bigEvent);
+    }
+}

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/absBase/BaseActivity.java

@@ -2,10 +2,10 @@ package com.sheep.gamegroup.absBase;
 
 import android.os.Bundle;
 import android.support.annotation.Nullable;
-import android.support.v7.app.AppCompatActivity;
 
 import com.sheep.gamegroup.util.ActionUtil;
 import com.sheep.gamegroup.view.dialog.DialogLoading;
+import com.trello.rxlifecycle2.components.support.RxAppCompatActivity;
 
 import java.util.concurrent.TimeUnit;
 
@@ -20,7 +20,7 @@ import rx.schedulers.Schedulers;
  * Created by kemllor on 2017/12/15.
  */
 
-public abstract class BaseActivity extends AppCompatActivity {
+public abstract class BaseActivity extends RxAppCompatActivity {
 
     protected DialogLoading dialogLoading;
     public Unbinder unbinder;

+ 38 - 0
app/src/main/java/com/sheep/gamegroup/absBase/BaseContainerActivity.java

@@ -0,0 +1,38 @@
+package com.sheep.gamegroup.absBase;
+
+import android.support.v4.app.Fragment;
+import android.support.v4.app.FragmentTransaction;
+
+import com.sheep.jiuyan.samllsheep.R;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ */
+public abstract class BaseContainerActivity extends BaseActivity {
+
+    @Override
+    protected int getLayoutId() {
+        return R.layout.common_container;
+    }
+
+    protected Fragment fragment;
+
+    @Override
+    public void initView() {
+
+        FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
+        fragment = getSupportFragmentManager().findFragmentByTag("tag");
+        if (fragment == null) {
+            fragment = initFragment();
+            transaction.add(R.id.frame_container, fragment, "tag");
+            transaction.commitAllowingStateLoss();
+        } else {
+            transaction.replace(R.id.frame_container, fragment);
+            transaction.commitAllowingStateLoss();
+        }
+
+    }
+
+    protected abstract Fragment initFragment();
+}

+ 19 - 6
app/src/main/java/com/sheep/gamegroup/view/activity/BaseListActivity2.java

@@ -1,15 +1,15 @@
-package com.sheep.gamegroup.view.activity;
+package com.sheep.gamegroup.absBase;
 
 import android.support.v7.widget.LinearLayoutManager;
 import android.support.v7.widget.RecyclerView;
 import android.view.View;
 
 import com.jcodecraeer.xrecyclerview.XRecyclerView;
-import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.model.api.ApiService;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.Conversion;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.SysAppUtil;
@@ -30,7 +30,7 @@ import rx.schedulers.Schedulers;
  * realicing@sina.com
  * 自己可以进行刷新与加载更多,使用com.jcodecraeer.xrecyclerview.XRecyclerView来实现,子类提供网络接口相关
  */
-public abstract class BaseListActivity2<T> extends BaseActivity {
+public abstract class BaseListActivity2<T> extends BaseActivity implements IRefresh, ILoadMore {
     @Override
     public int getLayoutId() {
         return R.layout.net_empty_xrecycler;
@@ -89,7 +89,7 @@ public abstract class BaseListActivity2<T> extends BaseActivity {
         view_list.setAdapter(getAdapter());
     }
 
-    protected void loadMoreData() {
+    public void loadMoreData() {
         if (!loadMore) {
             loadMore = true;
             if (ListUtil.size(list) >= per_page * page) {
@@ -116,11 +116,18 @@ public abstract class BaseListActivity2<T> extends BaseActivity {
         return true;
     }
 
+    //将baseMessage转化为list<T>
+    private Conversion<BaseMessage, List<T>> conversion = new Conversion<BaseMessage, List<T>>() {
+        @Override
+        public List<T> convert(BaseMessage baseMessage, int position) {
+            return resolveData(baseMessage, position);
+        }
+    };
     public void mInitData() {
         final String urlKey = getKey(page, per_page);
         if (isFirstGetACache()) {
             //先尝试获取缓存数据
-            lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass());
+            lastCacheList = DataUtil.getInstance().getCacheList(urlKey, getTClass(), conversion, page);
             loadList(lastCacheList);
         }
         SysAppUtil.checkNet(new Action1<Integer>() {
@@ -146,7 +153,8 @@ public abstract class BaseListActivity2<T> extends BaseActivity {
                         if (isNewData || !isFirstGetACache()) {
                             if (isFirstGetACache())
                                 ListUtil.removeAll(list, lastCacheList);
-                            List<T> newList = baseMessage.getDatas(getTClass());
+
+                            List<T> newList = conversion.convert(baseMessage, page);
                             loadList(newList);
                         } else {
                             notifyDataSetChanged();
@@ -160,6 +168,11 @@ public abstract class BaseListActivity2<T> extends BaseActivity {
                 });
     }
 
+    //解析数据
+    protected List<T> resolveData(BaseMessage baseMessage, int page) {
+        return baseMessage.getDatas(getTClass());
+    }
+
     public Action1<String> getNoMoreCallBack() {
         return null;
     }

+ 56 - 0
app/src/main/java/com/sheep/gamegroup/absBase/BaseRefreshLoadMoreFragment.java

@@ -0,0 +1,56 @@
+package com.sheep.gamegroup.absBase;
+
+import com.scwang.smartrefresh.layout.SmartRefreshLayout;
+import com.sheep.jiuyan.samllsheep.base.BaseFragment;
+
+/**
+ * Created by realicing on 2018/11/5.
+ * realicing@sina.com
+ */
+public abstract class BaseRefreshLoadMoreFragment extends BaseFragment implements IRefresh, ILoadMore{
+
+    protected SmartRefreshLayout smartRefreshLayout;
+
+    public SmartRefreshLayout getSmartRefreshLayout() {
+        return smartRefreshLayout;
+    }
+
+    public void setSmartRefreshLayout(SmartRefreshLayout smartRefreshLayout) {
+        this.smartRefreshLayout = smartRefreshLayout;
+    }
+
+    protected boolean noMore = false;
+
+    public boolean isNoMore() {
+        return noMore;
+    }
+    //设置是否还有更多数据
+    public void setNoMore(boolean noMore) {
+        this.noMore = noMore;
+        setSmartRefreshLayoutNoMore(noMore);
+    }
+    //加载完成时更新header或footer
+    protected void refreshOrLoadMoreComplete() {
+        if (smartRefreshLayout != null && getUserVisibleHint()) {
+            smartRefreshLayout.finishRefresh();
+            smartRefreshLayout.finishLoadMore();
+        }
+    }
+    //设置是否还有更多数据
+    protected void setSmartRefreshLayoutNoMore(boolean noMore) {
+        if (smartRefreshLayout != null && getUserVisibleHint()) {
+            smartRefreshLayout.setNoMoreData(noMore);
+        }
+    }
+    @Override
+    public void setUserVisibleHint(boolean isVisibleToUser) {
+        super.setUserVisibleHint(isVisibleToUser);
+        setSmartRefreshLayoutNoMore(noMore);
+    }
+
+    @Override
+    public void onDestroy() {
+        super.onDestroy();
+        smartRefreshLayout = null;
+    }
+}

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ICallBack2.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * 两个参数的回调
+ */
+public interface ICallBack2<P1, P2> {
+    void call(P1 p1, P2 p2);
+}

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/absBase/IContentContainer.java

@@ -0,0 +1,9 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/9.
+ * realicing@sina.com
+ */
+public interface IContentContainer<T> {
+    T getContent();
+}

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/IContentTypeContainer.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/9.
+ * realicing@sina.com
+ */
+public interface IContentTypeContainer<T,C> {
+    T getContentType();
+    C getContentResult();
+}

+ 27 - 0
app/src/main/java/com/sheep/gamegroup/absBase/IHomePageSearch.java

@@ -0,0 +1,27 @@
+package com.sheep.gamegroup.absBase;
+
+import android.support.annotation.IntDef;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ * 搜索结果类型
+ */
+public interface IHomePageSearch {
+    //    link_type:	integer ($int64)
+// * 关联类型 1任务(release_task)2游戏(applications)
+    public static final int LINK_TYPE_RELEASE_TASK = 1;
+    public static final int LINK_TYPE_APPLICATIONS = 2;
+
+    @IntDef({LINK_TYPE_RELEASE_TASK, LINK_TYPE_APPLICATIONS})
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface LINK_TYPE {
+
+    }
+    int getLink_id();
+
+    int getLink_type();
+}

+ 14 - 0
app/src/main/java/com/sheep/gamegroup/absBase/IJump.java

@@ -0,0 +1,14 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ */
+public interface IJump {
+
+    String getJump();
+
+    String getUrl();
+
+    String getTitle();
+}

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ILoadMore.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 上拉加载更多的接口
+ */
+public interface ILoadMore {
+    void loadMoreData();
+}

+ 10 - 0
app/src/main/java/com/sheep/gamegroup/absBase/IRefresh.java

@@ -0,0 +1,10 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/10/31.
+ * realicing@sina.com
+ * 下拉刷新数据的接口
+ */
+public interface IRefresh {
+    void refreshData();
+}

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ISearch.java

@@ -0,0 +1,9 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ */
+public interface ISearch {
+    void toSearch(String name);
+}

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ISearchRecord.java

@@ -0,0 +1,9 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ */
+public interface ISearchRecord {
+    String getInput();
+}

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/absBase/ITag.java

@@ -0,0 +1,9 @@
+package com.sheep.gamegroup.absBase;
+
+/**
+ * Created by realicing on 2018/11/9.
+ * realicing@sina.com
+ */
+public interface ITag {
+    int getTag();
+}

+ 82 - 2
app/src/main/java/com/sheep/gamegroup/greendao/DDProviderHelper.java

@@ -14,6 +14,8 @@ import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
 import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.SearchRecord;
+import com.sheep.gamegroup.greendao.download.SearchRecordDao;
 import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.jiuyan.samllsheep.service.AutoCheckService;
@@ -523,8 +525,8 @@ public class DDProviderHelper {
     }
 
     /**
-     * 添加或更新记录
-     * 添加成功返回true
+     * 删除sdkLoginUser记录
+     * 删除成功返回true
      *
      * @param context
      * @param oldInfo
@@ -552,4 +554,82 @@ public class DDProviderHelper {
         }
         return false;
     }
+    /**
+     * 添加或更新搜索记录
+     * 添加成功返回true
+     *
+     * @param context
+     * @param newInfo
+     */
+    public boolean addOrUpdateSearchRecord(Context context, SearchRecord newInfo, Action1<SearchRecord> action1) {
+        SearchRecordDao infoDao = getDaossion(context).getSearchRecordDao();
+        SearchRecord lastInfo = infoDao
+                .queryBuilder()
+                .where(SearchRecordDao.Properties.Input.eq(newInfo.getInput()))
+                .build()
+                .unique();
+        try {
+            if (action1 != null)
+                action1.call(lastInfo);
+            if (lastInfo == null) {
+                newInfo.setFirst_time(newInfo.getLast_time());
+                infoDao.insert(newInfo);
+                return true;
+            } else {
+                newInfo.setId(lastInfo.getId());
+                newInfo.setFirst_time(lastInfo.getLast_time());
+                newInfo.setCount(lastInfo.getCount() + newInfo.getCount());
+                infoDao.update(newInfo);
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return false;
+    }
+    /**
+     * 获取搜索历史(根据搜索次数来排序)
+     *
+     * @param ctx
+     */
+    public List<SearchRecord> getSearchRecordList(Context ctx, int limit) {
+        return getDaossion(ctx)
+                .getSearchRecordDao()
+                .queryBuilder()
+                .limit(limit)
+                .orderDesc(SearchRecordDao.Properties.Count)
+                .build()
+                .list();
+    }
+
+    /**
+     * 删除搜索记录
+     * 删除成功返回true
+     *
+     * @param context
+     * @param oldInfo
+     */
+    public boolean deleteSearchRecord(Context context, SearchRecord oldInfo) {
+        if (oldInfo != null) {
+            SearchRecordDao loadInfoDao = getDaossion(context).getSearchRecordDao();
+            try {
+                loadInfoDao.delete(oldInfo);
+                return true;
+            } catch (Exception e) {
+                e.printStackTrace();
+                try {
+                    SearchRecord loadInfo = loadInfoDao.queryBuilder()
+                            .where(SearchRecordDao.Properties.Input.eq(oldInfo.getInput()))
+                            .build()
+                            .unique();
+                    if(loadInfo != null)
+                        loadInfoDao.delete(loadInfo);
+                    return true;
+                } catch (Exception e2) {
+                    e2.printStackTrace();
+                }
+                return false;
+            }
+        }
+        return false;
+    }
 }

+ 5 - 2
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoMaster.java

@@ -14,10 +14,10 @@ import org.greenrobot.greendao.identityscope.IdentityScopeType;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 /**
- * Master of DAO (schema version 13): knows all DAOs.
+ * Master of DAO (schema version 14): knows all DAOs.
  */
 public class DaoMaster extends AbstractDaoMaster {
-    public static final int SCHEMA_VERSION = 13;
+    public static final int SCHEMA_VERSION = 14;
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
@@ -27,6 +27,7 @@ public class DaoMaster extends AbstractDaoMaster {
         ProcessRecordDao.createTable(db, ifNotExists);
         ScreenShotRecordDao.createTable(db, ifNotExists);
         SdkLoginUserDao.createTable(db, ifNotExists);
+        SearchRecordDao.createTable(db, ifNotExists);
     }
 
     /** Drops underlying database table using DAOs. */
@@ -37,6 +38,7 @@ public class DaoMaster extends AbstractDaoMaster {
         ProcessRecordDao.dropTable(db, ifExists);
         ScreenShotRecordDao.dropTable(db, ifExists);
         SdkLoginUserDao.dropTable(db, ifExists);
+        SearchRecordDao.dropTable(db, ifExists);
     }
 
     /**
@@ -61,6 +63,7 @@ public class DaoMaster extends AbstractDaoMaster {
         registerDaoClass(ProcessRecordDao.class);
         registerDaoClass(ScreenShotRecordDao.class);
         registerDaoClass(SdkLoginUserDao.class);
+        registerDaoClass(SearchRecordDao.class);
     }
 
     public DaoSession newSession() {

+ 14 - 0
app/src/main/java/com/sheep/gamegroup/greendao/download/DaoSession.java

@@ -14,6 +14,7 @@ import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 import com.sheep.gamegroup.greendao.download.ProcessRecord;
 import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.SearchRecord;
 
 import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
 import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
@@ -21,6 +22,7 @@ import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
 import com.sheep.gamegroup.greendao.download.ProcessRecordDao;
 import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.SearchRecordDao;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 
@@ -37,6 +39,7 @@ public class DaoSession extends AbstractDaoSession {
     private final DaoConfig processRecordDaoConfig;
     private final DaoConfig screenShotRecordDaoConfig;
     private final DaoConfig sdkLoginUserDaoConfig;
+    private final DaoConfig searchRecordDaoConfig;
 
     private final AcceptTaskRecordDao acceptTaskRecordDao;
     private final AppdownloadBeanDao appdownloadBeanDao;
@@ -44,6 +47,7 @@ public class DaoSession extends AbstractDaoSession {
     private final ProcessRecordDao processRecordDao;
     private final ScreenShotRecordDao screenShotRecordDao;
     private final SdkLoginUserDao sdkLoginUserDao;
+    private final SearchRecordDao searchRecordDao;
 
     public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
             daoConfigMap) {
@@ -67,12 +71,16 @@ public class DaoSession extends AbstractDaoSession {
         sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
         sdkLoginUserDaoConfig.initIdentityScope(type);
 
+        searchRecordDaoConfig = daoConfigMap.get(SearchRecordDao.class).clone();
+        searchRecordDaoConfig.initIdentityScope(type);
+
         acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
         appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
         downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
         processRecordDao = new ProcessRecordDao(processRecordDaoConfig, this);
         screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
         sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
+        searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
 
         registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
         registerDao(AppdownloadBean.class, appdownloadBeanDao);
@@ -80,6 +88,7 @@ public class DaoSession extends AbstractDaoSession {
         registerDao(ProcessRecord.class, processRecordDao);
         registerDao(ScreenShotRecord.class, screenShotRecordDao);
         registerDao(SdkLoginUser.class, sdkLoginUserDao);
+        registerDao(SearchRecord.class, searchRecordDao);
     }
     
     public void clear() {
@@ -89,6 +98,7 @@ public class DaoSession extends AbstractDaoSession {
         processRecordDaoConfig.clearIdentityScope();
         screenShotRecordDaoConfig.clearIdentityScope();
         sdkLoginUserDaoConfig.clearIdentityScope();
+        searchRecordDaoConfig.clearIdentityScope();
     }
 
     public AcceptTaskRecordDao getAcceptTaskRecordDao() {
@@ -115,4 +125,8 @@ public class DaoSession extends AbstractDaoSession {
         return sdkLoginUserDao;
     }
 
+    public SearchRecordDao getSearchRecordDao() {
+        return searchRecordDao;
+    }
+
 }

+ 81 - 0
app/src/main/java/com/sheep/gamegroup/greendao/download/SearchRecord.java

@@ -0,0 +1,81 @@
+package com.sheep.gamegroup.greendao.download;
+
+import com.sheep.gamegroup.absBase.ISearchRecord;
+
+import org.greenrobot.greendao.annotation.Entity;
+import org.greenrobot.greendao.annotation.Id;
+import org.greenrobot.greendao.annotation.Property;
+import org.greenrobot.greendao.annotation.Generated;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ * 搜索历史
+ */
+@Entity
+public class SearchRecord implements ISearchRecord {
+    /**
+     * id,
+     */
+    @Id(autoincrement = true)
+    private Long id;
+    /**
+     * 关键字
+     */
+    @Property(nameInDb = "input")
+    private String input;
+    /**
+     * 第一次搜索时间
+     */
+    @Property(nameInDb = "first_time")
+    private long first_time;
+    /**
+     * 最后一次搜索时间
+     */
+    @Property(nameInDb = "last_time")
+    private long last_time;
+    @Property(nameInDb = "count")//搜索次数
+    private int count;
+    public int getCount() {
+        return this.count;
+    }
+    public void setCount(int count) {
+        this.count = count;
+    }
+    public long getLast_time() {
+        return this.last_time;
+    }
+    public void setLast_time(long last_time) {
+        this.last_time = last_time;
+    }
+    public long getFirst_time() {
+        return this.first_time;
+    }
+    public void setFirst_time(long first_time) {
+        this.first_time = first_time;
+    }
+    public String getInput() {
+        return this.input;
+    }
+    public void setInput(String input) {
+        this.input = input;
+    }
+    public Long getId() {
+        return this.id;
+    }
+    public void setId(Long id) {
+        this.id = id;
+    }
+    @Generated(hash = 2088438352)
+    public SearchRecord(Long id, String input, long first_time, long last_time,
+            int count) {
+        this.id = id;
+        this.input = input;
+        this.first_time = first_time;
+        this.last_time = last_time;
+        this.count = count;
+    }
+    @Generated(hash = 839789598)
+    public SearchRecord() {
+    }
+}

+ 145 - 0
app/src/main/java/com/sheep/gamegroup/greendao/download/SearchRecordDao.java

@@ -0,0 +1,145 @@
+package com.sheep.gamegroup.greendao.download;
+
+import android.database.Cursor;
+import android.database.sqlite.SQLiteStatement;
+
+import org.greenrobot.greendao.AbstractDao;
+import org.greenrobot.greendao.Property;
+import org.greenrobot.greendao.internal.DaoConfig;
+import org.greenrobot.greendao.database.Database;
+import org.greenrobot.greendao.database.DatabaseStatement;
+
+// THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
+/** 
+ * DAO for table "SEARCH_RECORD".
+*/
+public class SearchRecordDao extends AbstractDao<SearchRecord, Long> {
+
+    public static final String TABLENAME = "SEARCH_RECORD";
+
+    /**
+     * Properties of entity SearchRecord.<br/>
+     * Can be used for QueryBuilder and for referencing column names.
+     */
+    public static class Properties {
+        public final static Property Id = new Property(0, Long.class, "id", true, "_id");
+        public final static Property Input = new Property(1, String.class, "input", false, "input");
+        public final static Property First_time = new Property(2, long.class, "first_time", false, "first_time");
+        public final static Property Last_time = new Property(3, long.class, "last_time", false, "last_time");
+        public final static Property Count = new Property(4, int.class, "count", false, "count");
+    }
+
+
+    public SearchRecordDao(DaoConfig config) {
+        super(config);
+    }
+    
+    public SearchRecordDao(DaoConfig config, DaoSession daoSession) {
+        super(config, daoSession);
+    }
+
+    /** Creates the underlying database table. */
+    public static void createTable(Database db, boolean ifNotExists) {
+        String constraint = ifNotExists? "IF NOT EXISTS ": "";
+        db.execSQL("CREATE TABLE " + constraint + "\"SEARCH_RECORD\" (" + //
+                "\"_id\" INTEGER PRIMARY KEY AUTOINCREMENT ," + // 0: id
+                "\"input\" TEXT," + // 1: input
+                "\"first_time\" INTEGER NOT NULL ," + // 2: first_time
+                "\"last_time\" INTEGER NOT NULL ," + // 3: last_time
+                "\"count\" INTEGER NOT NULL );"); // 4: count
+    }
+
+    /** Drops the underlying database table. */
+    public static void dropTable(Database db, boolean ifExists) {
+        String sql = "DROP TABLE " + (ifExists ? "IF EXISTS " : "") + "\"SEARCH_RECORD\"";
+        db.execSQL(sql);
+    }
+
+    @Override
+    protected final void bindValues(DatabaseStatement stmt, SearchRecord entity) {
+        stmt.clearBindings();
+ 
+        Long id = entity.getId();
+        if (id != null) {
+            stmt.bindLong(1, id);
+        }
+ 
+        String input = entity.getInput();
+        if (input != null) {
+            stmt.bindString(2, input);
+        }
+        stmt.bindLong(3, entity.getFirst_time());
+        stmt.bindLong(4, entity.getLast_time());
+        stmt.bindLong(5, entity.getCount());
+    }
+
+    @Override
+    protected final void bindValues(SQLiteStatement stmt, SearchRecord entity) {
+        stmt.clearBindings();
+ 
+        Long id = entity.getId();
+        if (id != null) {
+            stmt.bindLong(1, id);
+        }
+ 
+        String input = entity.getInput();
+        if (input != null) {
+            stmt.bindString(2, input);
+        }
+        stmt.bindLong(3, entity.getFirst_time());
+        stmt.bindLong(4, entity.getLast_time());
+        stmt.bindLong(5, entity.getCount());
+    }
+
+    @Override
+    public Long readKey(Cursor cursor, int offset) {
+        return cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0);
+    }    
+
+    @Override
+    public SearchRecord readEntity(Cursor cursor, int offset) {
+        SearchRecord entity = new SearchRecord( //
+            cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0), // id
+            cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1), // input
+            cursor.getLong(offset + 2), // first_time
+            cursor.getLong(offset + 3), // last_time
+            cursor.getInt(offset + 4) // count
+        );
+        return entity;
+    }
+     
+    @Override
+    public void readEntity(Cursor cursor, SearchRecord entity, int offset) {
+        entity.setId(cursor.isNull(offset + 0) ? null : cursor.getLong(offset + 0));
+        entity.setInput(cursor.isNull(offset + 1) ? null : cursor.getString(offset + 1));
+        entity.setFirst_time(cursor.getLong(offset + 2));
+        entity.setLast_time(cursor.getLong(offset + 3));
+        entity.setCount(cursor.getInt(offset + 4));
+     }
+    
+    @Override
+    protected final Long updateKeyAfterInsert(SearchRecord entity, long rowId) {
+        entity.setId(rowId);
+        return rowId;
+    }
+    
+    @Override
+    public Long getKey(SearchRecord entity) {
+        if(entity != null) {
+            return entity.getId();
+        } else {
+            return null;
+        }
+    }
+
+    @Override
+    public boolean hasKey(SearchRecord entity) {
+        return entity.getId() != null;
+    }
+
+    @Override
+    protected final boolean isEntityUpdateable() {
+        return true;
+    }
+    
+}

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

@@ -46,6 +46,7 @@ public class DownloadHelper {
         updateDownloadTaskView(activity, iTask, down_tv, callBack,0);
     }
     public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv, final Action1<Object> callBack,int type) {
+        final boolean showSimpleText = down_tv.getText().length() < 4;
         if(downloadUtil == null){
             downloadUtil = new DownloadUtil(activity);
         }
@@ -62,7 +63,7 @@ public class DownloadHelper {
 //                if(callBack != null)
 //                    callBack.call(o);
             }
-        });
+        }, showSimpleText);
         if(type == 0){
             down_tv.setOnClickListener(new View.OnClickListener() {
                 @Override

+ 37 - 67
app/src/main/java/com/sheep/gamegroup/helper/FindAppHelper.java

@@ -5,13 +5,13 @@ import android.view.Gravity;
 import android.view.View;
 import android.widget.TextView;
 
-import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.gamegroup.model.api.IDownload;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
-import com.sheep.gamegroup.model.entity.FindApp;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
+import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.util.DownloadTextUtl;
+import com.sheep.gamegroup.util.DownloadUtil;
 import com.sheep.gamegroup.util.TimeUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -29,7 +29,7 @@ import static com.sheep.gamegroup.util.UMConfigUtils.Event.FIND_APP;
  * Created by realicing on 2018/6/29.
  * realicing@sina.com
  */
-public class FindAppHelper{
+public class FindAppHelper {
     private DownloadHelper downloadHelper = new DownloadHelper();
 
     public DownloadHelper getDownloadHelper() {
@@ -39,40 +39,40 @@ public class FindAppHelper{
     public void updateState(int status) {
         downloadHelper.updateState(status);
     }
+
     public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv) {
-        updateDownloadTaskView(activity,iTask,down_tv, 0);
+        updateDownloadTaskView(activity, iTask, down_tv, 0);
     }
+
     public void updateDownloadTaskView(final Activity activity, final IDownload iTask, final TextView down_tv, int type) {
         downloadHelper.updateDownloadTaskView(activity, iTask, down_tv, new Action1<Object>() {
             @Override
             public void call(Object object) {
-                boolean installed = object instanceof  Integer && DownloadUtil.STATUS_INIT != (int)object;//-1 点击下载按钮的回调;其它状态直接回调不需要点击按钮
-                boolean downloadLinkError = object instanceof  Boolean && !(boolean)object;//false 下载地址错误会传false过来
-                if(installed || downloadLinkError){
-                    if(iTask instanceof FindApp) {
-                        FindApp findApp = (FindApp) iTask;
-                        recordAppDownloads(activity, findApp, null);
-                        FIND_APP.onEvent("application_id", findApp.getId(), "action", down_tv.getText());
-                    }else if(iTask instanceof PlayGameEntity) {
-                        PlayGameEntity findApp = (PlayGameEntity) iTask;
+                boolean installed = object instanceof Integer && DownloadUtil.STATUS_INIT != (int) object;//-1 点击下载按钮的回调;其它状态直接回调不需要点击按钮
+                boolean downloadLinkError = object instanceof Boolean && !(boolean) object;//false 下载地址错误会传false过来
+                if (installed || downloadLinkError) {
+                    if (iTask instanceof Applications) {
+                        Applications findApp = (Applications) iTask;
                         recordAppDownloads(activity, findApp, null);
                         FIND_APP.onEvent("application_id", findApp.getId(), "action", down_tv.getText());
                     }
                 }
             }
-        },type);
+        }, type);
     }
 
     /**
      * 更新预约下载状态与响应点击
+     *
      * @param activity
      * @param findApp
      * @param reservation_tv
      */
-    public void updateReservationView(final Activity activity, final FindApp findApp, final TextView reservation_tv) {
-        if(findApp.isCanRecord()) {
+    public void updateReservationView(final Activity activity, final Applications findApp, final TextView reservation_tv) {
+        final boolean showSimpleText = reservation_tv.getText().length() < 4;
+        if (findApp.isCanRecord()) {
             reservation_tv.setEnabled(true);
-            reservation_tv.setText("预约下载");
+            reservation_tv.setText(DownloadTextUtl.getReservationText(showSimpleText));
             reservation_tv.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View view) {
@@ -83,51 +83,55 @@ public class FindAppHelper{
             });
         } else {
             reservation_tv.setEnabled(false);
-            reservation_tv.setText("已经预约");
+            reservation_tv.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
         }
     }
-    public void updateReservationView(final Activity activity, final PlayGameEntity findApp, final TextView reservation_tv, int type) {
-        if(findApp.isCanRecord()) {
+
+    public void updateReservationView(final Activity activity, final Applications gameApp, final TextView reservation_tv, int type) {
+        final boolean showSimpleText = reservation_tv.getText().length() < 4;
+        if (gameApp.isCanRecord()) {
             reservation_tv.setEnabled(true);
-            reservation_tv.setText("预约下载");
-            if(type == 0){
+            reservation_tv.setText(DownloadTextUtl.getReservationText(showSimpleText));
+            if (type == 0) {
                 reservation_tv.setOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        FIND_APP.onEvent("application_id", findApp.getId(), "action", "预约下载");
+                        FIND_APP.onEvent("application_id", gameApp.getId(), "action", "预约下载");
                         reservation_tv.setEnabled(false);
-                        recordAppDownloads(activity, findApp, reservation_tv);
+                        recordAppDownloads(activity, gameApp, reservation_tv);
                     }
                 });
             }
 
         } else {
             reservation_tv.setEnabled(false);
-            reservation_tv.setText("已经预约");
+            reservation_tv.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
         }
     }
 
 
     /**
      * 点击预约下载与立即下载时,需要调用这个接口记录到服务器
+     *
      * @param findApp
      */
-    private void recordAppDownloads(final Activity activity, final FindApp findApp, final TextView textView) {
+    private void recordAppDownloads(final Activity activity, final Applications findApp, final TextView textView) {
         SheepApp.getInstance().getNetComponent().getApiService().recordAppDownloads(findApp.getId())
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
+                        final boolean showSimpleText = textView.getText().length() < 4;
                         findApp.setRecord(2);//设置为不可记录
-                        if(findApp.isCanDownload()){
+                        if (findApp.isCanDownload()) {
                             //提交下载成功
-                            if(textView != null)
+                            if (textView != null)
                                 textView.setEnabled(true);
                         } else {//提交预约成功
-                            if(textView != null) {
+                            if (textView != null) {
                                 textView.setEnabled(false);
-                                textView.setText("已经预约");
+                                textView.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
                             }
                             ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("预约成功")
                                     .setMsg(String.format(Locale.CHINA, "请在%s准时到小绵羊下载哦", TimeUtil.TimeStamp2Date(findApp.getDownload_at(), "yyyy年MM月dd日HH时mm分")))
@@ -137,44 +141,10 @@ public class FindAppHelper{
 
                     @Override
                     public void onError(BaseMessage baseMessage) {
-                        if(!findApp.isCanDownload()){
-                            G.showToast("预约失败");
-                        }
-                        if(textView != null)
-                            textView.setEnabled(true);
-                    }
-                });
-    }
-    private void recordAppDownloads(final Activity activity, final PlayGameEntity items, final TextView textView) {
-
-        SheepApp.getInstance().getNetComponent().getApiService().recordAppDownloads(items.getId())
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-                        items.setRecord(2);//设置为不可记录
-                        if(items.isCanDownload()){
-                            //提交下载成功
-                            if(textView != null)
-                                textView.setEnabled(true);
-                        } else {//提交预约成功
-                            if(textView != null) {
-                                textView.setEnabled(false);
-                                textView.setText("已经预约");
-                            }
-                            ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("预约成功")
-                                    .setMsg(String.format(Locale.CHINA, "请在%s准时到小绵羊下载哦", TimeUtil.TimeStamp2Date(items.getDownload_at(), "yyyy年MM月dd日HH时mm分")))
-                                    .setMsgGravity(Gravity.START).setBtnLeftText("我知道了"));
-                        }
-                    }
-
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-                        if(!items.isCanDownload()){
+                        if (!findApp.isCanDownload()) {
                             G.showToast("预约失败");
                         }
-                        if(textView != null)
+                        if (textView != null)
                             textView.setEnabled(true);
                     }
                 });

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

@@ -18,13 +18,12 @@ import java.util.ArrayList; /**
  * realicing@sina.com
  */
 public class ImageListHelper {
-    private RecyclerViewAdapter mRecyclerViewAdapter;
-    public void initList(final Activity activity, final RecyclerView recyclerView, final ArrayList<String> pictureList) {
+    public static void initList(final Activity activity, final RecyclerView recyclerView, final ArrayList<String> pictureList) {
         recyclerView.setVisibility(View.VISIBLE);
         recyclerView.setLayoutManager(new LinearLayoutManager(recyclerView.getContext(), LinearLayoutManager.HORIZONTAL, false));
         recyclerView.setNestedScrollingEnabled(false);
 
-        mRecyclerViewAdapter = new RecyclerViewAdapter<String>(recyclerView.getContext(), R.layout.item_image, pictureList) {
+        RecyclerViewAdapter mRecyclerViewAdapter = new RecyclerViewAdapter<String>(recyclerView.getContext(), R.layout.item_image, pictureList) {
             @Override
             public void convert(ViewHolder viewHolder, String url, final int position) {
                 View view = viewHolder.getView(R.id.img_detail);
@@ -46,9 +45,4 @@ public class ImageListHelper {
         };
         recyclerView.setAdapter(mRecyclerViewAdapter);
     }
-
-    public void notifyDataSetChanged() {
-        if(mRecyclerViewAdapter != null)
-            mRecyclerViewAdapter.notifyDataSetChanged();
-    }
 }

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

@@ -14,7 +14,7 @@ import com.sheep.gamegroup.model.entity.OrienteeringDetail;
 import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskChild;
 import com.sheep.gamegroup.model.entity.TaskEty;
-import com.sheep.gamegroup.model.entity.TaskReleaseEty;
+import com.sheep.gamegroup.model.entity.Release_task;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.GlideImageLoader;
@@ -81,7 +81,7 @@ public class TaskHelper {
                 });
     }
 
-    private TaskReleaseEty taskReleaseEty;
+    private Release_task taskReleaseEty;
 
     private void initTask(int release_task_id) {
         SheepApp.getInstance().getNetComponent().getApiService().taskDesc(release_task_id)
@@ -90,7 +90,7 @@ public class TaskHelper {
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                     @Override
                     public void onNext(BaseMessage baseMessage) {
-                        taskReleaseEty = baseMessage.getData(TaskReleaseEty.class);
+                        taskReleaseEty = baseMessage.getData(Release_task.class);
                         if (action1 != null)
                             action1.call(1);//刷新界面
 
@@ -388,7 +388,7 @@ public class TaskHelper {
      * @param textView
      * @param taskReleaseEty
      */
-    public static void setNumText(TextView textView, TaskReleaseEty taskReleaseEty) {
+    public static void setNumText(TextView textView, Release_task taskReleaseEty) {
         textView.setVisibility(View.VISIBLE);
         ViewUtil.setText(textView, String.format(Locale.CHINA, "剩余%s份", taskReleaseEty.getLast_num()));
     }
@@ -399,7 +399,7 @@ public class TaskHelper {
      * @param textView
      * @param taskReleaseEty
      */
-    public static void setTaskTypeText(TextView textView, TaskReleaseEty taskReleaseEty) {
+    public static void setTaskTypeText(TextView textView, Release_task taskReleaseEty) {
         textView.setVisibility(View.VISIBLE);
         String[] textColor = getTaskTypeTextColor(taskReleaseEty.getTask());
         ViewUtil.setColorMapText(textView, String.format(Locale.CHINA, "%s", textColor[0]), textColor[0], textColor[1]);
@@ -415,7 +415,7 @@ public class TaskHelper {
      * @param textView
      * @param taskReleaseEty
      */
-    public static void setTaskTagText(TextView textView, TaskReleaseEty taskReleaseEty) {
+    public static void setTaskTagText(TextView textView, Release_task taskReleaseEty) {
         textView.setVisibility(View.VISIBLE);
         ViewUtil.setColorMapText(textView, String.format(Locale.CHINA, "%s", taskReleaseEty.getCashOrWelfare()), taskReleaseEty.getCashOrWelfare(), "#FD2D54");
         textView.setBackgroundResource(R.drawable.shape_red_stroke_rectangle_no_lb);

+ 291 - 5
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -2,8 +2,11 @@ package com.sheep.gamegroup.model.api;
 
 import com.alibaba.fastjson.JSONArray;
 import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.absBase.IHomePageSearch;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 
+import org.afinal.simplecache.ApiKey;
+
 import java.util.Map;
 
 import retrofit2.Call;
@@ -94,11 +97,13 @@ public interface ApiService {
      */
     @GET("app/find/commend_app")
     Observable<BaseMessage> getCommendApp(@Query("game_id") String game_id, @Query("order") int order);
+
     /**
      * 查询用户是否可以弹窗推荐应用
      */
     @GET("app/find/can/commend_app")
     Observable<BaseMessage> canGetCommendApp(@Query("game_id") String game_id);
+
     /**
      * @return ,
      * 主页抢任务
@@ -179,6 +184,7 @@ public interface ApiService {
      */
     @POST("app/accepted_task/auto_check/")
     Observable<BaseMessage> commitAutoTask(@Body JSONObject param);
+
     /**
      * 获取未查看的任务成功或失败的记录
      */
@@ -267,6 +273,7 @@ public interface ApiService {
 
     /**
      * 新手红包
+     *
      * @return .
      */
     @POST("app/newbie_task/login_red_packet")
@@ -326,6 +333,12 @@ public interface ApiService {
     @GET("app/accepted_task/status")
     Observable<BaseMessage> taskStatus(@Query("id") int id, @Query("screenshots") String screenshots,
                                        @Query("remark") String remark, @Query("package_name") String package_name, @Query("status") String status, @Query("device") String device);
+    /**
+     * 修改任务进度
+     */
+    @GET("app/accepted_task/status")
+    Observable<BaseMessage> taskStatus(@Query("id") int id, @Query("screenshots") String screenshots,
+                                       @Query("remark") String remark, @Query("package_name") String package_name, @Query("status") String status, @Query("device") String device, @Query("unique_identification") String unique_identification);
 //    @GET("app/accepted_task/status")
 //    Observable<BaseMessage> taskStatus(@Body JSONObject jsonObject);
 
@@ -523,6 +536,7 @@ public interface ApiService {
      */
     @GET("app/punch/all_punch_log")
     Observable<BaseMessage> getAllPunchLog(@Query("page") int page, @Query("per_page") int per_page);
+
     /**
      * 获取连续打卡记录
      */
@@ -577,6 +591,7 @@ public interface ApiService {
      */
     @GET("app/punch/punch_and_sign_count")
     Observable<BaseMessage> getPunchAndSignCount();
+
     /**
      * 获取今日之星数据
      */
@@ -888,7 +903,7 @@ public interface ApiService {
      * 获取邀请用户排名
      */
     @GET("app/user/invitation_top")
-    Observable<BaseMessage> getInvitationTop(@Query("top") int top,@Query("start_time") long start_time,@Query("end_time") long end_time);//top默认为5,可以不传
+    Observable<BaseMessage> getInvitationTop(@Query("top") int top, @Query("start_time") long start_time, @Query("end_time") long end_time);//top默认为5,可以不传
 
     /**
      * 获取邀请用户进两月礼物发放记录
@@ -921,6 +936,7 @@ public interface ApiService {
      */
     @GET("app/awaken/article")
     Observable<BaseMessage> awakenApparticle(@Query("page") int page, @Query("per_page") int per_page);
+
     /**
      * 唤醒业务APP
      */
@@ -950,6 +966,7 @@ public interface ApiService {
      */
     @PUT("app/gift_bag/receive/{id}")
     Observable<BaseMessage> receiveGiftBag(@Path("id") int id);
+
     /**
      * 获取热门福利
      */
@@ -979,21 +996,26 @@ public interface ApiService {
      */
     @PUT("app/user/bind_third")
     Observable<BaseMessage> bindThird(@Body JSONObject jsonObject);
+
     /**
      * 换绑qq或微信
      */
     @PUT("app/user/modify_third")
     Observable<BaseMessage> modifyThird(@Body JSONObject jsonObject);
+
     /**
      * 发送/校验换绑验证码
      */
     @POST("app/user/modify_third_sms")
     Observable<BaseMessage> modifyThirdSms(@Body JSONObject jsonObject);
+
     /**
      * 检查是否需要输入邀请码
      */
     @GET("app/auth/need_code")
     Observable<BaseMessage> needCode(@Query("mobile") String mobile);
+//---------------------------start 玩转游戏------------------------------
+
     /**
      * 玩转游戏——每日必玩
      * 玩转游戏——近期最热
@@ -1009,6 +1031,7 @@ public interface ApiService {
      */
     @GET("app/find/recommend/user_like")
     Observable<BaseMessage> getUserLikeList();
+
     /**
      * 玩转游戏-获取主页游戏数据 1:天天更新 2:重点推荐
      * display_type
@@ -1018,6 +1041,7 @@ public interface ApiService {
      */
     @GET("app/find/recommend")
     Observable<BaseMessage> getRecommendList(@Query("display_type") int display_type);
+
     /**
      * 玩转游戏-获取主页游戏数据 1:天天更新 2:重点推荐 更多
      * display_type
@@ -1027,13 +1051,178 @@ public interface ApiService {
      */
     @GET("app/find/recommend/list")
     Observable<BaseMessage> getRecommendListMore(@Query("display_type") int display_type);
+
     /**
      * 玩转游戏-获取主页 获取标签列表
      */
     @GET("app/find/game/tags")
     Observable<BaseMessage> getGameTagList();
+
+    /**
+     * 玩转游戏-游戏详情 相关游戏
+     * app_id 应用的id
+     */
+    @GET("app/find/detail/relevant_games")
+    Observable<BaseMessage> getDetailRelevantGames(@Query("app_id") int app_id);
+
+    /**
+     * 玩转游戏-游戏详情 热门试玩
+     * app_id 应用的id
+     */
+    @GET("app/find/detail/hot_games")
+    Observable<BaseMessage> getDetailHotGames(@Query("app_id") int app_id);
+
+    /**
+     * 玩转游戏-游戏详情 活动推荐
+     * app_id 应用的id
+     */
+    @GET("app/find/detail/activity_recommend")
+    Observable<BaseMessage> getDetailActivityRecommend(@Query("app_id") int app_id);
+
+    /**
+     * 玩转游戏-游戏详情 文章推荐
+     * app_id 应用的id
+     */
+    @GET("app/find/detail/article_recommend")
+    Observable<BaseMessage> getDetailArticleRecommend(@Query("app_id") int app_id);
+
+    //---------------------------start game_user------------------------------
+
+    /**
+     * 查询应用评论列表
+     * CommentType       int8    `description:"评论类型 1:游戏 2:资讯" json:"comment_type"`
+     * app_id * integer (query)	应用id
+     * page_no  integer (query) 页码
+     * page_size  integer (query) 每页显示条数默认10条
+     */
+    @GET("app/game_user/app_comment_list")
+    Observable<BaseMessage> getGameUserAppCommentList(@Query("page_no") int page_no, @Query("page_size") int page_size, @Query("app_id") int app_id, @Query("comment_type") int comment_type);
+
+    /**
+     * 查询应用评分详情
+     * app_id * integer (query)	应用id
+     */
+    @GET("app/game_user/app_score_detail")
+    Observable<BaseMessage> getGameUserAppScoreDetail(@Query("app_id") int app_id);
+
+    /**
+     * 查询用户主页评论列表
+     * focus_user_id  integer (query) 关注用户id
+     * page_no  integer (query) 页码
+     * page_size  integer (query) 每页显示条数默认10条
+     */
+    @GET("app/game_user/comment_list")
+    Observable<BaseMessage> getGameUserCommentList(@Query("page_no") int page_no, @Query("page_size") int page_size, @Query("focus_user_id") int focus_user_id);
+
+    /**
+     * 查询用户主页详情
+     * focus_user_id * integer (query)	关注用户id
+     */
+    @GET("app/game_user/detail")
+    Observable<BaseMessage> getGameUserDetail(@Query("focus_user_id") int focus_user_id);
+
+    /**
+     * 关注游戏
+     * focus_game_id  * integer (query)	关注应用id
+     */
+    @POST("app/game_user/focus_game")
+    Observable<BaseMessage> postGameUserFocusGame(@Query("focus_game_id") int focus_game_id);
+
+    /**
+     * 关注用户
+     * focus_user_id * integer (query)	关注用户id
+     */
+    @POST("app/game_user/focus_user")
+    Observable<BaseMessage> postGameUserFocusUser(@Query("focus_user_id") int focus_user_id);
+
+    /**
+     * 查询最近在玩以及同类型游戏
+     * focus_user_id * integer (query)	关注用户id
+     */
+    @GET("app/game_user/lately_game")
+    Observable<BaseMessage> getGameUserLatelyGame(@Query("focus_user_id") int focus_user_id);
+
+    /**
+     * 用户主页点赞
+     * focus_user_id * integer (query)	关注用户id
+     */
+    @POST("app/game_user/like")
+    Observable<BaseMessage> postGameUserLike(@Query("focus_user_id") int focus_user_id);
+
+    /**
+     * 回复用户评论
+     * ReplyUserCommentReq{
+     * content:	string  评论内容
+     * user_comment_reply_id:	integer ($int64) 回复id
+     * }
+     */
+    @POST("app/game_user/reply_comment")
+    Observable<BaseMessage> postGameUserReplyComment(@Body JSONObject jsonObject);
+
+    /**
+     * 查询用户主页回复列表
+     * focus_user_id  integer (query) 关注用户id
+     * page_no  integer (query) 页码
+     * page_size  integer (query) 每页显示条数默认10条
+     */
+    @GET("app/game_user/reply_list")
+    Observable<BaseMessage> getGameUserReplyList(@Query("page_no") int page_no, @Query("page_size") int page_size, @Query("focus_user_id") int focus_user_id);
+
+    /**
+     * 用户评论用户
+     * UserCommentReq{
+     * content:	string  评论内容
+     * user_comment_id:	integer ($int64) 评论id
+     * }
+     */
+    @POST("app/game_user/user_comment")
+    Observable<BaseMessage> postGameUserUserComment(@Body JSONObject jsonObject);
+
+    /**
+     * 查询用户评论详情
+     * user_comment_id  integer (query) 评论id
+     * page_no  integer (query) 页码
+     * page_size  integer (query) 每页显示条数默认10条
+     */
+    @GET("app/game_user/user_comment_detail")
+    Observable<BaseMessage> getGameUserUserCommentDetail(@Query("page_no") int page_no, @Query("page_size") int page_size, @Query("user_comment_id") int user_comment_id);
+
+    /**
+     * 用户评论用户点赞
+     * user_comment_reply_id * integer (query) 回复id
+     */
+    @POST("app/game_user/user_comment_like")
+    Observable<BaseMessage> postGameUserUserCommentLike(@Query("user_comment_reply_id") int user_comment_reply_id);
+
+    /**
+     * 用户游戏评论
+     * GameCommentReq{
+     * CommentType       int8    `description:"评论类型 1:游戏 2:资讯" json:"comment_type"`
+     * app_id:	integer ($int64) 应用id
+     * content:	string 评论内容
+     * score:	integer ($int32) 评分 1-10
+     * }
+     */
+    @POST("app/game_user/user_game_comment")
+    Observable<BaseMessage> postGameUserUserGameComment(@Body JSONObject jsonObject);
+
+    /**
+     * 用户游戏评论表情点赞
+     * user_comment_id * integer (query) 评论id
+     */
+    @POST("app/game_user/user_game_comment_expression_like")
+    Observable<BaseMessage> postGameUserUserGameCommentExpressionLike(@Query("user_comment_id") int user_comment_id);
+
+    /**
+     * 用户游戏评论点赞
+     * user_comment_id * integer (query) 评论id
+     */
+    @POST("app/game_user/user_game_comment_like")
+    Observable<BaseMessage> postGameUserUserGameCommentLike(@Query("user_comment_id") int user_comment_id);
+    //---------------------------end game_user------------------------------
+//---------------------------end 玩转游戏------------------------------
+
     /**
-     *
      * type: 1002:快发出包 1003:腾讯出包 1004:小米出包
      */
     @GET("app/find")
@@ -1041,30 +1230,38 @@ public interface ApiService {
 
     /**
      * platform 平台 1:andriod 2:ios
+     *
      * @return
      */
     @GET("app/game_banner")
     Observable<BaseMessage> gameBanner(@Query("platform") int platform);
+
     /**
      * platform 平台 1:andriod 2:ios
      * 获取游戏中心主页活动数据
      */
     @GET("app/game_banner/activity?platform=1")
     Observable<BaseMessage> gameBannerAct();
+
     /**
-     * platform 平台 1:andriod 2:ios
+     * 游戏详情
+     *
      * @return
      */
     @GET("app/find/{id}")
     Observable<BaseMessage> playGameDetail(@Path("id") int id);
+
     /**
      * 判断是否是第一次运行的设备
+     *
      * @return
      */
     @GET("app/event_tracking/check_user_first")
     Observable<BaseMessage> checkUserFirst();
+
     /**
      * 查询用户截图加密开关
+     *
      * @return
      */
     @GET("app/common_config/need_shot_screen")
@@ -1074,47 +1271,134 @@ public interface ApiService {
 //    http://10.8.220.237:8010/v1/app/mobile_point/score    获取用户积分 post
 //    http://10.8.220.237:8010/v1/app/mobile_point/sms      获取短信验证码 post
 //    http://10.8.220.237:8010/v1/app/mobile_point/recharge 兑换积分 post
+
     /**
      * 获取商品列表
+     *
      * @return
      */
     @GET("app/mobile_point/goods")
     Observable<BaseMessage> getCMCCGoods();
+
     /**
      * 获取用户积分
+     *
      * @return
      */
     @POST("app/mobile_point/score")
     Observable<BaseMessage> getCMCCScore(@Body JSONObject jsonObject);
+
     /**
      * 获取短信验证码
+     *
      * @return
      */
     @POST("app/mobile_point/sms")
     Observable<BaseMessage> smsCMCC(@Body JSONObject jsonObject);
+
     /**
      * 兑换积分
-     * @return
      */
     @POST("app/mobile_point/recharge")
     Observable<BaseMessage> rechargeCMCC(@Body JSONObject jsonObject);
+//---------------------------start 个人中心-------------------------------------
 
+    /**
+     * 用户中心模块获取
+     */
+    @GET(ApiKey.user_module)
+    Observable<BaseMessage> getUserModule();
+
+    /**
+     * 新手引导
+     */
+    @GET(ApiKey.novice_guidance)
+    Observable<BaseMessage> getNoviceGuidance();
+
+//---------------------------end 个人中心-------------------------------------
+//---------------------------start 签到-------------------------------------
+
+    /**
+     * 签到状态获取
+     */
+    @GET("app/user_sign/signs")
+    Observable<BaseMessage> getUserSignSigns();
+    /**
+     * 获取最后一次刮奖结果
+     */
+    @GET("app/user_sign/scratch_amount")
+    Observable<BaseMessage> getUserSignScratch_amount();
+    /**
+     * 获取最后一次刮奖结果
+     */
+    @GET("app/user_sign/last_scratch")
+    Observable<BaseMessage> getUserSignLastScratch();
+    /**
+     * 每日签到
+     */
+    @POST("app/user_sign/sign_in")
+    Observable<BaseMessage> postUserSignSignIn();
+    /**
+     * 分享
+     */
+    @POST("app/user_sign/share")
+    Observable<BaseMessage> postUserSignShare();
+
+    /**
+     * 补签
+     * date * string (query)	 补签日期
+     * day * integer (query)	 补签周次
+     */
+    @POST("app/user_sign/sign_in_supplement")
+    Observable<BaseMessage> postUserSignSignInSupplement(@Query("date") String date, @Query("day") int day);
 
+    /**
+     * 刮奖
+     */
+    @POST("app/user_sign/scratch_card")
+    Observable<BaseMessage> postUserSignScratchCard();
+//---------------------------end 签到-------------------------------------
+//---------------------------start 搜索相关-------------------------------------
 
+    /**
+     * 获取搜索相关热门推荐
+     * platform * integer (query) 平台 0全 1android 2ios
+     */
+    @GET(ApiKey.top_search_statistics)
+    Observable<BaseMessage> getTopSearchStatistics();
+
+    /**
+     * 点击热门搜索后,统计点击次数
+     * link_id * integer (query) 关联id
+     * link_type * integer (query) 关联类型 1任务 2游戏
+     */
+    @POST("app/top_search_statistics/click_top_search")
+    Observable<BaseMessage> postTopSearchStatisticsClickTopSearch(@Query("link_id") int link_id, @IHomePageSearch.LINK_TYPE @Query("link_type") int link_type);
+    /**
+     * 根据任务名(游戏名)模糊搜索
+     * search_content * string (query) 任务名(游戏名)
+     */
+    @GET("app/top_search_statistics/home_page_search")
+    Observable<BaseMessage> getTopSearchStatisticsHomePageSearch(@Query("search_content") String search_content);
 
 
+//---------------------------end 搜索相关-------------------------------------
 //---------------------------start 游戏sdk相关接口-------------------------------------
+
     /**
      * 请求授权
+     *
      * @return
      */
     @GET("app/sdk/{game_key}")
     Observable<BaseMessage> verificationAuth(@Header("Authorization") String token, @Path("game_key") String game_key);
+
     /**
      * 绵羊币支付订单查询接口
      */
     @GET("app/sdk/find/order")
     Observable<BaseMessage> sdkFindOrder(@Header("Authorization") String token, @Query("order_no") String order_no);
+
     /**
      * 绵羊币支付sdk订单
      */
@@ -1123,11 +1407,13 @@ public interface ApiService {
 //---------------------------end 游戏sdk相关接口-------------------------------------
 
 //---------------------------start 有米科技相关接口-------------------------------------
+
     /**
      * 获取有米积分余额
+     *
      * @return
      */
     @GET("youmi/youmi_total_price")
-    Observable<BaseMessage> getYmTotalPrice();
+    Observable<BaseMessage> getYmTotalPrice(@Query("uid") String uid);
 //---------------------------end 有米科技相关接口-------------------------------------
 }

+ 92 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/ApkFileInfo.java

@@ -0,0 +1,92 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.content.Context;
+import android.content.pm.PackageInfo;
+import android.text.TextUtils;
+
+import com.kfzs.duanduan.utils.ApkUtils;
+import com.sheep.gamegroup.util.Md5Util;
+import com.sheep.jiuyan.samllsheep.utils.PackageUtil;
+
+import java.io.File;
+
+import rx.functions.Action1;
+
+/**
+ * Created by realicing on 2018/11/9.
+ * realicing@sina.com
+ * 根据安装包获取相关信息,以下方法顺序执行,否则可能会报各种空指针
+ */
+public class ApkFileInfo {
+    private String path;
+
+    public String getPath() {
+        return path;
+    }
+
+    public void setPath(String path) {
+        this.path = path;
+    }
+
+    private File file;
+    public boolean existsPath() {
+        file = new File(path);
+        return file.exists();
+    }
+
+    private String packageName;
+    public ApkFileInfo initPackageNameFromPath(Context context) {
+        packageName = ApkUtils.getUnInstallApkPackageName(context, path);
+        return this;
+    }
+
+    public String getPackageName() {
+        return packageName;
+    }
+
+    private boolean isAppInstalled;
+    public boolean checkInstall(Context context) {
+        isAppInstalled = PackageUtil.isAppInstalled(context, packageName);
+        return isAppInstalled;
+    }
+
+    public boolean isAppInstalled() {
+        return isAppInstalled;
+    }
+    //是否 文件与安装的应用是否m签名d5相同
+    private boolean isEqualsSignMd5;
+
+    public boolean isEqualsSignMd5() {
+        return isEqualsSignMd5;
+    }
+
+    private PackageInfo appPackageInfo;
+    private PackageInfo filePackageInfo;
+    //检查文件与安装的应用是否m签名d5相同
+    public boolean checkApkAndFileSignMd5() {
+        String appSignMd5 = ApkUtils.getApkSignMd5StrByPackageName(packageName, new Action1<PackageInfo>() {
+            @Override
+            public void call(PackageInfo packageInfo) {
+                appPackageInfo = packageInfo;
+            }
+        });
+
+        String fileSignMd5 = ApkUtils.getApkSignMd5StrByPath(path, new Action1<PackageInfo>() {
+            @Override
+            public void call(PackageInfo packageInfo) {
+                filePackageInfo = packageInfo;
+            }
+        });
+        isEqualsSignMd5 = TextUtils.equals(fileSignMd5, appSignMd5);
+        return isEqualsSignMd5;
+    }
+    //检查文件与安装的应用是否md5相同
+    public boolean checkApkAndFileMd5() {
+        return Md5Util.checkMD5(new File(appPackageInfo.applicationInfo.sourceDir), file);
+    }
+
+    //根据版本号判断是否可安装成功
+    public boolean isCanInstallVersion() {
+        return appPackageInfo.versionCode <= filePackageInfo.versionCode;
+    }
+}

+ 121 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/AppScoreDetail.java

@@ -0,0 +1,121 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.sheep.gamegroup.util.ListUtil;
+
+import java.util.List;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ * level_1:	integer ($int32)
+ * 评分等级1
+ * level_2:	integer ($int32)
+ * 评分等级2
+ * level_3:	integer ($int32)
+ * 评分等级3
+ * level_4:	integer ($int32)
+ * 评分等级4
+ * level_5:	integer ($int32)
+ * 评分等级5
+ * score:	number ($float)
+ * 评分
+ * score_count:	integer ($int64)
+ * 评分人数
+ * 游戏评分详情
+ */
+public class AppScoreDetail {
+    private int level_1;
+    private int level_2;
+    private int level_3;
+    private int level_4;
+    private int level_5;
+    private int score;
+    private int score_count;
+
+    public int getLevel_1() {
+        return level_1;
+    }
+
+    public void setLevel_1(int level_1) {
+        this.level_1 = level_1;
+    }
+
+    public int getLevel_2() {
+        return level_2;
+    }
+
+    public void setLevel_2(int level_2) {
+        this.level_2 = level_2;
+    }
+
+    public int getLevel_3() {
+        return level_3;
+    }
+
+    public void setLevel_3(int level_3) {
+        this.level_3 = level_3;
+    }
+
+    public int getLevel_4() {
+        return level_4;
+    }
+
+    public void setLevel_4(int level_4) {
+        this.level_4 = level_4;
+    }
+
+    public int getLevel_5() {
+        return level_5;
+    }
+
+    public void setLevel_5(int level_5) {
+        this.level_5 = level_5;
+    }
+
+    public int getScore() {
+        return score;
+    }
+
+    public void setScore(int score) {
+        this.score = score;
+    }
+
+    public int getScore_count() {
+        return score_count;
+    }
+
+    public void setScore_count(int score_count) {
+        this.score_count = score_count;
+    }
+
+
+    public List<GameAppScore> toGameAppScoreList(){
+        List<GameAppScore> list = ListUtil.emptyList();
+        GameAppScore gameAppScore1 = new GameAppScore();
+        gameAppScore1.setNum(level_1);
+        gameAppScore1.setStar(1);
+        gameAppScore1.setMax(score_count);
+        list.add(gameAppScore1);
+        GameAppScore gameAppScore2 = new GameAppScore();
+        gameAppScore2.setNum(level_2);
+        gameAppScore2.setStar(2);
+        gameAppScore2.setMax(score_count);
+        list.add(gameAppScore2);
+        GameAppScore gameAppScore3 = new GameAppScore();
+        gameAppScore3.setNum(level_3);
+        gameAppScore3.setStar(3);
+        gameAppScore3.setMax(score_count);
+        list.add(gameAppScore3);
+        GameAppScore gameAppScore4 = new GameAppScore();
+        gameAppScore4.setNum(level_4);
+        gameAppScore4.setStar(4);
+        gameAppScore4.setMax(score_count);
+        list.add(gameAppScore4);
+        GameAppScore gameAppScore5 = new GameAppScore();
+        gameAppScore5.setNum(level_5);
+        gameAppScore5.setStar(5);
+        gameAppScore5.setMax(score_count);
+        list.add(gameAppScore5);
+        return list;
+    }
+}

+ 158 - 72
app/src/main/java/com/sheep/gamegroup/model/entity/FindApp.java

@@ -1,13 +1,20 @@
 package com.sheep.gamegroup.model.entity;
 
-import com.sheep.gamegroup.model.api.IDownload;
+import android.text.TextUtils;
+
+import com.sheep.gamegroup.helper.DownloadHelper;
 import com.sheep.gamegroup.helper.FindAppHelper;
+import com.sheep.gamegroup.model.api.IDownload;
+import com.sheep.gamegroup.util.ListUtil;
+
+import java.io.Serializable;
+import java.util.ArrayList;
 
 /**
  * Created by realicing on 2018/6/28.
  * realicing@sina.com
  */
-public class FindApp implements IDownload {
+public class Applications implements IDownload, Serializable {
     private int updated_at;
 
     private float score;//评分
@@ -64,11 +71,16 @@ public class FindApp implements IDownload {
 
     private String game_tag;
 
+    private String ext_detail;
+
     private int sort;
 
     private int IsPlay;
 
     private int IsHot;
+    //总评论数
+    private int comment_num;
+
     public int getAvailable_receive() {
         return available_receive;
     }
@@ -85,118 +97,155 @@ public class FindApp implements IDownload {
         this.receive_account = receive_account;
     }
 
-    public void setUpdated_at(int updated_at){
+    public void setUpdated_at(int updated_at) {
         this.updated_at = updated_at;
     }
-    public int getUpdated_at(){
+
+    public int getUpdated_at() {
         return this.updated_at;
     }
-    public void setScore(float score){
+
+    public void setScore(float score) {
         this.score = score;
     }
-    public float getScore(){
+
+    public float getScore() {
         return this.score;
     }
-    public void setDownload_url(String download_url){
+
+    public void setDownload_url(String download_url) {
         this.download_url = download_url;
     }
-    public String getDownload_url(){
+
+    public String getDownload_url() {
         return this.download_url;
     }
-    public void setPackage_size(String package_size){
+
+    public void setPackage_size(String package_size) {
         this.package_size = package_size;
     }
-    public String getPackage_size(){
+
+    public String getPackage_size() {
         return this.package_size;
     }
-    public void setId(int Id){
+
+    public void setId(int Id) {
         this.Id = Id;
     }
-    public int getId(){
+
+    public int getId() {
         return this.Id;
     }
-    public void setVersions(String versions){
+
+    public void setVersions(String versions) {
         this.versions = versions;
     }
-    public String getVersions(){
+
+    public String getVersions() {
         return this.versions;
     }
-    public void setPictures(String pictures){
+
+    public void setPictures(String pictures) {
         this.pictures = pictures;
     }
-    public String getPictures(){
+
+    public String getPictures() {
         return this.pictures;
     }
-    public void setPackage_name(String package_name){
+
+    public void setPackage_name(String package_name) {
         this.package_name = package_name;
     }
-    public String getPackage_name(){
+
+    public String getPackage_name() {
         return this.package_name;
     }
-    public void setPlatform(int platform){
+
+    public void setPlatform(int platform) {
         this.platform = platform;
     }
-    public int getPlatform(){
+
+    public int getPlatform() {
         return this.platform;
     }
-    public void setStatus(int status){
+
+    public void setStatus(int status) {
         this.status = status;
     }
-    public int getStatus(){
+
+    public int getStatus() {
         return this.status;
     }
-    public void setIcon(String icon){
+
+    public void setIcon(String icon) {
         this.icon = icon;
     }
-    public String getIcon(){
+
+    public String getIcon() {
         return this.icon;
     }
-    public void setName(String name){
+
+    public void setName(String name) {
         this.name = name;
     }
-    public String getName(){
+
+    public String getName() {
         return this.name;
     }
-    public void setCreated_at(int created_at){
+
+    public void setCreated_at(int created_at) {
         this.created_at = created_at;
     }
-    public int getCreated_at(){
+
+    public int getCreated_at() {
         return this.created_at;
     }
-    public void setIntro(String intro){
+
+    public void setIntro(String intro) {
         this.intro = intro;
     }
-    public String getIntro(){
+
+    public String getIntro() {
         return this.intro;
     }
-    public void setDownload_at(int download_at){
+
+    public void setDownload_at(int download_at) {
         this.download_at = download_at;
     }
-    public int getDownload_at(){
+
+    public int getDownload_at() {
         return this.download_at;
     }
-    public void setManufacturer(String manufacturer){
+
+    public void setManufacturer(String manufacturer) {
         this.manufacturer = manufacturer;
     }
-    public String getManufacturer(){
+
+    public String getManufacturer() {
         return this.manufacturer;
     }
-    public void setScore_count(int score_count){
+
+    public void setScore_count(int score_count) {
         this.score_count = score_count;
     }
-    public int getScore_count(){
+
+    public int getScore_count() {
         return this.score_count;
     }
-    public void setDownload_type(int download_type){
+
+    public void setDownload_type(int download_type) {
         this.download_type = download_type;
     }
-    public int getDownload_type(){
+
+    public int getDownload_type() {
         return this.download_type;
     }
-    public void setDownload_count(int download_count){
+
+    public void setDownload_count(int download_count) {
         this.download_count = download_count;
     }
-    public int getDownload_count(){
+
+    public int getDownload_count() {
         return this.download_count;
     }
 
@@ -216,70 +265,93 @@ public class FindApp implements IDownload {
         this.record = record;
     }
 
-    public void setType(String type){
+    public void setType(String type) {
         this.type = type;
     }
-    public String getType(){
+
+    public String getType() {
         return this.type;
     }
-    public void setPackage_id(String package_id){
+
+    public void setPackage_id(String package_id) {
         this.package_id = package_id;
     }
-    public String getPackage_id(){
+
+    public String getPackage_id() {
         return this.package_id;
     }
-    public void setPackage_type(int package_type){
+
+    public void setPackage_type(int package_type) {
         this.package_type = package_type;
     }
-    public int getPackage_type(){
+
+    public int getPackage_type() {
         return this.package_type;
     }
-    public void setDownload_count_increment(int download_count_increment){
+
+    public void setDownload_count_increment(int download_count_increment) {
         this.download_count_increment = download_count_increment;
     }
-    public int getDownload_count_increment(){
+
+    public int getDownload_count_increment() {
         return this.download_count_increment;
     }
-    public void setIs_recommend(int is_recommend){
+
+    public void setIs_recommend(int is_recommend) {
         this.is_recommend = is_recommend;
     }
-    public int getIs_recommend(){
+
+    public int getIs_recommend() {
         return this.is_recommend;
     }
-    public void setGame_tag(String game_tag){
+
+    public void setGame_tag(String game_tag) {
         this.game_tag = game_tag;
     }
-    public String getGame_tag(){
+
+    public String getGame_tag() {
         return this.game_tag;
     }
-    public void setSort(int sort){
+
+    public void setSort(int sort) {
         this.sort = sort;
     }
-    public int getSort(){
+
+    public int getSort() {
         return this.sort;
     }
-    public void setIsPlay(int IsPlay){
+
+    public void setIsPlay(int IsPlay) {
         this.IsPlay = IsPlay;
     }
-    public int getIsPlay(){
+
+    public int getIsPlay() {
         return this.IsPlay;
     }
-    public void setIsHot(int IsHot){
+
+    public void setIsHot(int IsHot) {
         this.IsHot = IsHot;
     }
-    public int getIsHot(){
+
+    public int getIsHot() {
         return this.IsHot;
     }
 
+    public void setComment_num(int comment_num) {
+        this.comment_num = comment_num;
+    }
 
+    public int getComment_num() {
+        return comment_num;
+    }
 
+    public String getExt_detail() {
+        return ext_detail;
+    }
 
-
-
-
-
-
-
+    public void setExt_detail(String ext_detail) {
+        this.ext_detail = ext_detail;
+    }
 
     @Override
     public String getPackage_names() {
@@ -307,23 +379,18 @@ public class FindApp implements IDownload {
     }
 
 
-
-
-
-
-
-
-
     /**
      * 是否可以下载
+     *
      * @return
      */
-    public boolean isCanDownload(){
+    public boolean isCanDownload() {
         return download == 1;//可以下载
     }
 
     /**
      * 是否可以记录
+     *
      * @return
      */
     public boolean isCanRecord() {
@@ -338,9 +405,28 @@ public class FindApp implements IDownload {
 
     /**
      * 更新下载状态
+     *
      * @param status
      */
     public void updateState(int status) {
         findAppHelper.updateState(status);
     }
+
+
+    public DownloadHelper getDownloadHelper() {
+        return findAppHelper.getDownloadHelper();
+    }
+
+
+    public void updateStateRelease(int status) {
+        findAppHelper.getDownloadHelper().updateState(status);
+    }
+
+    //从game_tag中获取tagList
+    public ArrayList<String> getTagList() {
+        if (!TextUtils.isEmpty(game_tag)) {
+            return ListUtil.asList(game_tag.split(","));
+        }
+        return ListUtil.emptyList();
+    }
 }

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

@@ -12,10 +12,10 @@ import java.util.List;
  * realicing@sina.com
  *
  */
-public class FindItem {
+public class Article {
     private int updated_at;
 
-    private List<FindTag> tages ;
+    private List<ArticleTag> tages ;
 
     private int recommend_type;//咨询类型1:游戏 2:任务
 
@@ -52,7 +52,7 @@ public class FindItem {
 
     private int type;//类型 1:游戏 2:咨询 3:转跳 4:任务 5:栏目
 
-    private FindApp application;
+    private Applications application;
 
     public void setUpdated_at(int updated_at){
         this.updated_at = updated_at;
@@ -60,10 +60,10 @@ public class FindItem {
     public int getUpdated_at(){
         return this.updated_at;
     }
-    public void setTages(List<FindTag> tages){
+    public void setTages(List<ArticleTag> tages){
         this.tages = tages;
     }
-    public List<FindTag> getTages(){
+    public List<ArticleTag> getTages(){
         return this.tages;
     }
     public void setRecommend_type(int recommend_type){
@@ -169,18 +169,18 @@ public class FindItem {
         return this.type;
     }
 
-    public FindApp getApplication() {
+    public Applications getApplication() {
         return application;
     }
 
-    public void setApplication(FindApp application) {
+    public void setApplication(Applications application) {
         this.application = application;
     }
 
 
     @Override
     public boolean equals(Object obj) {
-        return obj instanceof FindItem && ((FindItem) obj).getId() == id;
+        return obj instanceof Article && ((Article) obj).getId() == id;
     }
 
     //是否是游戏,游戏要显示下载游戏与评分
@@ -190,10 +190,10 @@ public class FindItem {
 
     //清除空的或者没有名字的标签
     public void removeNullTag() {
-        ListUtil.removeItem(tages, new ListUtil.CallBack<FindTag, Boolean>(){
+        ListUtil.removeItem(tages, new ListUtil.CallBack<ArticleTag, Boolean>(){
 
             @Override
-            public Boolean call(FindTag findTag) {
+            public Boolean call(ArticleTag findTag) {
                 return findTag == null || TextUtils.isEmpty(findTag.getName());
             }
         });

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/FindTag.java

@@ -4,7 +4,7 @@ package com.sheep.gamegroup.model.entity;
  * Created by realicing on 2018/6/27.
  * realicing@sina.com
  */
-public class FindTag {
+public class ArticleTag {
 
     private int updated_at;
 
@@ -18,10 +18,10 @@ public class FindTag {
 
     private int created_at;
 
-    public FindTag() {
+    public ArticleTag() {
     }
 
-    public FindTag(int id, String name) {
+    public ArticleTag(int id, String name) {
         this.id = id;
         this.name = name;
     }

+ 21 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/BaseMessage.java

@@ -84,6 +84,27 @@ public class BaseMessage implements Serializable{
         }
         return null;
     }
+    /**
+     * 失败返回null
+     *
+     * @param clazz
+     * @param <T>
+     * @return
+     */
+    public <T> T getData(Class<T> clazz, T defaultValue) {
+        if (data != null) {
+            T t = null;
+            try {
+                t = JSONObject.parseObject(JSONObject.toJSONString(data), clazz);
+            } catch (Exception e) {
+                e.printStackTrace();
+            }
+            if(t == null){
+                return defaultValue;
+            }
+        }
+        return defaultValue;
+    }
 
     /**
      * 如果data里是数组,直接这样获取

+ 6 - 7
app/src/main/java/com/sheep/gamegroup/model/entity/CommendApp.java

@@ -1,7 +1,6 @@
 package com.sheep.gamegroup.model.entity;
 
 import android.support.annotation.IntDef;
-import android.support.annotation.StringDef;
 
 import com.sheep.gamegroup.util.ListUtil;
 
@@ -15,13 +14,13 @@ import java.util.List;
  */
 public class CommendApp {
 
-    private FindApp app;
+    private Applications app;
 
     private int order;
 
     private boolean need;
 
-    private TaskReleaseEty release_task;
+    private Release_task release_task;
 
     private int accepted_task_id;
 
@@ -31,11 +30,11 @@ public class CommendApp {
 
     private List<GiftBagApp> has_gift_bag;
 
-    public void setApp(FindApp app) {
+    public void setApp(Applications app) {
         this.app = app;
     }
 
-    public FindApp getApp() {
+    public Applications getApp() {
         return this.app;
     }
 
@@ -55,11 +54,11 @@ public class CommendApp {
         return this.need;
     }
 
-    public void setRelease_task(TaskReleaseEty release_task) {
+    public void setRelease_task(Release_task release_task) {
         this.release_task = release_task;
     }
 
-    public TaskReleaseEty getRelease_task() {
+    public Release_task getRelease_task() {
         return this.release_task;
     }
 

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/CreditCardProgressQuery.java

@@ -24,7 +24,7 @@ public class CreditCardProgressQuery {
     private int update_time;
 
     private int create_time;
-    private TaskReleaseEty release_task;
+    private Release_task release_task;
 
     public void setRemarks(String remarks){
         this.remarks = remarks;
@@ -87,11 +87,11 @@ public class CreditCardProgressQuery {
         return this.create_time;
     }
 
-    public TaskReleaseEty getRelease_task() {
+    public Release_task getRelease_task() {
         return release_task;
     }
 
-    public void setRelease_task(TaskReleaseEty release_task) {
+    public void setRelease_task(Release_task release_task) {
         this.release_task = release_task;
     }
 }

+ 31 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/Entry.java

@@ -0,0 +1,31 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ */
+public class Entry<K, V> {
+    public Entry(K k, V v) {
+        this.k = k;
+        this.v = v;
+    }
+
+    private K k;
+    private V v;
+
+    public K getK() {
+        return k;
+    }
+
+    public void setK(K k) {
+        this.k = k;
+    }
+
+    public V getV() {
+        return v;
+    }
+
+    public void setV(V v) {
+        this.v = v;
+    }
+}

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/FindAppReservation.java

@@ -13,7 +13,7 @@ public class FindAppReservation {
 
     private int ApplicationId;
 
-    private FindApp application;
+    private Applications application;
 
     private int Id;
 
@@ -45,10 +45,10 @@ public class FindAppReservation {
     public int getApplicationId(){
         return this.ApplicationId;
     }
-    public void setApplication(FindApp application){
+    public void setApplication(Applications application){
         this.application = application;
     }
-    public FindApp getApplication(){
+    public Applications getApplication(){
         return this.application;
     }
     public void setId(int Id){

+ 12 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/FindAppScore.java

@@ -4,9 +4,10 @@ package com.sheep.gamegroup.model.entity;
  * Created by realicing on 2018/6/29.
  * realicing@sina.com
  */
-public class FindAppScore {
-    private int star;
-    private int num;
+public class GameAppScore {
+    private int star;//几个星
+    private int num;//有多少人评
+    private int max;//总共有多少人评
 
     public int getStar() {
         return star;
@@ -23,4 +24,12 @@ public class FindAppScore {
     public void setNum(int num) {
         this.num = num;
     }
+
+    public int getMax() {
+        return max;
+    }
+
+    public void setMax(int max) {
+        this.max = max;
+    }
 }

+ 67 - 19
app/src/main/java/com/sheep/gamegroup/model/entity/GameEntity.java

@@ -1,9 +1,10 @@
 package com.sheep.gamegroup.model.entity;
 
 import android.text.TextUtils;
-import android.widget.TextView;
 
 import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.helper.DownloadHelper;
+import com.sheep.gamegroup.model.api.IDownload;
 
 import java.io.Serializable;
 import java.util.List;
@@ -12,10 +13,10 @@ import java.util.List;
  * Created by ljy on 2018/9/4.
  */
 
-public class GameEntity implements Serializable{
+public class GameEntity implements Serializable {
     private int accepted_task_id;//integer($int64)领取福利时使用
 
-    private PlayGameEntity app;
+    private Applications app;
     private boolean can_download;//boolean
     private int is_reservation;//integer($int64)0 不是 1是预约
 
@@ -25,15 +26,18 @@ public class GameEntity implements Serializable{
 
     private int status;//integer($int64)福利任务时使用,和任务记录一样
 
-    private TaskReleaseEty release_task;
+    private Release_task release_task;
 
     private List<GiftBagApp> has_gift_bag;
 
-    public TaskReleaseEty getRelease_task() {
+    //    IsFocusGame bool                `json:"is_focus_game" description:"是否关注游戏"`
+    private boolean is_focus_game;//是否已经关注了游戏
+
+    public Release_task getRelease_task() {
         return release_task;
     }
 
-    public void setRelease_task(TaskReleaseEty release_task) {
+    public void setRelease_task(Release_task release_task) {
         this.release_task = release_task;
     }
 
@@ -53,11 +57,11 @@ public class GameEntity implements Serializable{
         this.accepted_task_id = accepted_task_id;
     }
 
-    public PlayGameEntity getApp() {
+    public Applications getApp() {
         return app;
     }
 
-    public void setApp(PlayGameEntity app) {
+    public void setApp(Applications app) {
         this.app = app;
     }
 
@@ -101,28 +105,38 @@ public class GameEntity implements Serializable{
         this.status = status;
     }
 
+    public boolean isIs_focus_game() {
+        return is_focus_game;
+    }
+
+    public void setIs_focus_game(boolean is_focus_game) {
+        this.is_focus_game = is_focus_game;
+    }
 
     @Override
     public boolean equals(Object obj) {
         return obj instanceof GameEntity && (((release_task != null && release_task.equals(((GameEntity) obj).release_task))
-         || (app != null && app.equals(((GameEntity) obj).app))));
+                || (app != null && app.equals(((GameEntity) obj).app))));
     }
 
     /**
-     * 是有有礼包
+     * 是否有礼包
+     *
      * @return
      */
-    public boolean isGift(){
+    public boolean isGift() {
         return has_gift_bag != null && has_gift_bag.size() > 0;
     }
+
     /**
      * 获取奖金的文本表示(这里保留两位有效数字,因为服务器可能返回这样的结果:0.6000000238418579)
+     *
      * @return
      */
-    public String getBonusText(){
-        if(release_task != null){
+    public String getBonusText() {
+        if (release_task != null) {
             return NumberFormatUtils.retainMost2(release_task.getBonus());
-        }else {
+        } else {
             return null;
         }
     }
@@ -131,22 +145,22 @@ public class GameEntity implements Serializable{
      * 是否显示整个礼包和福利金额标签
      * trur:不显示
      */
-    public boolean isGiftAndBonus(){
+    public boolean isGiftAndBonus() {
         return !isGift() && TextUtils.isEmpty(getBonusText());
     }
 
     /**
      * 是否游戏任务
      */
-    public boolean isGameTask(){
+    public boolean isGameTask() {
         return release_task != null && release_task.getTask() != null;
     }
 
-    public String downLinks(){
+    public String downLinks() {
         try {
-            if(isGameTask()){
+            if (isGameTask()) {
                 return release_task.getTask().getDownload_link();
-            }else {
+            } else {
                 return app.getDownload_url();
             }
         } catch (Exception e) {
@@ -156,4 +170,38 @@ public class GameEntity implements Serializable{
 
     }
 
+    //根据包名获取下载地址
+    public String getDownloadUrl(String packageName) {
+        IDownload download = getDownload();
+        return download != null && TextUtils.equals(download.getPackage_names(), packageName) ? download.getDownload_link() : null;
+    }
+
+    public IDownload getDownload() {
+        try {
+            if (isGameTask()) {
+                return release_task.getTask();
+            }
+            if (app != null) {
+                return app;
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
+
+    //根据下载地址获取对应的downloadHelper
+    public DownloadHelper getDownloadHelper(String downloadUrl) {
+        try {
+            if (isGameTask() && TextUtils.equals(downloadUrl, release_task.getTask().getDownload_link())) {
+                return release_task.getDownloadHelper();
+            }
+            if (app != null && TextUtils.equals(downloadUrl, app.getDownload_link())) {
+                return app.getDownloadHelper();
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return null;
+    }
 }

+ 0 - 39
app/src/main/java/com/sheep/gamegroup/model/entity/GameEntityList.java

@@ -1,39 +0,0 @@
-package com.sheep.gamegroup.model.entity;
-
-import com.sheep.gamegroup.util.ListUtil;
-
-import java.util.List;
-/**
- * Created by realicing on 2018/10/30.
- * realicing@sina.com
- */
-public class GameEntityList{
-    private List<GameEntity> list;
-    private GameListType gameListType;
-    public GameEntityList(GameListType gameListType, List<GameEntity> list) {
-        this.gameListType = gameListType;
-        this.list = list;
-    }
-    public GameEntityList(List<GameEntity> list) {
-        this.list = list;
-    }
-
-    public GameListType getGameListType() {
-        return gameListType;
-    }
-
-    public List<GameEntity> getList() {
-        return list;
-    }
-
-    public void setList(List<GameEntity> list) {
-        this.list = list;
-    }
-    public void add(List<GameEntity> list){
-        if(this.list == null){
-            this.list = list;
-        } else {
-            ListUtil.addAll(this.list, list);
-        }
-    }
-}

+ 123 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameInfoList.java

@@ -0,0 +1,123 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.support.annotation.NonNull;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.TextView;
+
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ */
+public class GameInfoList implements Comparable<GameInfoList> {
+    public GameInfoList(String name, RecyclerView.Adapter adapter) {
+        this.name = name;
+        this.adapter = adapter;
+    }
+
+    public GameInfoList(String name, RecyclerView.Adapter adapter, View.OnClickListener onClickListener) {
+        this.name = name;
+        this.onClickListener = onClickListener;
+        this.adapter = adapter;
+    }
+
+    private int sort;
+
+    public int getSort() {
+        return sort;
+    }
+
+    public GameInfoList setSort(int sort) {
+        this.sort = sort;
+        return this;
+    }
+
+    private String name;
+    private View.OnClickListener onClickListener;
+    private RecyclerView.Adapter adapter;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+    public View.OnClickListener getOnClickListener() {
+        return onClickListener;
+    }
+
+    public void setOnClickListener(View.OnClickListener onClickListener) {
+        this.onClickListener = onClickListener;
+    }
+
+    public void setMoreViewOnClickListener(TextView textView) {
+        if (textView != null) {
+            if(onClickListener == null){
+                textView.setVisibility(View.INVISIBLE);
+            } else {
+                textView.setVisibility(View.VISIBLE);
+                textView.setOnClickListener(onClickListener);
+            }
+        }
+    }
+
+    public RecyclerView.Adapter getAdapter() {
+        return adapter;
+    }
+
+    //水平
+    public static final int LAYOUT_MANAGER_STYLE_VERTICAL = 0;
+    //垂直
+    public static final int LAYOUT_MANAGER_STYLE_HORIZONTAL = 1;
+    private int layoutManagerStyle = LAYOUT_MANAGER_STYLE_VERTICAL;
+    //设置水平滑动
+    public GameInfoList setHorizontal() {
+        layoutManagerStyle = LAYOUT_MANAGER_STYLE_HORIZONTAL;
+        return this;
+    }
+
+    public void setAdapter(RecyclerView.Adapter adapter) {
+        this.adapter = adapter;
+    }
+
+    public RecyclerView.LayoutManager getLayoutManager() {
+        switch (layoutManagerStyle){
+            case LAYOUT_MANAGER_STYLE_HORIZONTAL:
+                return new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+            case LAYOUT_MANAGER_STYLE_VERTICAL:
+            default:
+                return new LinearLayoutManager(SheepApp.getInstance());
+        }
+    }
+    private boolean showTopLine = true;//默认显示上面的线
+
+    public boolean isShowTopLine() {
+        return showTopLine;
+    }
+
+    public GameInfoList setShowTopLine(boolean showTopLine) {
+        this.showTopLine = showTopLine;
+        return this;
+    }
+
+    private boolean showBottomLine;
+
+    public boolean isShowBottomLine() {
+        return showBottomLine;
+    }
+
+    public GameInfoList setShowBottomLine(boolean showBottomLine) {
+        this.showBottomLine = showBottomLine;
+        return this;
+    }
+
+    @Override
+    public int compareTo(@NonNull GameInfoList gameInfoList) {
+        return sort - gameInfoList.getSort();
+    }
+}

+ 19 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/GameRecommend.java

@@ -1,5 +1,7 @@
 package com.sheep.gamegroup.model.entity;
 
+import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
+
 /**
  * Created by realicing on 2018/10/31.
  * realicing@sina.com
@@ -49,6 +51,7 @@ public class GameRecommend {
     private int EndTime;
 
     private int Status;
+    private int TagId;
 
     private int Order;
 
@@ -158,4 +161,20 @@ public class GameRecommend {
         return this.DisplayType;
     }
 
+    public int getTagId() {
+        return TagId;
+    }
+
+    public void setTagId(int tagId) {
+        TagId = tagId;
+    }
+
+
+
+    public GameListType getType() {
+        GameListType gameListType = new GameListType();
+        gameListType.setTag_id(TagId);
+        gameListType.setTitle(Title);
+        return gameListType;
+    }
 }

+ 3 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/GiftBagApp.java

@@ -8,7 +8,7 @@ public class GiftBagApp {
 
     private GiftBag gift_bag;
 
-    private FindApp app;
+    private Applications app;
 
     private String code;
 
@@ -28,10 +28,10 @@ public class GiftBagApp {
     public GiftBag getGift_bag(){
         return this.gift_bag;
     }
-    public void setApp(FindApp app){
+    public void setApp(Applications app){
         this.app = app;
     }
-    public FindApp getApp(){
+    public Applications getApp(){
         return this.app;
     }
     public void setCode(String code){

+ 4 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/HomeListEntity.java

@@ -2,12 +2,15 @@ package com.sheep.gamegroup.model.entity;
 
 import android.text.TextUtils;
 
+import com.sheep.gamegroup.absBase.IJump;
+import com.sheep.gamegroup.absBase.ITag;
+
 /**
  * 首页list
  * Created by ljy on 2018/5/10.
  */
 
-public class HomeListEntity {
+public class HomeListEntity implements IJump, ITag {
     private String CreateTime;//	integer ($int64)创建时间,时间戳
     private String Desc;//	string描述
     private String Icon;//	string图标地址

+ 81 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/HomePageSearch.java

@@ -0,0 +1,81 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.sheep.gamegroup.absBase.IHomePageSearch;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ * 搜索结果
+ * <p>
+ * content:	string 内容
+ * link_id:	integer ($int64) 关联id
+ * link_type:	integer ($int64) 关联类型 1任务 2游戏
+ * icon:	string 图标
+ * title:	string 标题
+ * bonus:	string 任务奖金
+ */
+public class HomePageSearch implements IHomePageSearch {
+    private String content;
+    private String title;
+    private String bonus;
+    private String icon;
+    private int link_id;
+    private int link_type;
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getTitle() {
+        return title;
+    }
+
+    public void setTitle(String title) {
+        this.title = title;
+    }
+
+    public int getLink_id() {
+        return link_id;
+    }
+
+    public void setLink_id(int link_id) {
+        this.link_id = link_id;
+    }
+
+    public int getLink_type() {
+        return link_type;
+    }
+
+    public void setLink_type(int link_type) {
+        this.link_type = link_type;
+    }
+
+    public String getBonus() {
+        return bonus;
+    }
+
+    public void setBonus(String bonus) {
+        this.bonus = bonus;
+    }
+
+    public String getIcon() {
+        return icon;
+    }
+
+    public void setIcon(String icon) {
+        this.icon = icon;
+    }
+
+    //该类型是否有奖金
+    public boolean hasBonus() {
+        switch (link_type){
+            case IHomePageSearch.LINK_TYPE_RELEASE_TASK://任务有奖金
+                return true;
+        }
+        return false;
+    }
+}

+ 29 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/InputAndUrlList.java

@@ -0,0 +1,29 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.sheep.gamegroup.view.activity.TaskDetailAct;
+
+import java.io.Serializable;
+import java.util.ArrayList;
+
+/**
+ * Created by realicing on 2018/11/12.
+ * realicing@sina.com
+ * 自定义字段与图片列表
+ */
+public class InputAndUrlList implements Serializable {
+    private String input;
+    private ArrayList<String> list = new ArrayList<>(TaskDetailAct.DEFAULT_MAX_COUNT);
+
+    public String getInput() {
+        return input;
+    }
+
+    public void setInput(String input) {
+        this.input = input;
+    }
+
+    public ArrayList<String> getList() {
+        return list;
+    }
+
+}

+ 28 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/LatelyGame.java

@@ -0,0 +1,28 @@
+package com.sheep.gamegroup.model.entity;
+
+import java.util.List;
+
+/**
+ * Created by realicing on 2018/11/5.
+ * realicing@sina.com
+ */
+public class LatelyGame {
+    private List<Applications> lately;
+    private List<Applications> same;
+
+    public List<Applications> getLately() {
+        return lately;
+    }
+
+    public void setLately(List<Applications> lately) {
+        this.lately = lately;
+    }
+
+    public List<Applications> getSame() {
+        return same;
+    }
+
+    public void setSame(List<Applications> same) {
+        this.same = same;
+    }
+}

+ 7 - 6
app/src/main/java/com/sheep/gamegroup/model/entity/GameListTypeList.java

@@ -6,16 +6,17 @@ import java.util.List;
  * Created by realicing on 2018/10/30.
  * realicing@sina.com
  */
-public class GameListTypeList<T> {
+public class ListTypeList<T, TYPE> {
     private List<T> list;
-    private GameListType gameListType;
-    public GameListTypeList(GameListType gameListType, List<T> list) {
-        this.gameListType = gameListType;
+    private TYPE type;
+
+    public ListTypeList(TYPE type, List<T> list) {
+        this.type = type;
         this.list = list;
     }
 
-    public GameListType getGameListType() {
-        return gameListType;
+    public TYPE getType() {
+        return type;
     }
 
     public List<T> getList() {

+ 83 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/Lp.java

@@ -0,0 +1,83 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/11/13.
+ * realicing@sina.com
+ * 配置layoutParams,配置LayoutParamsUtil使用
+ */
+public class Lp {
+    //不用设置标识
+    public static final int NONE = -101;
+    private int leftMargin = NONE;
+    private int rightMargin = NONE;
+    private int topMargin = NONE;
+    private int bottomMargin = NONE;
+    private int width = NONE;
+    private int height = NONE;
+    private float per = 1.0f;
+
+    public Lp() {
+    }
+
+    public Lp(float per) {
+        this.per = per;
+    }
+
+    public static int getNONE() {
+        return NONE;
+    }
+
+    public int getLeftMargin() {
+        return leftMargin;
+    }
+
+    public Lp setLeftMargin(int leftMargin) {
+        this.leftMargin = (int) (leftMargin * per);
+        return this;
+    }
+
+    public int getRightMargin() {
+        return rightMargin;
+    }
+
+    public Lp setRightMargin(int rightMargin) {
+        this.rightMargin = (int) (rightMargin * per);
+        return this;
+    }
+
+    public int getTopMargin() {
+        return topMargin;
+    }
+
+    public Lp setTopMargin(int topMargin) {
+        this.topMargin = (int) (topMargin * per);
+        return this;
+    }
+
+    public int getBottomMargin() {
+        return bottomMargin;
+    }
+
+    public Lp setBottomMargin(int bottomMargin) {
+        this.bottomMargin = (int) (bottomMargin * per);
+        return this;
+    }
+
+    public int getWidth() {
+        return width;
+    }
+
+    public Lp setWidth(int width) {
+        this.width = (int) (width * per);
+        return this;
+    }
+
+    public int getHeight() {
+        return height;
+    }
+
+    public Lp setHeight(int height) {
+        this.height = (int) (height * per);
+        return this;
+    }
+}

+ 145 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/NoviceGuidance.java

@@ -0,0 +1,145 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.text.TextUtils;
+
+import com.lqr.emoji.EmotionLayout;
+import com.sheep.gamegroup.absBase.IContentTypeContainer;
+import com.sheep.gamegroup.util.StringUtils;
+
+/**
+ * Created by realicing on 2018/11/9.
+ * realicing@sina.com
+ * 新手引导
+ * <p>
+ * content:	string
+ * 内容
+ * created_at:	integer ($int64)
+ * 创建时间
+ * id:	integer ($int64)
+ * ID
+ * platform:	integer ($int32)
+ * 平台(0全平台,1安卓,2苹果)
+ * title:	string
+ * 标题
+ * type:	integer ($int32)
+ * 类型(1文字,2视频)
+ * updated_at:	integer ($int64)
+ * 更新时间
+ * video_url:	string
+ * 视频地址
+ */
+public class NoviceGuidance implements IContentTypeContainer<Integer, String> {
+    private String content;
+
+    private int created_at;
+
+    private int id;
+
+    private int platform;
+
+    private String title;
+
+    private int type;
+
+    private int updated_at;
+
+    private String video_url;
+    private String pre_url;
+
+    private String image_url;
+
+    public void setContent(String content){
+        this.content = content;
+        contentType = StringUtils.initContentType(content);
+    }
+
+    public String getContent(){
+        return this.content;
+    }
+    public void setCreated_at(int created_at){
+        this.created_at = created_at;
+    }
+    public int getCreated_at(){
+        return this.created_at;
+    }
+    public void setId(int id){
+        this.id = id;
+    }
+    public int getId(){
+        return this.id;
+    }
+    public void setPlatform(int platform){
+        this.platform = platform;
+    }
+    public int getPlatform(){
+        return this.platform;
+    }
+    public void setTitle(String title){
+        this.title = title;
+    }
+    public String getTitle(){
+        return this.title;
+    }
+    public void setType(int type){
+        this.type = type;
+    }
+    public int getType(){
+        return this.type;
+    }
+    public void setUpdated_at(int updated_at){
+        this.updated_at = updated_at;
+    }
+    public int getUpdated_at(){
+        return this.updated_at;
+    }
+    public void setVideo_url(String video_url){
+        this.video_url = video_url;
+    }
+    public String getVideo_url(){
+        return this.video_url;
+    }
+
+    public String getImage_url() {
+        return image_url;
+    }
+
+    public void setImage_url(String image_url) {
+        this.image_url = image_url;
+    }
+
+    public String getPre_url() {
+        return pre_url;
+    }
+
+    public void setPre_url(String pre_url) {
+        this.pre_url = pre_url;
+    }
+
+    //    //默认类型,服务器数据无此类型,只作为客户端自己直接添加使用,只包含内容
+//    public static final int TYPE_MSG = 0;
+//    //标题与文本
+//    public static final int TYPE_CONTENT = 1;
+//    //标题与文本与视频
+//    public static final int TYPE_VIDEO = 2;
+//    //标题与文本与图片
+//    public static final int TYPE_VIDEO = 3;
+
+    //content的类型
+    private int contentType;
+
+    public Integer getContentType() {
+        return contentType;
+    }
+
+    private String contentResult;
+    @Override
+    public String getContentResult() {
+        switch (contentType){
+            case StringUtils.CONTENT_TYPE_EXP:
+                if(contentResult == null)
+                    contentResult = EmotionLayout.changeContent(content);
+                return contentResult;
+        }
+        return content;
+    }
+}

+ 0 - 398
app/src/main/java/com/sheep/gamegroup/model/entity/PlayGameEntity.java

@@ -1,398 +0,0 @@
-package com.sheep.gamegroup.model.entity;
-
-import android.text.TextUtils;
-
-import com.sheep.gamegroup.helper.DownloadHelper;
-import com.sheep.gamegroup.helper.FindAppHelper;
-import com.sheep.gamegroup.model.api.IDownload;
-
-import java.io.Serializable;
-
-/**
- * 玩转游戏
- * Created by ljy on 2018/9/3.
- */
-
-public class PlayGameEntity implements IDownload, Serializable {
-    private int Id;//integer($int64)
-    private int IsHot;//integer($int64)是否近期最热 1是 2不是
-
-    private int IsPlay;//integer($int64)是否每日必玩 1是 2不是
-
-    private int available_receive;//integer($int64)0:可领取账号 1:不可领取账号
-
-    private long created_at;//integer($int64)
-    private int download;//integer($int64)1:可下载 其他:不可下载
-
-    private long download_at;//integer($int64)预约下载开放时间
-
-    private long download_count;//integer($int64)下载数量
-
-    private long download_count_increment;//integer($int64)下载数量的增量
-
-    private int download_type;//integer($int32)1:非预约下载 2:预约下载
-
-    private String download_url;//string下载地址
-
-    private String icon;//string应用图标
-
-    private String intro;//string应用简介
-
-    private int is_recommend;//integer($int32)是否推荐:0:不推荐 1:推荐
-
-    private String manufacturer;//string厂商
-
-    private String name;//string应用名称
-
-    private String package_id;//stringGameID
-
-    private String package_name;//string应用包名称
-
-    private String package_size;//number($float)包大小(M)
-
-    private int package_type;//integer($int64)出包类型:1:快发出包 2:腾讯出包 3:小米出包 4:其它
-
-    private String pictures;//string宣传图标(分号隔开)
-
-    private int platform;//integer($int32)平台 0:全 1:安卓 2:IOS
-
-    private int receive_account;//integer($int64)0:未领取账号 1:已领取账号
-
-    private int record;//integer($int64)1:可记录 其他:不可记录
-
-    private float score;//number($float)评分
-
-    private long score_count;//integer($int64)评分人数
-
-    private int sort;//integer($int64)排序:越大越靠前
-
-    private int status;//integer($int32)1:开启 2:关闭
-
-    private String type;//string类型
-
-    private long updated_at;//integer($int64)
-    private String versions;//string版本号
-
-    private String game_tag;//游戏标签,可多选,逗号分割
-
-    public String getGame_tag() {
-        return game_tag;
-    }
-
-    public void setGame_tag(String game_tag) {
-        this.game_tag = game_tag;
-    }
-
-    public int getId() {
-        return Id;
-    }
-
-    public void setId(int id) {
-        Id = id;
-    }
-
-    public int getIsHot() {
-        return IsHot;
-    }
-
-    public void setIsHot(int isHot) {
-        IsHot = isHot;
-    }
-
-    public int getIsPlay() {
-        return IsPlay;
-    }
-
-    public void setIsPlay(int isPlay) {
-        IsPlay = isPlay;
-    }
-
-    public int getAvailable_receive() {
-        return available_receive;
-    }
-
-    public void setAvailable_receive(int available_receive) {
-        this.available_receive = available_receive;
-    }
-
-    public long getCreated_at() {
-        return created_at;
-    }
-
-    public void setCreated_at(long created_at) {
-        this.created_at = created_at;
-    }
-
-    public int getDownload() {
-        return download;
-    }
-
-    public void setDownload(int download) {
-        this.download = download;
-    }
-
-    public long getDownload_at() {
-        return download_at;
-    }
-
-    public void setDownload_at(long download_at) {
-        this.download_at = download_at;
-    }
-
-    public long getDownload_count() {
-        return download_count;
-    }
-
-    public void setDownload_count(long download_count) {
-        this.download_count = download_count;
-    }
-
-    public long getDownload_count_increment() {
-        return download_count_increment;
-    }
-
-    public void setDownload_count_increment(long download_count_increment) {
-        this.download_count_increment = download_count_increment;
-    }
-
-    public int getDownload_type() {
-        return download_type;
-    }
-
-    public void setDownload_type(int download_type) {
-        this.download_type = download_type;
-    }
-
-    public String getDownload_url() {
-        return download_url;
-    }
-
-    public void setDownload_url(String download_url) {
-        this.download_url = download_url;
-    }
-
-
-    @Override
-    public boolean equals(Object obj) {
-        return obj instanceof PlayGameEntity && Id == ((PlayGameEntity) obj).Id;
-    }
-
-    @Override
-    public String getPackage_names() {
-        return package_name;
-    }
-
-    @Override
-    public int getTask_type() {
-        return 0;
-    }
-
-    @Override
-    public String getDownload_link() {
-        return download_url;
-    }
-
-    @Override
-    public String getTask_name() {
-        return name;
-    }
-
-    public String getIcon() {
-        return icon;
-    }
-
-    public void setIcon(String icon) {
-        this.icon = icon;
-    }
-
-    public String getIntro() {
-        return intro;
-    }
-
-    public void setIntro(String intro) {
-        this.intro = intro;
-    }
-
-    public int getIs_recommend() {
-        return is_recommend;
-    }
-
-    public void setIs_recommend(int is_recommend) {
-        this.is_recommend = is_recommend;
-    }
-
-    public String getManufacturer() {
-        return manufacturer;
-    }
-
-    public void setManufacturer(String manufacturer) {
-        this.manufacturer = manufacturer;
-    }
-
-    public String getName() {
-        return name;
-    }
-
-    public void setName(String name) {
-        this.name = name;
-    }
-
-    public String getPackage_id() {
-        return package_id;
-    }
-
-    public void setPackage_id(String package_id) {
-        this.package_id = package_id;
-    }
-
-    public String getPackage_name() {
-        return package_name;
-    }
-
-    public void setPackage_name(String package_name) {
-        this.package_name = package_name;
-    }
-
-    public String getPackage_size() {
-        return TextUtils.isEmpty(package_size)?"0":package_size;
-    }
-
-    @Override
-    public int getAcceptedTaskId() {
-        return Id;
-    }
-
-    public void setPackage_size(String package_size) {
-        this.package_size = package_size;
-    }
-
-    public int getPackage_type() {
-        return package_type;
-    }
-
-    public void setPackage_type(int package_type) {
-        this.package_type = package_type;
-    }
-
-    public String getPictures() {
-        return pictures;
-    }
-
-    public void setPictures(String pictures) {
-        this.pictures = pictures;
-    }
-
-    public int getPlatform() {
-        return platform;
-    }
-
-    public void setPlatform(int platform) {
-        this.platform = platform;
-    }
-
-    public int getReceive_account() {
-        return receive_account;
-    }
-
-    public void setReceive_account(int receive_account) {
-        this.receive_account = receive_account;
-    }
-
-    public int getRecord() {
-        return record;
-    }
-
-    public void setRecord(int record) {
-        this.record = record;
-    }
-
-    public float getScore() {
-        return score;
-    }
-
-    public void setScore(float score) {
-        this.score = score;
-    }
-
-    public long getScore_count() {
-        return score_count;
-    }
-
-    public void setScore_count(long score_count) {
-        this.score_count = score_count;
-    }
-
-    public int getSort() {
-        return sort;
-    }
-
-    public void setSort(int sort) {
-        this.sort = sort;
-    }
-
-    public int getStatus() {
-        return status;
-    }
-
-    public void setStatus(int status) {
-        this.status = status;
-    }
-
-    public String getType() {
-        return type;
-    }
-
-    public void setType(String type) {
-        this.type = type;
-    }
-
-    public long getUpdated_at() {
-        return updated_at;
-    }
-
-    public void setUpdated_at(long updated_at) {
-        this.updated_at = updated_at;
-    }
-
-    public String getVersions() {
-        return versions;
-    }
-
-    public void setVersions(String versions) {
-        this.versions = versions;
-    }
-    /**
-     * 是否可以下载
-     * @return
-     */
-    public boolean isCanDownload(){
-        return download == 1;//可以下载
-    }
-    /**
-     * 是否可以记录
-     * @return
-     */
-    public boolean isCanRecord() {
-        return record == 1;//1:可记录 其他:不可记录
-    }
-    private FindAppHelper findAppHelper = new FindAppHelper();
-    private DownloadHelper downloadHelper = new DownloadHelper();
-
-    public FindAppHelper getFindAppHelper() {
-        return findAppHelper;
-    }
-    public DownloadHelper getDownloadHelper() {
-        return downloadHelper;
-    }
-
-    /**
-     * 更新下载状态
-     * @param status
-     */
-    public void updateState(int status) {
-        findAppHelper.updateState(status);
-    }
-    public void updateStateRelease(int status) {
-        downloadHelper.updateState(status);
-    }
-}

+ 24 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/RechargeLogEntity.java

@@ -1,5 +1,11 @@
 package com.sheep.gamegroup.model.entity;//
 
+import android.text.TextUtils;
+
+import com.sheep.gamegroup.util.LogUtil;
+import com.sheep.gamegroup.util.TimeUtil;
+
+import java.util.Calendar;
 import java.util.Locale;
 
 /**
@@ -177,4 +183,22 @@ public class RechargeLogEntity implements ILog {
     public boolean getSelect() {
         return isSelect();
     }
+
+
+
+
+
+    //今日的数据
+    public boolean isToday() {
+        String format = "yyyyMMdd";
+        String dateMsg = TimeUtil.TimeStamp2Date(create_time, format);
+        String todayDateMsg = TimeUtil.TimeStamp2Date(System.currentTimeMillis(), format);
+//        LogUtil.println("isToday", dateMsg, todayDateMsg);
+        return TextUtils.equals(dateMsg, todayDateMsg);
+    }
+
+    //空数据
+    public boolean isNull() {
+        return id == 0;
+    }
 }

+ 2 - 2
app/src/main/java/com/sheep/gamegroup/model/entity/TaskReleaseEty.java

@@ -14,7 +14,7 @@ import java.util.Locale;
  * Created by ljy on 2018/3/20.
  */
 
-public class TaskReleaseEty implements Serializable{
+public class Release_task implements Serializable{
     private float bonus;// 0,
     private String create_time;// 0,
     private String deadline;// 0,
@@ -283,7 +283,7 @@ public class TaskReleaseEty implements Serializable{
 
     @Override
     public boolean equals(Object obj) {
-        return obj instanceof TaskReleaseEty && ((TaskReleaseEty) obj).getId() == id;
+        return obj instanceof Release_task && ((Release_task) obj).getId() == id;
     }
 
 

+ 41 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/SheepSignResult.java

@@ -0,0 +1,41 @@
+package com.sheep.gamegroup.model.entity;
+
+
+import com.sheep.jiuyan.samllsheep.ui.activity.SignActivity;
+
+/**
+ * Created by realicing on 2018/11/13.
+ * realicing@sina.com
+ * {amount:0.6,hasSign:1}
+ * 签到结果返回
+ */
+public class SheepSignResult {
+    private float amount = SignActivity.DEFAULT_FLOAT;
+    private int hasSign;
+
+    public float getAmount() {
+        return amount;
+    }
+
+    public void setAmount(float amount) {
+        this.amount = amount;
+    }
+
+    public int getHasSign() {
+        return hasSign;
+    }
+
+    public void setHasSign(int hasSign) {
+        this.hasSign = hasSign;
+    }
+
+
+
+    public static final int YES = 1;
+    public static final int NO = 0;
+
+    //是否签到成功
+    public boolean isSign(){
+        return hasSign == YES;
+    }
+}

+ 116 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/ShowAll.java

@@ -0,0 +1,116 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.sheep.jiuyan.samllsheep.R;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ */
+public class ShowAll {
+
+    public ShowAll(String content) {
+        this.content = content;
+    }
+
+    private boolean yes;
+    private boolean hasExp;//是否包含表情
+    private int canShowAllState;//0 初始状态, 1, false, 2 true
+    private String content;
+    private String showAllText = "显示全部";
+
+    public boolean isHasExp() {
+        return hasExp;
+    }
+
+    public void setHasExp(boolean hasExp) {
+        this.hasExp = hasExp;
+    }
+
+    public boolean isYes() {
+        return yes;
+    }
+
+    public void setYes(boolean yes) {
+        this.yes = yes;
+    }
+    public boolean isFirst(){
+        return canShowAllState == 0;
+    }
+
+    public boolean isCanShowAll() {
+        return canShowAllState == 2;
+    }
+
+    public void setCanShowAll(boolean canShowAll) {
+        this.canShowAllState = canShowAll ? 2 : 1;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getShowAllText() {
+        return showAllText;
+    }
+
+    public ShowAll setShowAllText(String showAllText) {
+        this.showAllText = showAllText;
+        return this;
+    }
+
+
+
+
+
+
+
+
+
+    //文本内容的id
+    private int introContentId = R.id.intro_content;
+    //显示全部按钮的id
+    private int introShowAllId = R.id.intro_show_all;
+    //替换显示全部按钮位置的控件的id
+    private int introShowAllNoId = R.id.intro_show_all_no;
+
+    public int getIntroShowAllId() {
+        return introShowAllId;
+    }
+
+    public ShowAll setIntroShowAllId(int introShowAllId) {
+        this.introShowAllId = introShowAllId;
+        return this;
+    }
+
+    public int getIntroShowAllNoId() {
+        return introShowAllNoId;
+    }
+
+    public ShowAll setIntroShowAllNoId(int introShowAllNoId) {
+        this.introShowAllNoId = introShowAllNoId;
+        return this;
+    }
+
+    public int getIntroContentId() {
+        return introContentId;
+    }
+
+    public ShowAll setIntroContentId(int introContentId) {
+        this.introContentId = introContentId;
+        return this;
+    }
+
+    private int maxLine = 3;//默认最多3行
+    public int getMaxLine() {
+        return maxLine;
+    }
+    public ShowAll setMaxLine(int maxLine) {
+        this.maxLine = maxLine;
+        return this;
+    }
+
+}

+ 16 - 3
app/src/main/java/com/sheep/gamegroup/model/entity/TaskAcceptedEty.java

@@ -22,10 +22,12 @@ public class TaskAcceptedEty implements Serializable{
 
     private long end_time;
 
-    private TaskReleaseEty release_task;
+    private Release_task release_task;
     private int child_task_id;//0 1开始子任务  2完成第二个子任务
     private int task_child_id;
     private int allowSubmit;//失败或者下线后,是否可以再次提交截图 2 不可以 1 可以
+    //用于自定义字段,如自定义手机号
+    private String unique_identification;//UniqueIdentification string       `orm:"column(unique_identification);null" description:"唯一标识" json:"unique_identification"`
 
     public int getChild_task_id() {
         return child_task_id;
@@ -115,11 +117,11 @@ public class TaskAcceptedEty implements Serializable{
         this.update_time = update_time;
     }
 
-    public TaskReleaseEty getRelease_task() {
+    public Release_task getRelease_task() {
         return release_task;
     }
 
-    public void setRelease_task(TaskReleaseEty release_task) {
+    public void setRelease_task(Release_task release_task) {
         this.release_task = release_task;
     }
 
@@ -155,6 +157,17 @@ public class TaskAcceptedEty implements Serializable{
         this.allowSubmit = allowSubmit;
     }
 
+
+    public String getUnique_identification() {
+        return unique_identification;
+    }
+
+    public void setUnique_identification(String unique_identification) {
+        this.unique_identification = unique_identification;
+    }
+
+
+
     @Override
     public boolean equals(Object obj) {
         return obj instanceof TaskAcceptedEty &&

+ 10 - 1
app/src/main/java/com/sheep/gamegroup/model/entity/TaskEty.java

@@ -44,6 +44,8 @@ public class TaskEty implements Serializable, IDownload {
     private boolean can_download;//是否可以下载
     private int appointment_time;//预约时间
     private String qr_code;//二维码地址
+    //用于自定义字段,如自定义手机号
+    private String unique_identification;//UniqueIdentification string       `orm:"column(unique_identification);null" description:"唯一标识" json:"unique_identification"`
 
     public String getQr_code() {
         return qr_code;
@@ -327,6 +329,13 @@ public class TaskEty implements Serializable, IDownload {
         this.can_download = can_download;
     }
 
+    public String getUnique_identification() {
+        return unique_identification;
+    }
+
+    public void setUnique_identification(String unique_identification) {
+        this.unique_identification = unique_identification;
+    }
 
 
 
@@ -685,7 +694,7 @@ public class TaskEty implements Serializable, IDownload {
     public static final int TASK_TYPE_GAME_SHEEP = 1002;
     public static final int TASK_TYPE_GAME_TECENT = 1003;
     public static final int TASK_TYPE_GAME_XIAO_MI = 1004;
-    public static final int TASK_TYPE_APPLET = 1007;
+    public static final int TASK_TYPE_APPLET = 1007;//小程序任务
     public static final int TASK_TYPE_XIAN_JIN = 1008;//现金任务
     public static final int TASK_TYPE_GAME_OTHER = 1099;
     //open_mode 连续任务类型

+ 99 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/TitleInfoList.java

@@ -0,0 +1,99 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.support.annotation.NonNull;
+import android.support.v7.widget.LinearLayoutManager;
+import android.support.v7.widget.RecyclerView;
+import android.view.View;
+import android.widget.TextView;
+
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ * 包含标题的list--搜索中的热门搜索与搜索历史用到
+ */
+public class TitleInfoList implements Comparable<TitleInfoList> {
+    public TitleInfoList(String name, RecyclerView.Adapter adapter) {
+        this.name = name;
+        this.adapter = adapter;
+    }
+
+    private int sort;
+
+    public int getSort() {
+        return sort;
+    }
+
+    public TitleInfoList setSort(int sort) {
+        this.sort = sort;
+        return this;
+    }
+
+    private String name;
+    private RecyclerView.Adapter adapter;
+
+    public String getName() {
+        return name;
+    }
+
+    public void setName(String name) {
+        this.name = name;
+    }
+
+
+    public RecyclerView.Adapter getAdapter() {
+        return adapter;
+    }
+
+    //水平
+    public static final int LAYOUT_MANAGER_STYLE_VERTICAL = 0;
+    //垂直
+    public static final int LAYOUT_MANAGER_STYLE_HORIZONTAL = 1;
+    private int layoutManagerStyle = LAYOUT_MANAGER_STYLE_VERTICAL;
+    //设置水平滑动
+    public TitleInfoList setHorizontal() {
+        layoutManagerStyle = LAYOUT_MANAGER_STYLE_HORIZONTAL;
+        return this;
+    }
+
+    public void setAdapter(RecyclerView.Adapter adapter) {
+        this.adapter = adapter;
+    }
+
+    public RecyclerView.LayoutManager getLayoutManager() {
+        switch (layoutManagerStyle){
+            case LAYOUT_MANAGER_STYLE_HORIZONTAL:
+                return new LinearLayoutManager(SheepApp.getInstance(), LinearLayoutManager.HORIZONTAL, false);
+            case LAYOUT_MANAGER_STYLE_VERTICAL:
+            default:
+                return new LinearLayoutManager(SheepApp.getInstance());
+        }
+    }
+    private boolean showTopLine = true;//默认显示上面的线
+
+    public boolean isShowTopLine() {
+        return showTopLine;
+    }
+
+    public TitleInfoList setShowTopLine(boolean showTopLine) {
+        this.showTopLine = showTopLine;
+        return this;
+    }
+
+    private boolean showBottomLine;
+
+    public boolean isShowBottomLine() {
+        return showBottomLine;
+    }
+
+    public TitleInfoList setShowBottomLine(boolean showBottomLine) {
+        this.showBottomLine = showBottomLine;
+        return this;
+    }
+
+    @Override
+    public int compareTo(@NonNull TitleInfoList item) {
+        return sort - item.getSort();
+    }
+}

+ 131 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/TopSearchStatistics.java

@@ -0,0 +1,131 @@
+package com.sheep.gamegroup.model.entity;
+
+import com.sheep.gamegroup.absBase.IHomePageSearch;
+import com.sheep.gamegroup.absBase.ISearchRecord;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ * 热门搜索历史
+ * <p>
+ * link_id:	integer ($int64)
+ * 关联其他表的主键id(具体是哪张表由type决定)
+ * update_time:	integer ($int64)
+ * 修改时间(最后一次搜索时间)
+ * applications:	Applications{...}
+ * search_num:	integer ($int64)
+ * (首页热门)搜索次数
+ * create_time:	integer ($int64)
+ * 创建时间
+ * platform:	integer ($int64)
+ * 平台 0全 1android 2ios(该平台值从关联表(link_type决定)中获取)
+ * id:	integer ($int64)
+ * ID
+ * release_task:	ReleaseTask{...}
+ * link_type:	integer ($int64)
+ * 关联类型 1任务(release_task)2游戏(applications)
+ */
+public class TopSearchStatistics implements ISearchRecord, IHomePageSearch {
+    private Applications applications;
+
+    private int create_time;
+
+    private int id;
+
+    private int link_id;
+
+    private int link_type;
+
+    private int platform;
+
+    private Release_task release_task;
+
+    private int search_num;
+
+    private int update_time;
+
+    public void setApplications(Applications applications) {
+        this.applications = applications;
+    }
+
+    public Applications getApplications() {
+        return this.applications;
+    }
+
+    public void setCreate_time(int create_time) {
+        this.create_time = create_time;
+    }
+
+    public int getCreate_time() {
+        return this.create_time;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return this.id;
+    }
+
+    public void setLink_id(int link_id) {
+        this.link_id = link_id;
+    }
+
+    public int getLink_id() {
+        return this.link_id;
+    }
+
+    public void setLink_type(int link_type) {
+        this.link_type = link_type;
+    }
+
+    public int getLink_type() {
+        return this.link_type;
+    }
+
+    public void setPlatform(int platform) {
+        this.platform = platform;
+    }
+
+    public int getPlatform() {
+        return this.platform;
+    }
+
+    public void setRelease_task(Release_task release_task) {
+        this.release_task = release_task;
+    }
+
+    public Release_task getRelease_task() {
+        return this.release_task;
+    }
+
+    public void setSearch_num(int search_num) {
+        this.search_num = search_num;
+    }
+
+    public int getSearch_num() {
+        return this.search_num;
+    }
+
+    public void setUpdate_time(int update_time) {
+        this.update_time = update_time;
+    }
+
+    public int getUpdate_time() {
+        return this.update_time;
+    }
+
+
+
+    @Override
+    public String getInput() {
+        if (release_task != null) {
+            return release_task.getName();
+        }
+        if (applications != null) {
+            return applications.getName();
+        }
+        return "";
+    }
+}

+ 237 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserComment.java

@@ -0,0 +1,237 @@
+package com.sheep.gamegroup.model.entity;
+
+
+import com.sheep.gamegroup.util.ApiJSONUtil;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * update_time:	integer ($int64)
+ * level:	integer ($int32)
+ * 评分等级 1-5
+ * app_name:	string
+ * 应用名称
+ * nickname:	string
+ * 昵称
+ * user_id:	integer ($int64)
+ * 用户id
+ * create_time:	integer ($int64)
+ * score:	integer ($int32)
+ * 评分 1-10
+ * status:	integer ($int32)
+ * 审核状态 1:通过 2:未通过
+ * like:	integer ($int64)
+ * 点赞数
+ * app_icon:	string
+ * 应用图标
+ * expression:	integer ($int64)
+ * 表情数
+ * app_type:	integer ($int32)
+ * 评论类型 1:游戏
+ * content:	string
+ * 评论内容
+ * avatar:	string
+ * 头像
+ * app_id:	integer ($int64)
+ * 评论应用id
+ * id:	integer ($int64)
+ * comment:	integer ($int64)
+ * 评论数
+ * <p>
+ * 用户评论
+ */
+public class UserComment {
+
+    private int id;
+
+    private int user_id;
+
+    private int app_id;
+
+    private String app_name;
+
+    private String app_icon;
+
+    private int app_type;
+
+    private String nickname;
+
+    private String avatar;
+
+    private int like;
+
+    private int expression;
+
+    private int comment;
+
+    private int score;
+
+    private int level;
+
+    private int status;
+
+    private String content;
+
+    private int create_time;
+
+    private int update_time;
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getId() {
+        return this.id;
+    }
+
+    public void setUser_id(int user_id) {
+        this.user_id = user_id;
+    }
+
+    public int getUser_id() {
+        return this.user_id;
+    }
+
+    public void setApp_id(int app_id) {
+        this.app_id = app_id;
+    }
+
+    public int getApp_id() {
+        return this.app_id;
+    }
+
+    public void setApp_name(String app_name) {
+        this.app_name = app_name;
+    }
+
+    public String getApp_name() {
+        return this.app_name;
+    }
+
+    public void setApp_icon(String app_icon) {
+        this.app_icon = app_icon;
+    }
+
+    public String getApp_icon() {
+        return this.app_icon;
+    }
+
+    public void setApp_type(int app_type) {
+        this.app_type = app_type;
+    }
+
+    public int getApp_type() {
+        return this.app_type;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+
+    public String getNickname() {
+        return this.nickname;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getAvatar() {
+        return this.avatar;
+    }
+
+    public void setLike(int like) {
+        this.like = like;
+    }
+
+    public int getLike() {
+        return this.like;
+    }
+
+    public void setExpression(int expression) {
+        this.expression = expression;
+    }
+
+    public int getExpression() {
+        return this.expression;
+    }
+
+    public void setComment(int comment) {
+        this.comment = comment;
+    }
+
+    public int getComment() {
+        return this.comment;
+    }
+
+    public void setScore(int score) {
+        this.score = score;
+    }
+
+    public int getScore() {
+        return this.score;
+    }
+
+    public void setLevel(int level) {
+        this.level = level;
+    }
+
+    public int getLevel() {
+        return this.level;
+    }
+
+    public void setStatus(int status) {
+        this.status = status;
+    }
+
+    public int getStatus() {
+        return this.status;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getContent() {
+        return this.content;
+    }
+
+    public void setCreate_time(int create_time) {
+        this.create_time = create_time;
+    }
+
+    public int getCreate_time() {
+        return this.create_time;
+    }
+
+    public void setUpdate_time(int update_time) {
+        this.update_time = update_time;
+    }
+
+    public int getUpdate_time() {
+        return this.update_time;
+    }
+
+
+    private ShowAll showAll;
+
+    public ShowAll getShowAll() {
+        if (showAll == null)
+            showAll = new ShowAll(content);
+        return showAll;
+    }
+
+    //表情点赞数量加一
+    public void plusExpression() {
+        expression++;
+    }
+    //点赞数量加一
+    public void plusLike() {
+        like++;
+    }
+
+    //是否是游戏资讯的用户评论
+    public boolean isArticleUserComment() {
+        return ApiJSONUtil.COMMENT_TYPE_ARTICLE == app_type;
+    }
+}

+ 29 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentDetail.java

@@ -0,0 +1,29 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ * user_comment:	UserComment{...}
+ * user_comment_reply:	UserCommentUserData{...}
+ * 用户详情
+ */
+public class UserCommentDetail {
+    private UserComment user_comment;
+    private UserCommentUserData user_comment_reply;
+
+    public UserComment getUser_comment() {
+        return user_comment;
+    }
+
+    public void setUser_comment(UserComment user_comment) {
+        this.user_comment = user_comment;
+    }
+
+    public UserCommentUserData getUser_comment_reply() {
+        return user_comment_reply;
+    }
+
+    public void setUser_comment_reply(UserCommentUserData user_comment_reply) {
+        this.user_comment_reply = user_comment_reply;
+    }
+}

+ 135 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentReply.java

@@ -0,0 +1,135 @@
+package com.sheep.gamegroup.model.entity;
+
+
+import com.lqr.emoji.EmotionLayout;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ * update_time:	integer ($int64)
+ * reply:	string
+ * 回复内容
+ * nickname:	string
+ * 昵称
+ * user_id:	integer ($int64)
+ * 用户id
+ * user_comment_id:	integer ($int64)
+ * 评论id
+ * create_time:	integer ($int64)
+ * status:	integer ($int32)
+ * 审核状态 1:通过 2:未通过
+ * like:	integer ($int64)
+ * 点赞数
+ * content:	string
+ * 评论内容
+ * avatar:	string
+ * 头像
+ * id:	integer ($int64)
+ * <p>
+ * description:用户评论信息
+ */
+public class UserCommentReply {
+    private int id;
+
+    private int user_comment_id;
+
+    private int user_id;
+
+    private String nickname;
+
+    private String avatar;
+
+    private int like;
+
+    private int status;
+
+    private String content;
+
+    private String reply;
+
+    private int create_time;
+
+    private int update_time;
+
+    public void setId(int id){
+        this.id = id;
+    }
+    public int getId(){
+        return this.id;
+    }
+    public void setUser_comment_id(int user_comment_id){
+        this.user_comment_id = user_comment_id;
+    }
+    public int getUser_comment_id(){
+        return this.user_comment_id;
+    }
+    public void setUser_id(int user_id){
+        this.user_id = user_id;
+    }
+    public int getUser_id(){
+        return this.user_id;
+    }
+    public void setNickname(String nickname){
+        this.nickname = nickname;
+    }
+    public String getNickname(){
+        return this.nickname;
+    }
+    public void setAvatar(String avatar){
+        this.avatar = avatar;
+    }
+    public String getAvatar(){
+        return this.avatar;
+    }
+    public void setLike(int like){
+        this.like = like;
+    }
+    public int getLike(){
+        return this.like;
+    }
+    public void setStatus(int status){
+        this.status = status;
+    }
+    public int getStatus(){
+        return this.status;
+    }
+    public void setContent(String content){
+        this.content = content;
+    }
+    public String getContent(){
+        return this.content;
+    }
+    public void setReply(String reply){
+        this.reply = reply;
+    }
+    public String getReply(){
+        return this.reply;
+    }
+    public void setCreate_time(int create_time){
+        this.create_time = create_time;
+    }
+    public int getCreate_time(){
+        return this.create_time;
+    }
+    public void setUpdate_time(int update_time){
+        this.update_time = update_time;
+    }
+    public int getUpdate_time(){
+        return this.update_time;
+    }
+
+
+
+
+
+
+    private ShowAll showAll;
+    public ShowAll getShowAll() {
+        if(showAll == null) {
+            boolean hasExp = EmotionLayout.hasExp(content);
+            showAll = new ShowAll(hasExp ? EmotionLayout.changeContent(content) : content);
+            showAll.setHasExp(hasExp);
+        }
+        return showAll;
+    }
+}

+ 30 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentUserData.java

@@ -0,0 +1,30 @@
+package com.sheep.gamegroup.model.entity;
+
+import java.util.List;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ * reply_list:	[...]
+ * total:	integer ($int64)
+ */
+public class UserCommentUserData {
+    private List<UserCommentReply> reply_list;
+    private int total;
+
+    public List<UserCommentReply> getReply_list() {
+        return reply_list;
+    }
+
+    public void setReply_list(List<UserCommentReply> reply_list) {
+        this.reply_list = reply_list;
+    }
+
+    public int getTotal() {
+        return total;
+    }
+
+    public void setTotal(int total) {
+        this.total = total;
+    }
+}

+ 124 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserCommentWithReply.java

@@ -0,0 +1,124 @@
+package com.sheep.gamegroup.model.entity;
+
+
+import java.util.Locale;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ * app_id:	integer ($int64)
+ * 评论应用id
+ * app_name:	string
+ * 应用名称
+ * content:	string
+ * 评论内容
+ * like:	integer ($int64)
+ * 点赞数
+ * nickname:	string
+ * 昵称
+ * reply_content:	string
+ * 回复内容
+ * user_comment_id:	integer ($int64)
+ * 评论id
+ * user_id:	integer ($int64)
+ * 用户id
+ * <p>
+ * description:用户评论信息
+ */
+public class UserCommentWithReply {
+    private int app_id;
+
+    private int user_comment_id;
+
+    private int user_id;
+
+    private String nickname;
+
+    private String app_name;
+
+    private int like;
+
+
+    private String content;
+
+    private String reply_content;
+
+    public int getApp_id() {
+        return app_id;
+    }
+
+    public void setApp_id(int app_id) {
+        this.app_id = app_id;
+    }
+
+    public int getUser_comment_id() {
+        return user_comment_id;
+    }
+
+    public void setUser_comment_id(int user_comment_id) {
+        this.user_comment_id = user_comment_id;
+    }
+
+    public int getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(int user_id) {
+        this.user_id = user_id;
+    }
+
+    public String getNickname() {
+        return nickname;
+    }
+
+    public void setNickname(String nickname) {
+        this.nickname = nickname;
+    }
+
+    public String getApp_name() {
+        return app_name;
+    }
+
+    public void setApp_name(String app_name) {
+        this.app_name = app_name;
+    }
+
+    public int getLike() {
+        return like;
+    }
+
+    public void setLike(int like) {
+        this.like = like;
+    }
+
+    public String getContent() {
+        return content;
+    }
+
+    public void setContent(String content) {
+        this.content = content;
+    }
+
+    public String getReply_content() {
+        return reply_content;
+    }
+
+    public void setReply_content(String reply_content) {
+        this.reply_content = reply_content;
+    }
+
+
+
+    private ShowAll showAll;
+    public ShowAll getContentShowAll() {
+        if(showAll == null)
+            showAll = new ShowAll(String.format(Locale.CHINA, "%s 评论: %s", nickname, content));
+        return showAll;
+    }
+    private ShowAll replyShowAll;
+    public ShowAll getReplyShowAll() {
+        if(replyShowAll == null)
+            replyShowAll = new ShowAll(String.format(Locale.CHINA, "我在 %s 评论 %s\n%s", app_name, nickname, reply_content));
+        return replyShowAll;
+    }
+}

+ 140 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserFocus.java

@@ -0,0 +1,140 @@
+package com.sheep.gamegroup.model.entity;
+
+/**
+ * Created by realicing on 2018/11/5.
+ * realicing@sina.com
+ * 用户主页详情
+ * update_time:	integer ($int64)
+ * is_focus_user:	boolean
+ * 是否关注用户
+ * user_id:	integer ($int64)
+ * 用户id
+ * create_time:	integer ($int64)
+ * focus_user:	integer ($int64)
+ * 关注人数
+ * fan:	integer ($int64)
+ * 粉丝人数
+ * like:	integer ($int64)
+ * 点赞数
+ * avatar:	string
+ * 头像
+ * focus_game:	integer ($int64)
+ * 关注游戏
+ * id:	integer ($int64)
+ */
+public class UserFocus {
+    private int id;
+    private int focus_game;
+    private int like;
+    private int fan;
+    private int focus_user;
+    private boolean is_focus_user;
+    private int create_time;
+    private int user_id;
+    private int update_time;
+    private String avatar;
+    private String nick_name;
+
+    public int getId() {
+        return id;
+    }
+
+    public void setId(int id) {
+        this.id = id;
+    }
+
+    public int getFocus_game() {
+        return focus_game;
+    }
+
+    public void setFocus_game(int focus_game) {
+        this.focus_game = focus_game;
+    }
+
+    public int getLike() {
+        return like;
+    }
+
+    public void setLike(int like) {
+        this.like = like;
+    }
+
+    public int getFan() {
+        return fan;
+    }
+
+    public void setFan(int fan) {
+        this.fan = fan;
+    }
+
+    public int getFocus_user() {
+        return focus_user;
+    }
+
+    public void setFocus_user(int focus_user) {
+        this.focus_user = focus_user;
+    }
+
+    public int getCreate_time() {
+        return create_time;
+    }
+
+    public void setCreate_time(int create_time) {
+        this.create_time = create_time;
+    }
+
+    public int getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(int user_id) {
+        this.user_id = user_id;
+    }
+
+    public int getUpdate_time() {
+        return update_time;
+    }
+
+    public void setUpdate_time(int update_time) {
+        this.update_time = update_time;
+    }
+
+    public String getAvatar() {
+        return avatar;
+    }
+
+    public void setAvatar(String avatar) {
+        this.avatar = avatar;
+    }
+
+    public String getNick_name() {
+        return nick_name;
+    }
+
+    public void setNick_name(String nick_name) {
+        this.nick_name = nick_name;
+    }
+
+    public boolean isIs_focus_user() {
+        return is_focus_user;
+    }
+
+    public void setIs_focus_user(boolean is_focus_user) {
+        this.is_focus_user = is_focus_user;
+    }
+
+
+
+
+
+
+    //关注状态取反
+    public void toggleFocusUser() {
+        is_focus_user = !is_focus_user;
+    }
+
+    //点赞数量加一
+    public void plusLike() {
+        like++;
+    }
+}

+ 120 - 0
app/src/main/java/com/sheep/gamegroup/model/entity/UserSign.java

@@ -0,0 +1,120 @@
+package com.sheep.gamegroup.model.entity;
+
+import android.support.annotation.NonNull;
+import android.text.TextUtils;
+
+import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.util.TimeUtil;
+
+import java.util.Calendar;
+
+/**
+ * Created by realicing on 2018/11/13.
+ * realicing@sina.com
+ */
+public class UserSign implements Comparable<UserSign> {
+
+    /**
+     * 用户ID
+     * user_id : 63201
+     * 签到周期
+     * day : 1
+     * 签到日期
+     * sign_date : 2018-11-05
+     * 是否补签
+     * is_supplement : 0
+     */
+
+    private int user_id;
+    private int day;
+    private String sign_date;
+    private int is_supplement;
+    private int has_share;
+
+    public int getUser_id() {
+        return user_id;
+    }
+
+    public void setUser_id(int user_id) {
+        this.user_id = user_id;
+    }
+
+    public int getDay() {
+        return day;
+    }
+
+    public void setDay(int day) {
+        this.day = day;
+    }
+
+    public String getSign_date() {
+        return sign_date;
+    }
+
+    public void setSign_date(String sign_date) {
+        this.sign_date = sign_date;
+    }
+
+    public int getIs_supplement() {
+        return is_supplement;
+    }
+
+    public void setIs_supplement(int is_supplement) {
+        this.is_supplement = is_supplement;
+    }
+
+    public int getHas_share() {
+        return has_share;
+    }
+
+    public void setHas_share(int has_share) {
+        this.has_share = has_share;
+    }
+
+
+
+    @Override
+    public boolean equals(Object obj) {
+        return obj instanceof UserSign && ((UserSign) obj).day == day;//这里认为,day相同, 就是同一天的数据
+    }
+
+    public boolean isToday() {
+        return TextUtils.equals(sign_date, getSignDateByTime(System.currentTimeMillis()));
+    }
+
+    //当天是否进行过补签
+    public boolean signSupplemented(){
+        return has_share >= SHARE_TYPE_SIGN_SUPPLEMENT;
+    }
+    //当天是否进行过分享
+    public boolean signShared(){
+        return has_share >= SHARE_TYPE_SHARE;
+    }
+    @Override
+    public int compareTo(@NonNull UserSign userSign) {
+        return day - userSign.getDay();
+    }
+
+    //让当前的签到时间与otherUserSign的签到时间统一起来
+    public void resetSignDate(UserSign otherUserSign) {
+        String signDate = otherUserSign.getSign_date();
+        int year = NumberFormatUtils.parseInteger(signDate.substring(0, 4));
+        int month = NumberFormatUtils.parseInteger(signDate.substring(5, 7));
+        int day = NumberFormatUtils.parseInteger(signDate.substring(8));
+        Calendar calendar = Calendar.getInstance();
+        calendar.set(Calendar.YEAR, year);
+        calendar.set(Calendar.MONTH, month - 1);//这里要-1,很容易搞错
+        calendar.set(Calendar.DAY_OF_MONTH, day);
+        int compareTo = compareTo(otherUserSign);
+        calendar.add(Calendar.DAY_OF_MONTH, compareTo);
+        setSign_date(getSignDateByTime(calendar.getTimeInMillis()));
+    }
+
+    //通过时间获取对应的日期格式
+    public static String getSignDateByTime(long time) {
+        return TimeUtil.TimeStamp2Date(time, "yyyy-MM-dd");
+    }
+
+    public static final int SHARE_TYPE_SHARE = 1;//已经分享
+    public static final int SHARE_TYPE_SIGN_SUPPLEMENT = 2;//已经补签
+}

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/presenter/LoginPresenter.java

@@ -97,7 +97,7 @@ public class LoginPresenter implements LoginContract.Presenter {
             }
             SpUtils.saveToken(SheepApp.getInstance(), loginEty.getToken());
             DataUtil.getInstance().initUserEntity(loginEty.getUser());
-            LogUtil.logI("token--------"+loginEty.getToken());
+//            LogUtil.logI("token--------"+loginEty.getToken());
         }
         view.NetSuccess(1,"登录成功", EntityUtils.getUserCode(loginEty));
         TestUtil.saveUser(loginEty);

+ 5 - 5
app/src/main/java/com/sheep/gamegroup/presenter/PhonePresenter.java

@@ -52,13 +52,13 @@ public class PhonePresenter implements PhoneContract.Presenter {
                     .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
                         @Override
                         public void onError(BaseMessage baseMessage) {
-                            LogUtil.logI(new Gson().toJson(baseMessage));
+                            //LogUtil.logI(new Gson().toJson(baseMessage));
                             view.gaptchaFail(baseMessage);
                         }
 
                         @Override
                         public void onNext(BaseMessage baseMessage) {
-                            LogUtil.logI(new Gson().toJson(baseMessage));
+                            //LogUtil.logI(new Gson().toJson(baseMessage));
                             view.returnGaptcha(baseMessage);
 
                         }
@@ -89,20 +89,20 @@ public class PhonePresenter implements PhoneContract.Presenter {
                         public void onError(BaseMessage baseMessage) {
                             isOk = false;
                             view.gaptchaFail(baseMessage);
-                            LogUtil.logE(new Gson().toJson(baseMessage));
+                            //LogUtil.logE(new Gson().toJson(baseMessage));
                         }
 
                         @Override
                         public void onNext(BaseMessage baseMessage) {
                             isOk = true;
                             view.returnGaptcha(baseMessage);
-                            LogUtil.logI(new Gson().toJson(baseMessage));
+                            //LogUtil.logI(new Gson().toJson(baseMessage));
                         }
                     });
         } catch (Exception e) {
             e.printStackTrace();
         }
-        LogUtil.logI("isOk=="+isOk);
+        //LogUtil.logI("isOk=="+isOk);
         return isOk;
 
     }

+ 1 - 1
app/src/main/java/com/sheep/gamegroup/presenter/TaskDetailContract.java

@@ -9,7 +9,7 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
 
 public interface TaskDetailContract {
     interface Presenter{
-        void taskStatus(JSONObject jsonObject);
+        void taskStatus( int id, String screenshots,String remark, String package_name, String status, String device, String unique_identification);
         void taskDesc(int taskid);
     }
 

+ 4 - 3
app/src/main/java/com/sheep/gamegroup/presenter/TaskDetailPresenter.java

@@ -8,6 +8,8 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 
 import javax.inject.Inject;
 
+import retrofit2.http.Query;
+import rx.Observable;
 import rx.android.schedulers.AndroidSchedulers;
 import rx.schedulers.Schedulers;
 
@@ -27,9 +29,8 @@ public class TaskDetailPresenter implements TaskDetailContract.Presenter {
     }
 
     @Override
-    public void taskStatus(JSONObject jsonObject) {
-        apiService.taskStatus(jsonObject.getInteger("id"),jsonObject.getString("screenshots"),
-                jsonObject.getString("remark"),jsonObject.getString("package_name"),jsonObject.getString("status"),jsonObject.getString("device"))
+    public void taskStatus( int id, String screenshots,String remark, String package_name, String status, String device, String unique_identification) {
+        (unique_identification == null ? apiService.taskStatus(id, screenshots, remark, package_name, status, device) : apiService.taskStatus(id, screenshots, remark, package_name, status, device, unique_identification))
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {

+ 32 - 8
app/src/main/java/com/sheep/gamegroup/receiver/AppAddOrDelReceiver.java

@@ -8,6 +8,8 @@ import android.os.Looper;
 import android.text.TextUtils;
 
 import com.kfzs.duanduan.utils.ApkUtils;
+import com.sheep.gamegroup.util.DataKey;
+import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
@@ -21,7 +23,25 @@ import org.greenrobot.eventbus.EventBus;
 public class AppAddOrDelReceiver extends BroadcastReceiver {
     @Override
     public void onReceive(final Context context, final Intent intent) {
-        if(Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction()) || Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction()) || Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())){
+        String action = intent.getAction();
+        if(action == null)
+            return;
+        switch (action){
+            case Intent.ACTION_PACKAGE_REMOVED://卸载的监听
+                String willInstallApkPackageName = DataUtil.getAsString(DataKey.KEY_WILL_INSTALL_APK_PACKAGE_NAME, null);
+                if(!TextUtils.isEmpty(willInstallApkPackageName) && TextUtils.equals(getPackageName(intent), willInstallApkPackageName)){
+                    String willInstallApkPath = DataUtil.getAsString(DataKey.KEY_WILL_INSTALL_APK_PATH, null);
+                    if(!TextUtils.isEmpty(willInstallApkPath)){
+                        //清除掉记录
+                        DataUtil.putAsString(DataKey.KEY_WILL_INSTALL_APK_PATH, "");
+                        DataUtil.putAsString(DataKey.KEY_WILL_INSTALL_APK_PACKAGE_NAME, "");
+                        //重新安装
+                        ApkUtils.installApk(SheepApp.getInstance(), willInstallApkPath);
+                    }
+                }
+                break;
+        }
+        if(Intent.ACTION_PACKAGE_ADDED.equals(action) || Intent.ACTION_PACKAGE_REMOVED.equals(action) || Intent.ACTION_PACKAGE_REPLACED.equals(action)){
             ApkUtils.getInstance().clear();
             EventBus.getDefault().post(intent);
         }
@@ -29,17 +49,13 @@ public class AppAddOrDelReceiver extends BroadcastReceiver {
         /*
           安装失败
          */
-        if(Intent.ACTION_INSTALL_FAILURE.equals(intent.getAction())){
+        if(Intent.ACTION_INSTALL_FAILURE.equals(action)){
             try {
                 new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                     @Override
                     public void run() {
-                        String dataString = intent.getDataString();
-                        if(TextUtils.isEmpty(dataString)){
-                            return;
-                        }
-                        String packages = dataString.replace("package:","");
-                        if(packages.equals(SheepApp.getInstance().getPackgeName()+"")){
+                        String cachePackageName = DataUtil.getAsString(DataKey.KEY_INSTALL_APK_PACKAGE_NAME, "");
+                        if(TextUtils.equals(getPackageName(intent), cachePackageName)){
                             G.showToast("安装失败,请检查是否空间不足或其他问题!");
                         }
                     }
@@ -50,4 +66,12 @@ public class AppAddOrDelReceiver extends BroadcastReceiver {
         }
     }
 
+    private String getPackageName(Intent intent) {
+        String dataString = intent.getDataString();
+        if(!TextUtils.isEmpty(dataString)){
+            return dataString.replace("package:","");
+        }
+        return dataString;
+    }
+
 }

+ 11 - 1
app/src/main/java/com/sheep/gamegroup/usage/AppUsageManager.java

@@ -24,6 +24,7 @@ import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
+import java.util.ArrayList;
 import java.util.Calendar;
 import java.util.Date;
 import java.util.List;
@@ -188,11 +189,20 @@ public class AppUsageManager {
                 List<UsageStats> usageStatsList = mUsageStatsManager.queryUsageStats(UsageStatsManager.INTERVAL_BEST, 1_514_736_000_000L, time);//1_514_736_000_000L 对应 2018-01-01 0:0:0
 
                 if (usageStatsList != null && !usageStatsList.isEmpty()) {
+                    List<UsageStats> list = new ArrayList<>();
                     for (UsageStats usageStats : usageStatsList) {
                         if (usageStats != null && TextUtils.equals(packageName, usageStats.getPackageName())) {
-                            return usageStats.getTotalTimeInForeground();
+                            list.add(usageStats);
                         }
                     }
+                    //尝试修复重新第二天无法完成自动时长任务的bug
+                    if(!list.isEmpty()){
+                        long totalTimeInForeground = 0;
+                        for (UsageStats usageStats : list) {
+                            totalTimeInForeground += usageStats.getTotalTimeInForeground();
+                        }
+                        return totalTimeInForeground;
+                    }
                 } else {
                     return NOT_OPEN_USAGE_STATS;
                 }

+ 73 - 0
app/src/main/java/com/sheep/gamegroup/util/ApiJSONUtil.java

@@ -0,0 +1,73 @@
+package com.sheep.gamegroup.util;
+
+
+import android.support.annotation.IntDef;
+
+import com.alibaba.fastjson.JSONObject;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.lang.annotation.Retention;
+import java.lang.annotation.RetentionPolicy;
+
+import rx.Observable;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
+/**
+ * Created by realicing on 2018/11/2.
+ * realicing@sina.com
+ */
+public class ApiJSONUtil {
+    public static final int COMMENT_TYPE_GAME = 1;
+    public static final int COMMENT_TYPE_ARTICLE = 2;
+    @IntDef({COMMENT_TYPE_GAME, COMMENT_TYPE_ARTICLE})
+    @Retention(RetentionPolicy.SOURCE)
+    public @interface COMMENT_TYPE {
+    }
+    /**
+     * 用户游戏评论
+     * CommentType       int8    `description:"评论类型 1:游戏 2:资讯" json:"comment_type"`
+     * app_id:	integer ($int64) 应用id
+     * content:	string 评论内容
+     * score:	integer ($int32) 评分 1-10
+     */
+    public static Observable<BaseMessage> postGameUserUserGameComment(@COMMENT_TYPE int comment_type, int app_id, String content, int score) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("comment_type", comment_type);
+        jsonObject.put("app_id", app_id);
+        jsonObject.put("content", content);
+        jsonObject.put("score", score);
+        return SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserGameComment(jsonObject)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread());
+    }
+
+    /**
+     * 用户评论用户
+     * UserCommentReq{
+     * content:	string  评论内容
+     * user_comment_id:	integer ($int64) 评论id
+     * }
+     */
+    public static Observable<BaseMessage> postGameUserUserComment(int user_comment_id, String content) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("user_comment_id", user_comment_id);
+        jsonObject.put("content", content);
+        return SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserComment(jsonObject);
+    }
+    /**
+     * 在自己的评论详情中,自己去回复 用户对自己的评论
+     * UserCommentReq{
+     * content:	string  评论内容
+     * user_comment_id:	integer ($int64) 评论id
+     * }
+     */
+    public static Observable<BaseMessage> postGameUserReplyComment(int user_comment_reply_id, String content) {
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("user_comment_reply_id", user_comment_reply_id);
+        jsonObject.put("content", content);
+        return SheepApp.getInstance().getNetComponent().getApiService().postGameUserReplyComment(jsonObject);
+    }
+
+}

+ 125 - 0
app/src/main/java/com/sheep/gamegroup/util/ApiUtil.java

@@ -0,0 +1,125 @@
+package com.sheep.gamegroup.util;
+
+import android.support.annotation.Nullable;
+import android.text.TextUtils;
+
+import com.sheep.gamegroup.absBase.IHomePageSearch;
+import com.sheep.gamegroup.model.entity.BaseMessage;
+import com.sheep.gamegroup.model.entity.NewAboutUs;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import org.afinal.simplecache.ApiKey;
+
+import rx.Observable;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.functions.Action1;
+import rx.schedulers.Schedulers;
+
+/**
+ * Created by realicing on 2018/11/6.
+ * realicing@sina.com
+ * 共用接口调用
+ */
+public class ApiUtil {
+
+    //用户回复用户评论 点赞
+    public static void postGameUserUserCommentLike(int user_comment_reply_id, SheepSubscriber<BaseMessage> sheepSubscriber) {
+        SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserCommentLike(user_comment_reply_id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(sheepSubscriber);
+    }
+    //用户游戏评论 表情点赞
+    public static void postGameUserUserGameCommentExpressionLike(int user_comment_id, SheepSubscriber<BaseMessage> sheepSubscriber) {
+        SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserGameCommentExpressionLike(user_comment_id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(sheepSubscriber);
+    }
+    //用户游戏评论 点赞
+    public static void postGameUserUserGameCommentLike(int user_comment_id, SheepSubscriber<BaseMessage> sheepSubscriber) {
+        SheepApp.getInstance().getNetComponent().getApiService().postGameUserUserGameCommentLike(user_comment_id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(sheepSubscriber);
+    }
+    //用户游戏主页 点赞
+    public static void postGameUserLike(int focus_user_id, SheepSubscriber<BaseMessage> sheepSubscriber) {
+        SheepApp.getInstance().getNetComponent().getApiService().postGameUserLike(focus_user_id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(sheepSubscriber);
+    }
+    //用户游戏主页 关注
+    public static void postGameUserFocusUser(int focus_user_id, SheepSubscriber<BaseMessage> sheepSubscriber) {
+        SheepApp.getInstance().getNetComponent().getApiService().postGameUserFocusUser(focus_user_id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(sheepSubscriber);
+    }
+    //游戏 关注
+    public static void postGameUserFocusGame(int focus_game_id, SheepSubscriber<BaseMessage> sheepSubscriber) {
+        SheepApp.getInstance().getNetComponent().getApiService().postGameUserFocusGame(focus_game_id)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(sheepSubscriber);
+    }
+
+    //关于我们,直接返回联系电话
+    public static void getNewAboutUsComplainQq(final Action1<String> action1) {
+        final NewAboutUs newAboutUs = DataUtil.getInstance().getCacheResult(ApiKey.new_about_us, NewAboutUs.class);
+        if(newAboutUs != null && !TextUtils.isEmpty(newAboutUs.getComplaintQq())){
+            Observable.just(newAboutUs.getComplaintQq())
+                    .observeOn(AndroidSchedulers.mainThread())
+                    .subscribe(new Action1<String>() {
+                        @Override
+                        public void call(String qq) {
+                            action1.call(qq);
+                        }
+                    });
+            newAboutUs.setComplaintQq(null);//设置为空任务标记已经读取,下面的接口不用调用call
+        }
+        SheepApp.getInstance().getNetComponent().getApiService().getNewAboutUs()
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                if(newAboutUs != null && TextUtils.equals(newAboutUs.getComplaintQq(), "hasRead")){
+                                    return;
+                                }
+                                NewAboutUs item = baseMessage.getData(NewAboutUs.class);
+                                if(item != null && !TextUtils.isEmpty(item.getComplaintQq())){
+                                    action1.call(item.getComplaintQq());
+                                } else {
+                                    action1.call("2441310002");
+                                }
+                            }
+
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                                if(newAboutUs != null && TextUtils.equals(newAboutUs.getComplaintQq(), "hasRead")){
+                                    return;
+                                }
+                                action1.call("2441310002");
+                            }
+                        });
+    }
+    //点击热门搜索后,统计点击次数
+    public static void postTopSearchStatisticsClickTopSearch(@Nullable IHomePageSearch item) {
+        if(item != null)
+            SheepApp.getInstance().getNetComponent().getApiService().postTopSearchStatisticsClickTopSearch(item.getLink_id(), item.getLink_type())
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                            }
+
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                            }
+                        });
+    }
+}

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

@@ -18,11 +18,13 @@ import android.text.Html;
 import android.text.TextUtils;
 import android.util.TypedValue;
 import android.view.View;
+import android.view.ViewGroup;
 import android.view.ViewTreeObserver;
 import android.webkit.DownloadListener;
 import android.webkit.WebView;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
+import android.widget.RelativeLayout;
 import android.widget.TextView;
 
 import com.alibaba.fastjson.JSONObject;
@@ -31,6 +33,7 @@ import com.kfzs.duanduan.utils.ApkUtils;
 import com.mdad.sdk.mdsdk.AdManager;
 import com.mdad.sdk.mdsdk.common.AdData;
 import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.absBase.IJump;
 import com.sheep.gamegroup.alipay.PayResult;
 import com.sheep.gamegroup.event.BigEvent;
 import com.sheep.gamegroup.event.EventTypes;
@@ -41,13 +44,12 @@ import com.sheep.gamegroup.helper.TaskHelper;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.DialogConfig;
 import com.sheep.gamegroup.model.entity.Ext;
-import com.sheep.gamegroup.model.entity.FindApp;
 import com.sheep.gamegroup.model.entity.FriendAndAwardEntity;
 import com.sheep.gamegroup.model.entity.GameAccountEntity;
+import com.sheep.gamegroup.model.entity.Applications;
 import com.sheep.gamegroup.model.entity.GameEntity;
 import com.sheep.gamegroup.model.entity.GiftBagApp;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
-import com.sheep.gamegroup.model.entity.PlayGameEntity;
 import com.sheep.gamegroup.model.entity.RobTask;
 import com.sheep.gamegroup.model.entity.RouserArticlesEntity;
 import com.sheep.gamegroup.model.entity.SlideshowEty;
@@ -55,14 +57,13 @@ import com.sheep.gamegroup.model.entity.TaskAcceptedEty;
 import com.sheep.gamegroup.model.entity.TaskChild;
 import com.sheep.gamegroup.model.entity.TaskDescEntity;
 import com.sheep.gamegroup.model.entity.TaskEty;
-import com.sheep.gamegroup.model.entity.TaskReleaseEty;
+import com.sheep.gamegroup.model.entity.Release_task;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.WithdrawalEty;
 import com.sheep.gamegroup.model.entity.XiaomiGameEntity;
 import com.sheep.gamegroup.model.util.EntityUtils;
 import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.usage.AppUsageManager;
-import com.sheep.gamegroup.view.activity.ActFindInformation;
 import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;
 import com.sheep.gamegroup.view.dialog.DialogNewbieTaskList;
 import com.sheep.gamegroup.view.dialog.DialogShare;
@@ -79,6 +80,7 @@ import com.sheep.jiuyan.samllsheep.utils.SpUtils;
 import com.umeng.socialize.ShareAction;
 import com.umeng.socialize.UMAuthListener;
 import com.umeng.socialize.UMShareAPI;
+import com.umeng.socialize.UMShareListener;
 import com.umeng.socialize.bean.SHARE_MEDIA;
 import com.umeng.socialize.media.UMImage;
 import com.umeng.socialize.media.UMWeb;
@@ -456,7 +458,6 @@ public class CommonUtil {
     public static final int JUMP_XIAO_MI = 15;//小米游戏列表
     //TODO 这里移动积分兑换的id需要替换
     public static final int JUMP_EXCHANGE_CMCC = 1000025;//移动积分兑换
-    public static final int JUMP_YM = 1000026;//有米积分
     public static final int JUMP_GMAE = 16;//游戏
     public static final int JUMP_FIND_RECOMMEND = 17;//推荐
     public static final int JUMP_WATCH_FOCUS = 18;//看点
@@ -465,13 +466,13 @@ public class CommonUtil {
     public static final int JUMP_FIND_GMAE = 21;//发现中的游戏
 
     /**
-     * 点击主页HomeList跳转
+     * 点击jump跳转
      */
-    public void goNative(Context context, HomeListEntity entity, String from) {
-
-        switch (Integer.valueOf(entity.getJump())) {
+    public void goNative(Context context, IJump jump, String from) {
+        Activity activity = (Activity) context;
+        switch (Integer.valueOf(jump.getJump())) {
             case JUMP_NEW_USER_TASK://新手任务
-                DialogNewbieTaskList.tryShowDialog((Activity) context);
+                DialogNewbieTaskList.tryShowDialog(activity);
                 NEWBIE_TASK.onEvent();
                 break;
             case JUMP_TRY_PLAY://试玩赚钱
@@ -493,7 +494,7 @@ public class CommonUtil {
                 Jump2View.getInstance().goRechargeQAct(context, from);
                 break;
             case JUMP_WX_ASSIST://微信辅助
-                Jump2View.getInstance().goWeb(context, entity.getUrl(), "微信二维码辅助好友注册任务");
+                Jump2View.getInstance().goWeb(context, jump.getUrl(), "微信二维码辅助好友注册任务");
                 break;
             case JUMP_SUCCESSION_TASK://连续任务
                 Jump2View.getInstance().goSequentialTaskView(context);
@@ -502,44 +503,51 @@ public class CommonUtil {
                 Jump2View.getInstance().goSignCardAct(context, null);
                 break;
             case JUMP_H5_INNER://内部WebView加载H5
-                if (checkLongMao((Activity) context, entity))
-                    Jump2View.getInstance().goWeb(context, entity.getUrl(), entity.getTitle());
+                if (checkLongMao(activity, jump))
+                    Jump2View.getInstance().goWeb(context, jump.getUrl(), jump.getTitle());
                 break;
             case JUMP_H5_OUTER://外部浏览器加载H5
-                if (checkLongMao((Activity) context, entity))
-                    Jump2View.getInstance().goWeb(context, entity.getUrl());
+                if (checkLongMao(activity, jump))
+                    Jump2View.getInstance().goWeb(context, jump.getUrl());
                 break;
             case JUMP_GAME_TASK://游戏任务
                 Jump2View.getInstance().goGameMakeMoney(context, 0);
                 break;
             case JUMP_XIAN_WAN://闲玩任务
-                Jump2View.getInstance().goXianwanWeb(context, null, null);
+                Jump2View.getInstance().goXianWanWeb(context, null);
                 break;
             case JUMP_GAME_RECHARGE://游戏代充(游戏充值)
-                Jump2View.getInstance().goGameRecharge((Activity) context, null);
+                Jump2View.getInstance().goGameRecharge(activity, null);
                 break;
             case JUMP_MI_DONG://幂动科技(简单任务)
-                Jump2View.getInstance().goMiDong((Activity) context, null);
+                Jump2View.getInstance().goMiDong(activity, null);
                 break;
             case JUMP_XIAO_MI://小米游戏列表
-                Jump2View.getInstance().goXiaomiGameList((Activity) context, null);
+                Jump2View.getInstance().goXiaomiGameList(activity, null);
                 break;
             case JUMP_EXCHANGE_CMCC://移动积分兑换
                 Jump2View.getInstance().goActExchangeCMCC(context);
                 break;
-            case JUMP_YM://有米积分
-                Jump2View.getInstance().goYm((Activity) context);
+            case IDConstant.JUMP_YM://有米积分
+                Jump2View.getInstance().goYm(activity);
+                break;
+            case IDConstant.JUMP_SIGN_SHEEP://签到小绵羊
+                Jump2View.getInstance().goActSignSheep(activity);
+                break;
+            case IDConstant.JUMP_GUIDE_NEW_USER://新手引导图文或视频
+                Jump2View.getInstance().goActGuideNewUser(activity);
                 break;
             default:
-                String url = entity.getUrl();
+                String url = jump.getUrl();
                 if (TextUtils.isEmpty(url))
                     G.showToast(R.string.coming_soon);
                 else//有链接直接跳转内部h5
-                    Jump2View.getInstance().goWeb(context, entity.getUrl(), entity.getTitle());
+                    Jump2View.getInstance().goWeb(context, jump.getUrl(), jump.getTitle());
                 break;
 
         }
     }
+
     //以龙猫开头的则认为是龙猫app
     public static final String LONG_MAO_APP_NAME = "龙猫";
     public static final String LONG_MAO_APP_PACKAGE_NAME = "com.cfyl.galesaur.guess";
@@ -549,11 +557,11 @@ public class CommonUtil {
      * 尝试跳转到龙猫竞猜
      *
      * @param activity
-     * @param entity
+     * @param jump
      * @return 判断到已经安装,返回false
      */
-    private boolean checkLongMao(Activity activity, HomeListEntity entity) {
-        if (entity.getTitle() != null && entity.getTitle().startsWith(LONG_MAO_APP_NAME) && PackageUtil.isAppInstalled(SheepApp.getInstance(), LONG_MAO_APP_PACKAGE_NAME)) {
+    private boolean checkLongMao(Activity activity, IJump jump) {
+        if (jump.getTitle() != null && jump.getTitle().startsWith(LONG_MAO_APP_NAME) && PackageUtil.isAppInstalled(SheepApp.getInstance(), LONG_MAO_APP_PACKAGE_NAME)) {
             try {
                 PackageUtil.startApp(SheepApp.getInstance(), LONG_MAO_APP_PACKAGE_NAME);
             } catch (Exception ignore) {
@@ -687,7 +695,7 @@ public class CommonUtil {
         if (AutoCheckService.IS_USE_THIS_SERVICE && !ListUtil.isEmpty(list)) {
             ArrayList<String> packageNameList = ListUtil.emptyList();
             for (TaskAcceptedEty item : list) {
-                TaskReleaseEty taskReleaseEty;
+                Release_task taskReleaseEty;
                 TaskEty taskEty;
                 if ((taskReleaseEty = item.getRelease_task()) != null && (taskEty = taskReleaseEty.getTask()) != null
                         && taskEty.isAppAutoCommitTask() && !TextUtils.isEmpty(taskEty.getPackage_names()))
@@ -909,7 +917,7 @@ public class CommonUtil {
     /**
      * 分享
      *
-     * @param activity
+     * @param activity 如果act
      * @param url
      * @param type        qq wx all
      * @param description
@@ -922,7 +930,7 @@ public class CommonUtil {
         SHARE_MEDIA share_media;
         switch (type) {
             case DialogShare.ALL:
-                ViewUtil.newInstance().showShare(activity, realUrl, description);
+                ViewUtil.showShareDialog(activity, realUrl, description);
                 return;
             case DialogShare.SYS_SEND:
                 SHARE_SYS_SEND.onEvent();
@@ -970,7 +978,7 @@ public class CommonUtil {
         new ShareAction(activity)
                 .setPlatform(share_media)
                 .withMedia(umWeb)
-                .setCallback(new UMShareListener())
+                .setCallback(activity instanceof UMShareListener ? (UMShareListener) activity : new CommonUMShareListener())
                 .share();
     }
 
@@ -1063,12 +1071,23 @@ public class CommonUtil {
 
     //尝试直接分享小绵羊
     public void tryShowShareDialog(final Activity activity) {
+        tryShowShareDialog(null, activity);
+    }
+
+    /**
+     * 尝试直接分享小绵羊
+     * @param action1 初始化view
+     * @param activity
+     */
+    public void tryShowShareDialog(final Action1<View> action1, final Activity activity) {
         callActionWithFriendCountAndAward(new Action1<FriendAndAwardEntity>() {
             @Override
             public void call(FriendAndAwardEntity result) {
                 if (result != null) {
-                    tryShowShareDialog(activity, result.getShare_desc());
+                    tryShowShareDialog(activity, result.getShare_desc(), action1);
                 } else {
+                    if(action1 != null)
+                        action1.call(null);
                     G.showToast("分享功能调试中");
                 }
             }
@@ -1077,20 +1096,27 @@ public class CommonUtil {
 
     //显示分享对话框
     public void tryShowShareDialog(final Activity activity, final String description) {
+        tryShowShareDialog(activity, description, null);
+    }
+
+    //显示分享对话框
+    public void tryShowShareDialog(final Activity activity, final String description, final Action1<View> action1) {
         CommonUtil.getInstance().callActionWithUserInfo(new Action1<UserEntity>() {
             @Override
             public void call(UserEntity userEntity) {
                 if (userEntity == null) {
                     G.showToast("分享功能调试中");
+                    if(action1 != null)
+                        action1.call(null);
                     return;
                 }
                 String url = userEntity.getShareLink();
-                ViewUtil.showShareDialog(activity, url, description);
+                ViewUtil.showShareDialog(activity, url, description, action1);
             }
         });
     }
 
-    public static class UMShareListener implements com.umeng.socialize.UMShareListener {
+    public static class CommonUMShareListener implements com.umeng.socialize.UMShareListener {
 
         @Override
         public void onStart(SHARE_MEDIA share_media) {
@@ -1395,7 +1421,7 @@ public class CommonUtil {
 
 
     //对---游戏任务中的预约任务----进行---预约操作
-    public void reservationGameTask(final Context context, final TaskReleaseEty taskReleaseEty, final Action1<Integer> action1) {
+    public void reservationGameTask(final Context context, final Release_task taskReleaseEty, final Action1<Integer> action1) {
         JSONObject jsonObject = new JSONObject();
         jsonObject.put("device_id", DeviceUtil.getDeviceId(context));
         jsonObject.put("release_task_id", taskReleaseEty.getId());
@@ -1510,7 +1536,7 @@ public class CommonUtil {
                 });
     }
 
-    private void giveUpTask(final Context context, final TaskReleaseEty taskReleaseEty, final Action1<Integer> action1) {
+    private void giveUpTask(final Context context, final Release_task taskReleaseEty, final Action1<Integer> action1) {
         SheepApp.getInstance().getNetComponent().getApiService().giveUpTask(taskReleaseEty.getAccepted_task_id())
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
@@ -1527,7 +1553,7 @@ public class CommonUtil {
                 });
     }
 
-    public void tryGiveUpTask(final Context context, final TaskReleaseEty taskReleaseEty, final Action1<Integer> action1) {
+    public void tryGiveUpTask(final Context context, final Release_task taskReleaseEty, final Action1<Integer> action1) {
         ViewUtil.showMsgDialog(context, new DialogConfig().setTitle("提示")
                 .setMsg("是否放弃正在运行中的任务").setBtnRightText("否")
                 .setBtnLeftText("是").setBtnLeftOnClickListener(new View.OnClickListener() {
@@ -1838,6 +1864,15 @@ public class CommonUtil {
      * @param tabLayout
      */
     public void reflex(final TabLayout tabLayout, final Context context) {
+        reflex(tabLayout, context, false);
+    }
+
+    /**
+     * 通过反射调整tabLayout中下划线的宽度
+     *
+     * @param tabLayout
+     */
+    public void reflex(final TabLayout tabLayout, final Context context, final boolean reMeasure) {
         //了解源码得知 线的宽度是根据 tabView的宽度来设置的
         tabLayout.post(new Runnable() {
             @Override
@@ -1865,7 +1900,7 @@ public class CommonUtil {
                         //因为我想要的效果是   字多宽线就多宽,所以测量mTextView的宽度
                         int width = 0;
                         width = mTextView.getWidth();
-                        if (width == 0) {
+                        if (width == 0 || reMeasure) {
                             mTextView.measure(0, 0);
                             width = mTextView.getMeasuredWidth();
                         }
@@ -1909,6 +1944,20 @@ public class CommonUtil {
         }
     }
 
+    //设置无数据距离上面的距离
+    public void setEmptyViewMargin(View empty_view, int topMargin, int bottomMargin) {
+        if(empty_view != null) {
+            ViewGroup.LayoutParams layoutParams = empty_view.getLayoutParams();
+            if(layoutParams instanceof RelativeLayout.LayoutParams) {
+                ((RelativeLayout.LayoutParams) layoutParams).topMargin = topMargin;
+                ((RelativeLayout.LayoutParams) layoutParams).bottomMargin = bottomMargin;
+            } else if(layoutParams instanceof LinearLayout.LayoutParams) {
+                ((LinearLayout.LayoutParams) layoutParams).topMargin = topMargin;
+                ((LinearLayout.LayoutParams) layoutParams).bottomMargin = bottomMargin;
+            }
+            empty_view.setLayoutParams(layoutParams);
+        }
+    }
     //设置无数据显示
     public void updateEmptyView(View empty_view, boolean showEmpty) {
         updateEmptyView(empty_view, showEmpty, false);
@@ -1978,7 +2027,7 @@ public class CommonUtil {
     /**
      * 小米游戏账号领取
      */
-    public void xiaomiRevieceAcctoun(TextView find_information_game_task_top, final Object items, final Activity activity) {
+    public void xiaomiRevieceAcctoun(TextView find_information_game_task_top, final Object item, final Activity activity) {
         XIAOMI_GAME_RECEIVE.onEvent();
         find_information_game_task_top.setText("领取福利号");
         find_information_game_task_top.setOnClickListener(new View.OnClickListener() {
@@ -1986,16 +2035,14 @@ public class CommonUtil {
             public void onClick(View v) {
 
                 JSONObject jsonObject = new JSONObject();
-                if (items instanceof XiaomiGameEntity) {
+                if (item instanceof XiaomiGameEntity) {
 
-                    jsonObject.put("id", ((XiaomiGameEntity) items).getId());
-                } else if (items instanceof FindApp) {
-                    jsonObject.put("id", ((FindApp) items).getId());
-                } else if (items instanceof PlayGameEntity) {
-                    jsonObject.put("id", ((PlayGameEntity) items).getId());
+                    jsonObject.put("id", ((XiaomiGameEntity) item).getId());
+                } else if (item instanceof Applications) {
+                    jsonObject.put("id", ((Applications) item).getId());
                 }
 
-                ViewUtil.newInstance().showProgress((Activity) activity);
+                ViewUtil.newInstance().showProgress(activity);
                 SheepApp.getInstance()
                         .getNetComponent()
                         .getApiService()
@@ -2006,7 +2053,7 @@ public class CommonUtil {
                             @Override
                             public void onError(BaseMessage baseMessage) {
                                 G.showToast(baseMessage.getMsg());
-                                ViewUtil.newInstance().hideProgress((Activity) activity);
+                                ViewUtil.newInstance().hideProgress(activity);
                             }
 
                             @SuppressLint({"StringFormatInvalid", "LocalSuppress"})
@@ -2076,35 +2123,34 @@ public class CommonUtil {
             DownLoadInfo task = (DownLoadInfo) event.getData();
             String url = task.getMDownloadUrl();
             TextView tvProgress = view.findViewWithTag(PUBLIC_TAG_PREFIX_TEXTVIEW_LIST + url);
-            switch (event.getEventTypes()) {
-                case DOWNLOAD_RUNNING:
-                    try {
-                        int p = task.getMPercent();    //任务进度百分比
-                        String speed = task.getAverageSpeed();    //转换单位后的下载速度,单位转换需要在配置文件中打开
-                        if (tvProgress == null) {
-                            return;
-                        }
-                        if(isShowSpeed)
-                            tvProgress.setText(String.format(Locale.CHINA, "%d%%(%s)", Math.abs(p), speed));//添加下载速度
-                        else
-                            tvProgress.setText(String.format(Locale.CHINA, "%d%%", Math.abs(p)));
+            if(tvProgress != null) {
+                switch (event.getEventTypes()) {
+                    case DOWNLOAD_RUNNING:
+                        try {
+                            int p = task.getMPercent();    //任务进度百分比
+                            String speed = task.getAverageSpeed();    //转换单位后的下载速度,单位转换需要在配置文件中打开
+                            if (isShowSpeed)
+                                tvProgress.setText(String.format(Locale.CHINA, "%d%%(%s)", Math.abs(p), speed));//添加下载速度
+                            else
+                                tvProgress.setText(String.format(Locale.CHINA, "%d%%", Math.abs(p)));
 
-                    } catch (Exception e) {
-                        e.printStackTrace();
-                    }
-                    break;
-                case DOWNLOAD_STOP:
-                    tvProgress.setText("继续下载");
-                    break;
-                case DOWNLOAD_COMPLETE:
-                    tvProgress.setText("安装游戏");
-                    break;
-                case DOWNLOAD_CANCEL:
-                    tvProgress.setText("下载取消");
-                    break;
-                case DOWNLOAD_FAIL:
-                    tvProgress.setText("下载失败");
-                    break;
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                        break;
+                    case DOWNLOAD_STOP:
+                        tvProgress.setText("继续下载");
+                        break;
+                    case DOWNLOAD_COMPLETE:
+                        tvProgress.setText("安装游戏");
+                        break;
+                    case DOWNLOAD_CANCEL:
+                        tvProgress.setText("下载取消");
+                        break;
+                    case DOWNLOAD_FAIL:
+                        tvProgress.setText("下载失败");
+                        break;
+                }
             }
         }
 
@@ -2256,7 +2302,7 @@ public class CommonUtil {
      * @param textView
      * @param taskReleaseEty
      */
-    public void setTaskTagText(TextView textView, TaskReleaseEty taskReleaseEty) {
+    public void setTaskTagText(TextView textView, Release_task taskReleaseEty) {
         textView.setVisibility(View.VISIBLE);
         ViewUtil.setColorMapText(textView, String.format(Locale.CHINA, "%s", taskReleaseEty.getCashOrWelfare()), taskReleaseEty.getCashOrWelfare(), "#FD2D54");
         textView.setBackgroundResource(R.drawable.shape_red_stroke_rectangle_no_lb);
@@ -2367,7 +2413,7 @@ public class CommonUtil {
                 Jump2View.getInstance().goGameMakeMoney(activity, 0);
                 break;
             case 12://闲玩任务
-                Jump2View.getInstance().goXianwanWeb(activity, null, null);
+                Jump2View.getInstance().goXianWanWeb(activity, null);
                 break;
             case 13://游戏代充
                 Jump2View.getInstance().goGameRecharge(activity, null);
@@ -2451,16 +2497,19 @@ public class CommonUtil {
      * 0,--------1,已接受任务 2,正在进行中,3完成任务,4放弃任务,5任务失败,6审核失败,7提交审核,8任务已下线,9至少完成了一个任务了
      */
     public void palyGameDetailBtnValue(final Context context, final GameEntity gameEntity, final TextView detail_task_tv_center, final int type) {
-        final TaskReleaseEty releaseEty = gameEntity.getRelease_task();
+        if (detail_task_tv_center == null)
+            return;
+        final boolean showSimpleText = detail_task_tv_center.getText().length() < 4;
+        final Release_task releaseEty = gameEntity.getRelease_task();
         final TaskEty taskEty = releaseEty != null ? releaseEty.getTask() : null;
         if (releaseEty != null && taskEty != null) {//游戏任务
 
             if (taskEty.isGameReservationCantDownload()) {//预约
                 if (gameEntity.getStatus() == 1 || gameEntity.getStatus() == 2 || gameEntity.getStatus() == 3) {
-                    detail_task_tv_center.setText("已经预约");
+                    detail_task_tv_center.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
                     detail_task_tv_center.setEnabled(false);
                 } else {
-                    detail_task_tv_center.setText("预约下载");
+                    detail_task_tv_center.setText(DownloadTextUtl.getReservationText(showSimpleText));
                     detail_task_tv_center.setEnabled(true);
                     if (type == 0) {
                         detail_task_tv_center.setOnClickListener(new View.OnClickListener() {
@@ -2471,7 +2520,7 @@ public class CommonUtil {
                                     public void call(Integer integer) {
                                         if (integer > 0) {
                                             gameEntity.setAccepted_task_id(integer);
-                                            detail_task_tv_center.setText("已预约");
+                                            detail_task_tv_center.setText(DownloadTextUtl.getHasReservationText(showSimpleText));
                                             detail_task_tv_center.setEnabled(false);
 
                                         }
@@ -2537,7 +2586,7 @@ public class CommonUtil {
      * 抢任务
      */
     public void robTask(final Action1<RobTask> action1) {
-        SheepApp.getInstance().getNetComponent().getApiService().getNewTask(SheepApp.getInstance().getOrder())
+        SheepApp.getInstance().getNetComponent().getApiService().getNewTask(DataUtil.getAsInt(DataKey.KEY_ORDER, 1))
                 .subscribeOn(Schedulers.io())
                 .observeOn(AndroidSchedulers.mainThread())
                 .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
@@ -2639,7 +2688,7 @@ public class CommonUtil {
     /**
      * 给任务设置标签
      */
-    public void setTaskTag(Context context, View itemView, TaskReleaseEty taskReleaseEty, String show_type) {
+    public void setTaskTag(Context context, View itemView, Release_task taskReleaseEty, String show_type) {
         if (!TextUtils.isEmpty(show_type)) {
             switch (show_type) {
                 case TASK_AUDIT:
@@ -2656,6 +2705,7 @@ public class CommonUtil {
             TaskHelper.setNumText((TextView) itemView.findViewById(R.id.item_num_tv1), taskReleaseEty);
         }
     }
+
     //使webView支持下载文件
     public void setDownloadListener(final Activity activity, WebView webView) {
         webView.setDownloadListener(new DownloadListener() {
@@ -2666,6 +2716,7 @@ public class CommonUtil {
             }
         });
     }
+
     //使webView支持下载文件
     public void setDownloadListener(final Activity activity, com.tencent.smtt.sdk.WebView webView) {
         webView.setDownloadListener(new com.tencent.smtt.sdk.DownloadListener() {
@@ -2677,17 +2728,18 @@ public class CommonUtil {
             }
         });
     }
+
     //显示下载提示框
-    public void showDownloadDialog(final Activity activity, final String url){
+    public void showDownloadDialog(final Activity activity, final String url) {
         final String fileName = com.sheep.gamegroup.util.FileUtil.getFileName(url);
         final File saveFile = new File(DIR, fileName);
         final boolean exists = saveFile.exists();
         ViewUtil.showMsgDialog(activity, new DialogConfig().setTitle("下载提示")
-                .setMsg((exists ? "是否重新下载文件:" : "是否下载文件:" )+ saveFile.getAbsolutePath()).setBtnLeftText("取消下载").setBtnRightText("确认下载")
+                .setMsg((exists ? "是否重新下载文件:" : "是否下载文件:") + saveFile.getAbsolutePath()).setBtnLeftText("取消下载").setBtnRightText("确认下载")
                 .setBtnRightOnClickListener(new View.OnClickListener() {
                     @Override
                     public void onClick(View view) {
-                        if(exists && saveFile.delete()){
+                        if (exists && saveFile.delete()) {
                             LogUtil.println("setDownloadListener", "setDownloadListener", "onDownloadStart", url, saveFile.getAbsolutePath(), "成功删除原来的文件");
                         }
                         DownloadService.sysDownload(activity, url, fileName, "来自小绵羊的下载:" + fileName, fileName, "系统开始下载apk");

+ 16 - 0
app/src/main/java/com/sheep/gamegroup/util/DataKey.java

@@ -0,0 +1,16 @@
+package com.sheep.gamegroup.util;
+
+/**
+ * Created by realicing on 2018/11/8.
+ * realicing@sina.com
+ */
+public class DataKey {
+    //安装应用时的包名
+    public static final String KEY_INSTALL_APK_PACKAGE_NAME = "installApk_packageName";
+    //抢任务时有个次序,从1开始
+    public static final String KEY_ORDER = "snatch_a_task_order";
+    //将要安装的应用的路径,在接收广播的地方进行监听
+    public static final String KEY_WILL_INSTALL_APK_PATH = "will_install_apk_path";
+    //将要安装的应用的包名,在接收广播的地方进行监听
+    public static final String KEY_WILL_INSTALL_APK_PACKAGE_NAME = "will_install_apk_package_name";
+}

+ 38 - 6
app/src/main/java/com/sheep/gamegroup/util/DataUtil.java

@@ -243,6 +243,38 @@ public class DataUtil {
             return ListUtil.emptyList();
         }
     }
+    /**
+     * 获取缓存的数据列表,为空代表没有获取过,为空字符串代表之前获取数据为空列表
+     *
+     * @param key
+     * @param classT
+     * @param <T>
+     * @return
+     */
+    public <T> List<T> getCacheList(String key, Class<T> classT, Conversion<BaseMessage, List<T>> conversion, int page) {
+        String cacheData = aCache.getAsString(SheepApp.getInstance().getConnectAddress().getAppUrl() + "v1/" + key);
+        if (cacheData == null) {
+            return null;
+        } else if (cacheData.isEmpty()) {
+            return ListUtil.emptyList();
+        }
+        if (BuildConfig.XXTEA_ENCRYPT) {
+            cacheData = BaseMessageConverter.decrypt(cacheData);
+        }
+        try {
+            BaseMessage baseMessage = JSON.parseObject(cacheData, BaseMessage.class);
+            if(baseMessage != null) {
+                if (conversion != null) {
+                    return conversion.convert(baseMessage, page);
+                } else {
+                    return baseMessage.getDataList(classT);
+                }
+            }
+        } catch (Exception e) {
+            e.printStackTrace();
+        }
+        return ListUtil.emptyList();
+    }
 
 
     /**
@@ -509,22 +541,22 @@ public class DataUtil {
 
     /**
      * 设置数据到bundle中,注意,其key是类名,所以同一个类只支持一条
+     * @param <T>
      * @param intent
      * @param t
-     * @param <T>
      */
-    public static <T> void putObject(Intent intent, T t) {
-        intent.putExtra(t.getClass().getSimpleName(), JSONObject.toJSONString(t));
+    public static <T> Intent putObject(Intent intent, T t) {
+        return intent.putExtra(t.getClass().getSimpleName(), JSONObject.toJSONString(t));
     }
     /**
      * 设置数据到bundle中
+     * @param <T>
      * @param intent
      * @param t
-     * @param <T>
      * @param key
      */
-    public static <T> void putObject(Intent intent, T t, String key) {
-        intent.putExtra(key, JSONObject.toJSONString(t));
+    public static <T> Intent putObject(Intent intent, T t, String key) {
+        return intent.putExtra(key, JSONObject.toJSONString(t));
     }
 
 

+ 56 - 0
app/src/main/java/com/sheep/gamegroup/util/DownloadTextUtl.java

@@ -0,0 +1,56 @@
+package com.sheep.gamegroup.util;
+
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
+import com.sheep.jiuyan.samllsheep.R;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+
+import java.util.Locale;
+
+/**
+ * Created by realicing on 2018/11/1.
+ * realicing@sina.com
+ * 下载按钮显示的文本
+ */
+public class DownloadTextUtl {
+
+    public static String getHasReservationText(boolean showSimpleText) {
+        return showSimpleText ? "已预约" : "已经预约";
+    }
+    public static String getReservationText(boolean showSimpleText) {
+        return showSimpleText ? "预约" : "预约下载";
+    }
+
+    public static String getStartDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "下载" : CommonUtil.START_DOWNLOAD;
+    }
+    public static String getStartInstallText(boolean showSimpleText) {
+        return showSimpleText ? "安装" : CommonUtil.START_INSTALL;
+    }
+    public static String getStartOpenText(boolean showSimpleText) {
+        return showSimpleText ? "打开" : CommonUtil.GAME_OPEN;
+    }
+    public static String getOpenApplyText(boolean showSimpleText) {
+        return showSimpleText ? "打开" : CommonUtil.OPEN_APPLY;
+    }
+
+    public static String getContinueDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "继续" : CommonUtil.CONTINUE_DOWNLOAD;
+    }
+    public static String getFailDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "失败" : CommonUtil.FAIL_DOWNLOAD;
+    }
+    public static String getTaskCancelText(boolean showSimpleText) {
+        return showSimpleText ? "已取消" : "已经取消";
+    }
+
+    public static String getProgressText(boolean showSimpleText, DownLoadInfo task) {
+        if(showSimpleText)
+            return String.format(Locale.CHINA, "%d%%", Math.abs(task.getMPercent()));
+        else
+            return String.format(Locale.CHINA, "%d%%(%s)", Math.abs(task.getMPercent()), task.getAverageSpeed());//添加下载速度;
+    }
+
+    public static String getNoDownloadText(boolean showSimpleText) {
+        return showSimpleText ? "无下载" : SheepApp.getInstance().getResources().getString(R.string.error_download_link);
+    }
+}

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


Неке датотеке нису приказане због велике количине промена