Browse Source

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

liujiangyao 7 years ago
parent
commit
2d23294b30

+ 4 - 1
app/src/main/AndroidManifest.xml

@@ -120,7 +120,10 @@
 
         <service android:name=".service.DownloadService" />
         <service
-            android:name=".service.AutoCheckService"/>
+            android:name=".service.AutoCheckService"
+            android:priority="1000"
+            android:exported="false"
+            android:process=":auto_check"/>
         <service
             android:name=".service.FloatShotScreenService" />
         <service

+ 0 - 45
app/src/main/java/com/sheep/gamegroup/receiver/AppAddOrDelReceiver.java

@@ -7,16 +7,10 @@ import android.os.Handler;
 import android.os.Looper;
 import android.text.TextUtils;
 
-import com.alibaba.fastjson.JSONObject;
 import com.kfzs.duanduan.utils.ApkUtils;
-import com.sheep.gamegroup.greendao.DDProviderHelper;
-import com.sheep.gamegroup.greendao.download.DownLoadInfo;
-import com.sheep.gamegroup.util.DeviceUtil;
-import com.sheep.gamegroup.util.NetUtil;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 
-
 import org.greenrobot.eventbus.EventBus;
 
 
@@ -27,44 +21,6 @@ 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())){
-            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:","");
-                        final DownLoadInfo downLoadInfo = DDProviderHelper.getInstance()
-                                .getDownloadTaskToPackname(context, packages);
-                        if(downLoadInfo == null){
-                            return;
-                        }
-                        new Thread(){
-                            @Override
-                            public void run() {
-                                super.run();
-                                try {
-                                    JSONObject jsonObject = new JSONObject();
-                                    jsonObject.put("device_id",DeviceUtil.getDeviceId(SheepApp.getInstance())+"");
-                                    jsonObject.put("id",downLoadInfo.getMGameID());
-                                    NetUtil.getNetUtil().sendAppDownload(context, jsonObject);
-
-                                } catch (Exception e) {
-                                    e.printStackTrace();
-                                }
-                            }
-                        }.start();
-                    }
-                }, 0);
-            } catch (Exception e1) {
-                e1.printStackTrace();
-            }
-        }
-
         if(Intent.ACTION_PACKAGE_ADDED.equals(intent.getAction()) || Intent.ACTION_PACKAGE_REMOVED.equals(intent.getAction()) || Intent.ACTION_PACKAGE_REPLACED.equals(intent.getAction())){
             ApkUtils.getInstance().clear();
             EventBus.getDefault().post(intent);
@@ -75,7 +31,6 @@ public class AppAddOrDelReceiver extends BroadcastReceiver {
          */
         if(Intent.ACTION_INSTALL_FAILURE.equals(intent.getAction())){
             try {
-
                 new Handler(Looper.getMainLooper()).postDelayed(new Runnable() {
                     @Override
                     public void run() {

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

@@ -7,15 +7,8 @@ import android.content.Intent;
 import android.net.ConnectivityManager;
 import android.net.NetworkInfo;
 
-import com.alibaba.fastjson.JSONObject;
-import com.sheep.gamegroup.model.api.ApiService;
-import com.sheep.gamegroup.model.entity.BaseMessage;
-import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.jiuyan.samllsheep.SheepApp;
 
-import rx.android.schedulers.AndroidSchedulers;
-import rx.schedulers.Schedulers;
-
 /**
  * Created by ljy on 2018/3/8.
  */
@@ -95,27 +88,4 @@ public class NetUtil {
         intent.setAction("android.intent.action.VIEW");
         activity.startActivityForResult(intent, 0);
     }
-
-    /**
-     * 应用下载,接口请求
-     */
-    public void sendAppDownload(Context context, JSONObject o){
-        ApiService apiService = SheepApp.getInstance().getNetComponent().getApiService();
-
-        apiService.taskDownloadNotify(o)
-                .subscribeOn(Schedulers.io())
-                .observeOn(AndroidSchedulers.mainThread())
-                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
-                    @Override
-                    public void onError(BaseMessage baseMessage) {
-
-                    }
-
-                    @Override
-                    public void onNext(BaseMessage baseMessage) {
-
-                    }
-                });
-
-    }
 }

+ 8 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/ActMyMoney.java

@@ -10,6 +10,8 @@ import android.widget.ImageView;
 import android.widget.TextView;
 
 import com.kfzs.duanduan.utils.NumberFormatUtils;
+import com.sheep.gamegroup.util.CommonUtil;
+import com.sheep.gamegroup.util.DataUtil;
 import com.sheep.gamegroup.view.fragment.FgtMyMoney1;
 import com.sheep.gamegroup.view.fragment.FgtMyMoney2;
 import com.sheep.gamegroup.view.fragment.FgtMyMoney3;
@@ -26,6 +28,8 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
+import org.afinal.simplecache.ApiKey;
+
 import butterknife.BindView;
 import butterknife.OnClick;
 import rx.android.schedulers.AndroidSchedulers;
@@ -152,6 +156,10 @@ public class ActMyMoney extends BaseActivity {
                         .subscribe(new SheepSubscriber<BaseMessage>(this) {
                             @Override
                             public void onNext(BaseMessage baseMessage) {
+                                boolean isNewData = DataUtil.getInstance().isNewData(ApiKey.MY_ASSETS);
+                                if(isNewData){
+                                    CommonUtil.getInstance().updateUserInfo(null);
+                                }
                                 UserAssets userAssets = baseMessage.getData(UserAssets.class);
                                 loadData(userAssets);
                                 hideProgress();

+ 4 - 4
app/src/main/java/com/sheep/gamegroup/view/customview/CalendarMonthView.java

@@ -61,7 +61,7 @@ public class CalendarMonthView extends MonthView {
     protected void onDrawScheme(Canvas canvas, Calendar calendar, int x, int y) {
         this.mSchemeBasicPaint.setColor(calendar.getSchemeColor());
 //        canvas.drawRect((float) (x + this.mPadding), (float) (y + this.mPadding), (float) (x + this.mItemWidth - this.mPadding), (float) (y + this.mItemHeight - this.mPadding), this.mSchemeBasicPaint);
-        canvas.drawRect((float) (x), (float) (y - this.mPadding / 2), (float) (x + this.mItemWidth), (float) (y + this.mItemHeight - this.mPadding / 2), this.mSchemeBasicPaint);
+        canvas.drawRect((float) (x), y - this.mPadding / 2.0F, x + this.mItemWidth + (calendar.getWeek() == 0 ? this.mPadding : 0), y + this.mItemHeight - this.mPadding / 2.0F, this.mSchemeBasicPaint);
 //        canvas.drawRoundRect((float) (x + this.mPadding), (float) (y + this.mPadding), (float) (x + this.mItemWidth - this.mPadding), (float) (y + this.mItemHeight - this.mPadding), this.mSchemeBasicPaint);
 //        canvas.drawText(calendar.getScheme(), (float) (x + this.mItemWidth - this.mPadding) - this.mRadio / 2.0F - this.getTextWidth(calendar.getScheme()) / 2.0F, (float) (y + this.mPadding) + this.mSchemeBaseLine, this.mTextPaint);
     }
@@ -105,7 +105,7 @@ public class CalendarMonthView extends MonthView {
     //画当天背景
     protected void onDrawCurDay(Canvas canvas, Calendar calendar, int x, int y, boolean hasScheme) {
         this.mCurDayPaint.setStyle(Paint.Style.FILL);
-        canvas.drawCircle((float) (x + this.mItemWidth / 2.0F), (float) (y - this.mPadding + this.mItemWidth / 2.0F), this.mItemWidth * 2 / 5, this.mCurDayPaint);
+        canvas.drawCircle(x + this.mItemWidth / 2.0F, y + this.mItemHeight / 2.0F, (Math.min(this.mItemHeight, this.mItemWidth) - this.mPadding) / 2.0F, this.mCurDayPaint);
     }
 
     /**
@@ -115,8 +115,8 @@ public class CalendarMonthView extends MonthView {
      * @param dpValue dp
      * @return px
      */
-    static float dipToPx(Context context, float dpValue) {
+    static int dipToPx(Context context, float dpValue) {
         final float scale = context.getResources().getDisplayMetrics().density;
-        return dpValue * scale + 0.5f;
+        return (int) (dpValue * scale + 0.5f);
     }
 }

+ 1 - 1
app/src/main/java/com/sheep/jiuyan/samllsheep/service/AutoCheckService.java

@@ -98,7 +98,7 @@ public class AutoCheckService extends Service {
     public static final String EXTRA_KEY_TASK_LIST = "task_list";
     public static final String EXTRA_KEY_USER_ID = "user_id";
     //是否采用该方案
-    public static final boolean IS_USE_THIS_SERVICE = android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP;
+    public static final boolean IS_USE_THIS_SERVICE = /*BuildConfig.DEBUG || */android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP;
     //登录的用户id
     private String userId;
     @Override

+ 5 - 3
app/src/main/java/com/sheep/jiuyan/samllsheep/service/ListenerShotService.java

@@ -19,7 +19,7 @@ import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.RunningTaskUtil;
 import com.sheep.gamegroup.util.ScreenShotListenManager;
-import com.sheep.gamegroup.view.activity.ActMain;
+import com.sheep.gamegroup.view.activity.SplashAct;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.utils.FileUtil;
 
@@ -69,10 +69,12 @@ public class ListenerShotService extends Service {
         notification.contentView = new RemoteViews(getPackageName(), R.layout.notification_sheep_shot_screen);
 
         //点击通知栏跳转到相应的应用里面
-        Intent intent = new Intent(this, ActMain.class);
+        Intent notificationIntent = new Intent(this, SplashAct.class);
+        notificationIntent.setAction(Intent.ACTION_MAIN);
+        notificationIntent.addCategory(Intent.CATEGORY_LAUNCHER);
         //这一句加不加没什么影响
 // intent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
-        notification.contentIntent = PendingIntent.getActivity(this, 1, intent, 0);
+        notification.contentIntent = PendingIntent.getActivity(this, 1, notificationIntent, 0);
 
         //这里的id不能是0
         startForeground(113922, notification);

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

@@ -95,5 +95,6 @@ public class ApiKey {
     }
     public static final String slideshowGame = "app/game_banner?platform=1";
     public static final String friend_count_and_award = "app/user/friend_count_and_award";
+    public static final String MY_ASSETS = "app/user/my_assets";
 
 }

+ 10 - 8
app/src/main/res/layout/notification_sheep_shot_screen.xml

@@ -2,19 +2,21 @@
 <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
     android:layout_width="match_parent"
     android:layout_height="match_parent"
-    android:gravity="center">
+    android:gravity="center_vertical"
+    android:orientation="horizontal"
+    android:padding="13dp">
 
     <ImageView
-        android:layout_width="40dp"
-        android:layout_height="40dp"
-        android:layout_marginStart="20dp"
+        android:layout_width="35dp"
+        android:layout_height="35dp"
         android:src="@mipmap/icon" />
 
     <TextView
-        android:layout_width="match_parent"
-        android:layout_height="match_parent"
+        android:layout_width="wrap_content"
+        android:layout_height="wrap_content"
+        android:layout_marginStart="15dp"
         android:gravity="center"
         android:text="点击回到小绵羊"
-        android:textColor="@color/black_333333"
-        android:textSize="18sp" />
+        android:textColor="@color/white"
+        android:textSize="16sp" />
 </LinearLayout>