Quellcode durchsuchen

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

zengjiebin vor 7 Jahren
Ursprung
Commit
4e48fb87ec

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

@@ -21,26 +21,26 @@ public class DaoMaster extends AbstractDaoMaster {
 
     /** Creates underlying database table using DAOs. */
     public static void createAllTables(Database db, boolean ifNotExists) {
-        AcceptTaskRecordDao.createTable(db, ifNotExists);
-        AccountDao.createTable(db, ifNotExists);
-        AppdownloadBeanDao.createTable(db, ifNotExists);
-        DownLoadInfoDao.createTable(db, ifNotExists);
         ProcessRecordDao.createTable(db, ifNotExists);
-        ScreenShotRecordDao.createTable(db, ifNotExists);
+        AppdownloadBeanDao.createTable(db, ifNotExists);
         SdkLoginUserDao.createTable(db, ifNotExists);
+        ScreenShotRecordDao.createTable(db, ifNotExists);
+        AcceptTaskRecordDao.createTable(db, ifNotExists);
+        AccountDao.createTable(db, ifNotExists);
         SearchRecordDao.createTable(db, ifNotExists);
+        DownLoadInfoDao.createTable(db, ifNotExists);
     }
 
     /** Drops underlying database table using DAOs. */
     public static void dropAllTables(Database db, boolean ifExists) {
-        AcceptTaskRecordDao.dropTable(db, ifExists);
-        AccountDao.dropTable(db, ifExists);
-        AppdownloadBeanDao.dropTable(db, ifExists);
-        DownLoadInfoDao.dropTable(db, ifExists);
         ProcessRecordDao.dropTable(db, ifExists);
-        ScreenShotRecordDao.dropTable(db, ifExists);
+        AppdownloadBeanDao.dropTable(db, ifExists);
         SdkLoginUserDao.dropTable(db, ifExists);
+        ScreenShotRecordDao.dropTable(db, ifExists);
+        AcceptTaskRecordDao.dropTable(db, ifExists);
+        AccountDao.dropTable(db, ifExists);
         SearchRecordDao.dropTable(db, ifExists);
+        DownLoadInfoDao.dropTable(db, ifExists);
     }
 
     /**
@@ -59,14 +59,14 @@ public class DaoMaster extends AbstractDaoMaster {
 
     public DaoMaster(Database db) {
         super(db, SCHEMA_VERSION);
-        registerDaoClass(AcceptTaskRecordDao.class);
-        registerDaoClass(AccountDao.class);
-        registerDaoClass(AppdownloadBeanDao.class);
-        registerDaoClass(DownLoadInfoDao.class);
         registerDaoClass(ProcessRecordDao.class);
-        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(AppdownloadBeanDao.class);
         registerDaoClass(SdkLoginUserDao.class);
+        registerDaoClass(ScreenShotRecordDao.class);
+        registerDaoClass(AcceptTaskRecordDao.class);
+        registerDaoClass(AccountDao.class);
         registerDaoClass(SearchRecordDao.class);
+        registerDaoClass(DownLoadInfoDao.class);
     }
 
     public DaoSession newSession() {

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

@@ -8,23 +8,23 @@ import org.greenrobot.greendao.database.Database;
 import org.greenrobot.greendao.identityscope.IdentityScopeType;
 import org.greenrobot.greendao.internal.DaoConfig;
 
-import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
-import com.sheep.gamegroup.greendao.download.Account;
-import com.sheep.gamegroup.greendao.download.AppdownloadBean;
-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.AppdownloadBean;
 import com.sheep.gamegroup.greendao.download.SdkLoginUser;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecord;
+import com.sheep.gamegroup.greendao.download.AcceptTaskRecord;
+import com.sheep.gamegroup.greendao.download.Account;
 import com.sheep.gamegroup.greendao.download.SearchRecord;
+import com.sheep.gamegroup.greendao.download.DownLoadInfo;
 
-import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
-import com.sheep.gamegroup.greendao.download.AccountDao;
-import com.sheep.gamegroup.greendao.download.AppdownloadBeanDao;
-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.AppdownloadBeanDao;
 import com.sheep.gamegroup.greendao.download.SdkLoginUserDao;
+import com.sheep.gamegroup.greendao.download.ScreenShotRecordDao;
+import com.sheep.gamegroup.greendao.download.AcceptTaskRecordDao;
+import com.sheep.gamegroup.greendao.download.AccountDao;
 import com.sheep.gamegroup.greendao.download.SearchRecordDao;
+import com.sheep.gamegroup.greendao.download.DownLoadInfoDao;
 
 // THIS CODE IS GENERATED BY greenDAO, DO NOT EDIT.
 
@@ -35,112 +35,112 @@ import com.sheep.gamegroup.greendao.download.SearchRecordDao;
  */
 public class DaoSession extends AbstractDaoSession {
 
-    private final DaoConfig acceptTaskRecordDaoConfig;
-    private final DaoConfig accountDaoConfig;
-    private final DaoConfig appdownloadBeanDaoConfig;
-    private final DaoConfig downLoadInfoDaoConfig;
     private final DaoConfig processRecordDaoConfig;
-    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig appdownloadBeanDaoConfig;
     private final DaoConfig sdkLoginUserDaoConfig;
+    private final DaoConfig screenShotRecordDaoConfig;
+    private final DaoConfig acceptTaskRecordDaoConfig;
+    private final DaoConfig accountDaoConfig;
     private final DaoConfig searchRecordDaoConfig;
+    private final DaoConfig downLoadInfoDaoConfig;
 
-    private final AcceptTaskRecordDao acceptTaskRecordDao;
-    private final AccountDao accountDao;
-    private final AppdownloadBeanDao appdownloadBeanDao;
-    private final DownLoadInfoDao downLoadInfoDao;
     private final ProcessRecordDao processRecordDao;
-    private final ScreenShotRecordDao screenShotRecordDao;
+    private final AppdownloadBeanDao appdownloadBeanDao;
     private final SdkLoginUserDao sdkLoginUserDao;
+    private final ScreenShotRecordDao screenShotRecordDao;
+    private final AcceptTaskRecordDao acceptTaskRecordDao;
+    private final AccountDao accountDao;
     private final SearchRecordDao searchRecordDao;
+    private final DownLoadInfoDao downLoadInfoDao;
 
     public DaoSession(Database db, IdentityScopeType type, Map<Class<? extends AbstractDao<?, ?>>, DaoConfig>
             daoConfigMap) {
         super(db);
 
-        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
-        acceptTaskRecordDaoConfig.initIdentityScope(type);
-
-        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
-        accountDaoConfig.initIdentityScope(type);
+        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
+        processRecordDaoConfig.initIdentityScope(type);
 
         appdownloadBeanDaoConfig = daoConfigMap.get(AppdownloadBeanDao.class).clone();
         appdownloadBeanDaoConfig.initIdentityScope(type);
 
-        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
-        downLoadInfoDaoConfig.initIdentityScope(type);
-
-        processRecordDaoConfig = daoConfigMap.get(ProcessRecordDao.class).clone();
-        processRecordDaoConfig.initIdentityScope(type);
+        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
+        sdkLoginUserDaoConfig.initIdentityScope(type);
 
         screenShotRecordDaoConfig = daoConfigMap.get(ScreenShotRecordDao.class).clone();
         screenShotRecordDaoConfig.initIdentityScope(type);
 
-        sdkLoginUserDaoConfig = daoConfigMap.get(SdkLoginUserDao.class).clone();
-        sdkLoginUserDaoConfig.initIdentityScope(type);
+        acceptTaskRecordDaoConfig = daoConfigMap.get(AcceptTaskRecordDao.class).clone();
+        acceptTaskRecordDaoConfig.initIdentityScope(type);
+
+        accountDaoConfig = daoConfigMap.get(AccountDao.class).clone();
+        accountDaoConfig.initIdentityScope(type);
 
         searchRecordDaoConfig = daoConfigMap.get(SearchRecordDao.class).clone();
         searchRecordDaoConfig.initIdentityScope(type);
 
-        acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
-        accountDao = new AccountDao(accountDaoConfig, this);
-        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
-        downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
+        downLoadInfoDaoConfig = daoConfigMap.get(DownLoadInfoDao.class).clone();
+        downLoadInfoDaoConfig.initIdentityScope(type);
+
         processRecordDao = new ProcessRecordDao(processRecordDaoConfig, this);
-        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        appdownloadBeanDao = new AppdownloadBeanDao(appdownloadBeanDaoConfig, this);
         sdkLoginUserDao = new SdkLoginUserDao(sdkLoginUserDaoConfig, this);
+        screenShotRecordDao = new ScreenShotRecordDao(screenShotRecordDaoConfig, this);
+        acceptTaskRecordDao = new AcceptTaskRecordDao(acceptTaskRecordDaoConfig, this);
+        accountDao = new AccountDao(accountDaoConfig, this);
         searchRecordDao = new SearchRecordDao(searchRecordDaoConfig, this);
+        downLoadInfoDao = new DownLoadInfoDao(downLoadInfoDaoConfig, this);
 
-        registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
-        registerDao(Account.class, accountDao);
-        registerDao(AppdownloadBean.class, appdownloadBeanDao);
-        registerDao(DownLoadInfo.class, downLoadInfoDao);
         registerDao(ProcessRecord.class, processRecordDao);
-        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(AppdownloadBean.class, appdownloadBeanDao);
         registerDao(SdkLoginUser.class, sdkLoginUserDao);
+        registerDao(ScreenShotRecord.class, screenShotRecordDao);
+        registerDao(AcceptTaskRecord.class, acceptTaskRecordDao);
+        registerDao(Account.class, accountDao);
         registerDao(SearchRecord.class, searchRecordDao);
+        registerDao(DownLoadInfo.class, downLoadInfoDao);
     }
     
     public void clear() {
-        acceptTaskRecordDaoConfig.clearIdentityScope();
-        accountDaoConfig.clearIdentityScope();
-        appdownloadBeanDaoConfig.clearIdentityScope();
-        downLoadInfoDaoConfig.clearIdentityScope();
         processRecordDaoConfig.clearIdentityScope();
-        screenShotRecordDaoConfig.clearIdentityScope();
+        appdownloadBeanDaoConfig.clearIdentityScope();
         sdkLoginUserDaoConfig.clearIdentityScope();
+        screenShotRecordDaoConfig.clearIdentityScope();
+        acceptTaskRecordDaoConfig.clearIdentityScope();
+        accountDaoConfig.clearIdentityScope();
         searchRecordDaoConfig.clearIdentityScope();
+        downLoadInfoDaoConfig.clearIdentityScope();
     }
 
-    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
-        return acceptTaskRecordDao;
-    }
-
-    public AccountDao getAccountDao() {
-        return accountDao;
+    public ProcessRecordDao getProcessRecordDao() {
+        return processRecordDao;
     }
 
     public AppdownloadBeanDao getAppdownloadBeanDao() {
         return appdownloadBeanDao;
     }
 
-    public DownLoadInfoDao getDownLoadInfoDao() {
-        return downLoadInfoDao;
-    }
-
-    public ProcessRecordDao getProcessRecordDao() {
-        return processRecordDao;
+    public SdkLoginUserDao getSdkLoginUserDao() {
+        return sdkLoginUserDao;
     }
 
     public ScreenShotRecordDao getScreenShotRecordDao() {
         return screenShotRecordDao;
     }
 
-    public SdkLoginUserDao getSdkLoginUserDao() {
-        return sdkLoginUserDao;
+    public AcceptTaskRecordDao getAcceptTaskRecordDao() {
+        return acceptTaskRecordDao;
+    }
+
+    public AccountDao getAccountDao() {
+        return accountDao;
     }
 
     public SearchRecordDao getSearchRecordDao() {
         return searchRecordDao;
     }
 
+    public DownLoadInfoDao getDownLoadInfoDao() {
+        return downLoadInfoDao;
+    }
+
 }

+ 9 - 0
app/src/main/java/com/sheep/gamegroup/model/api/ApiService.java

@@ -514,6 +514,15 @@ public interface ApiService {
     Observable<BaseMessage> getRechargePayway(@Query("type") String page);
 
     /**
+     * 获取下发充值类型
+     *
+     * @param orderNo
+     * @return
+     */
+    @POST("app/sdk/pay/wx")
+    Observable<BaseMessage> getPayWxParams(@Query("order_no") String orderNo);
+
+    /**
      * 充值
      *
      * @param jsonObject

+ 7 - 3
app/src/main/java/com/sheep/gamegroup/module/pay/activity/SheepWXPayEntryActivity.java

@@ -27,6 +27,7 @@ public abstract class SheepWXPayEntryActivity extends Activity implements IWXAPI
 
     private static final String TAG = "SheepWXPayEntryActivity";
 
+    public static boolean close = false;
 
     @Override
     public void onCreate(Bundle savedInstanceState) {
@@ -63,9 +64,12 @@ public abstract class SheepWXPayEntryActivity extends Activity implements IWXAPI
             }
             result = String.valueOf(resp.errCode + 9000);//"9000" 代表支付成功
         }
-        if(resp instanceof PayResp)
-            EventBus.getDefault().post(resp);
-        Jump2View.getInstance().goRechargeResultAct(this, result);
+
+        EventBus.getDefault().post(resp);
+//        if (!close) {
+            Jump2View.getInstance().goRechargeResultAct(this, result);
+//        }
+        SheepWXPayEntryActivity.close = false;
         finish();
     }
 }

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

@@ -62,6 +62,7 @@ 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.module.pay.activity.SheepWXPayEntryActivity;
 import com.sheep.gamegroup.usage.AppUsageManager;
 import com.sheep.gamegroup.view.activity.ActMain;
 import com.sheep.gamegroup.view.activity.GameTaskOrderListAct;

+ 34 - 25
app/src/main/java/com/sheep/gamegroup/util/ViewUtil.java

@@ -311,7 +311,7 @@ public class ViewUtil {
 
     public static void dismiss(final AlertDialog dialog, int delay) {
         if (dialog != null) {
-            AbsObserver<Integer> absObserver =new AbsObserver<Integer>() {
+            AbsObserver<Integer> absObserver = new AbsObserver<Integer>() {
                 @Override
                 public void onNext(Integer integer) {
                     try {
@@ -343,7 +343,7 @@ public class ViewUtil {
     }
 
     public static void setTextSize(TextView textView, int tsType, int textSize) {
-        if(textView != null){
+        if (textView != null) {
             textView.setTextSize(tsType, textSize);
         }
     }
@@ -480,7 +480,7 @@ public class ViewUtil {
      * @param textView
      */
     public static void setDefaultText(TextView textView) {
-        if(textView == null){
+        if (textView == null) {
             return;
         }
         String text = textView.getText().toString();
@@ -530,7 +530,7 @@ public class ViewUtil {
         });
         edInvitationCode.setOnLongClickListener(view1 -> {
             CharSequence text = StringUtils.getCopyText();
-            if(!TextUtils.isEmpty(text)){
+            if (!TextUtils.isEmpty(text)) {
                 edInvitationCode.setText(text);
             }
             return false;
@@ -1282,6 +1282,7 @@ public class ViewUtil {
         }
         return dialog;
     }
+
     public static AlertDialog showUpgradeDialog(Context mContext, final DialogConfig dialogConfig) {
         String title = dialogConfig.getTitle();
         String msg = dialogConfig.getMsg();
@@ -1408,7 +1409,7 @@ public class ViewUtil {
                 .create();
         GifImageView dialog_gif = dialog_parent.findViewById(R.id.dialog_gif);
         Drawable drawable = dialog_gif.getDrawable();
-        if(drawable instanceof GifDrawable){
+        if (drawable instanceof GifDrawable) {
             ((GifDrawable) drawable).addAnimationListener(loopNumber -> {
                 try {
                     dialog.dismiss();
@@ -1428,9 +1429,10 @@ public class ViewUtil {
 
     //显示游戏对话框  点击前往或者x会向粘贴板中写入空数据
     public static void showGameDialog(Applications applications, View.OnClickListener onClickListener) {
-        Context mContext = SheepApp.getInstance();
+        if (SheepApp.getInstance().getCurrentActivity() == null) return;
+        Context mContext = SheepApp.getInstance().getCurrentActivity();
         View dialog_parent = View.inflate(SheepApp.getInstance(), R.layout.dialog_parent, null);
-        final AlertDialog dialog = new AlertDialog.Builder(mContext,R.style.AppTheme_Dialog_Alert).setView(dialog_parent).create();
+        final AlertDialog dialog = new AlertDialog.Builder(mContext, R.style.AppTheme_Dialog_Alert).setView(dialog_parent).create();
         LinearLayout dialog_center_ll = dialog_parent.findViewById(R.id.dialog_center_ll);
         TextView dialog_title = dialog_parent.findViewById(R.id.dialog_title);
         View dialog_close = dialog_parent.findViewById(R.id.dialog_close);
@@ -1456,9 +1458,9 @@ public class ViewUtil {
             dismiss(dialog, 0);
         });
 
-        if (dialog.getWindow() != null) {
-            dialog.getWindow().setType(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? WindowManager.LayoutParams.TYPE_PHONE : WindowManager.LayoutParams.TYPE_TOAST);
-        }
+//        if (dialog.getWindow() != null) {
+//            dialog.getWindow().setType(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N ? WindowManager.LayoutParams.TYPE_PHONE : WindowManager.LayoutParams.TYPE_TOAST);
+//        }
         try {
             dialog.show();
         } catch (Exception e) {
@@ -1466,6 +1468,7 @@ public class ViewUtil {
         }
 
     }
+
     /**
      * 通过map来设置字体颜色
      *
@@ -1739,7 +1742,7 @@ public class ViewUtil {
                                 @Override
                                 public void onNext(BaseMessage baseMessage) {
                                     ReceiveCouponsResp receiveCouponsResp = baseMessage.getData(ReceiveCouponsResp.class);
-                                    if(receiveCouponsResp != null){
+                                    if (receiveCouponsResp != null) {
                                         Jump2View.getInstance().goWeb(activity, new WebParams(receiveCouponsResp.getBuy_url(), Config.YF_SHOP_NAME).setShowTitle(false));
                                     }
                                 }
@@ -1759,6 +1762,7 @@ public class ViewUtil {
             }
         }
     }
+
     //3.4.7添加 -- 展示 元旦活动中 提示用户邀请人数到达一定数量时,获得了礼品,需要填写收件地址 对话框
     public static void showYfShopAsk(final Activity activity, String btnText, String content, Action1<AlertDialog> action1) {
         if (activity != null) {
@@ -1793,7 +1797,7 @@ public class ViewUtil {
             dialog_yf_shop_ask_btn_tv.setOnClickListener(new View.OnClickListener() {
                 @Override
                 public void onClick(View v) {
-                    if(action1 != null){
+                    if (action1 != null) {
                         action1.call(dialog);
                     }
                 }
@@ -1900,7 +1904,7 @@ public class ViewUtil {
 
     public static void setImage(ImageView imageView, Object object) {
         if (imageView != null) {
-            if(object instanceof String) {
+            if (object instanceof String) {
                 String pictures = object.toString();
                 if (TextUtils.isEmpty(pictures)) {
                     imageView.setImageResource(SkinUtil.getAppIcon());
@@ -1937,13 +1941,14 @@ public class ViewUtil {
     public static void setViewWH(View view, int width, float radio) {
         LayoutParamsUtil.resetLayoutParams(view, new Lp().setWidth(width).setHeight((int) (width * radio)));
     }
+
     public static void setImageWH(ImageView view, String url, int width, int radius) {
-        if(url == null || view == null){
+        if (url == null || view == null) {
             return;
         }
-        int w = DataUtil.getAsInt(url+"_w", 0);
-        int h = DataUtil.getAsInt(url+"_h", 0);
-        if(w > 0 && h > 0) {
+        int w = DataUtil.getAsInt(url + "_w", 0);
+        int h = DataUtil.getAsInt(url + "_h", 0);
+        if (w > 0 && h > 0) {
             float radio = h * 1.0f / w;
             ViewUtil.setViewWH(view, width, radio);
         } else {
@@ -1961,8 +1966,8 @@ public class ViewUtil {
                     public boolean onResourceReady(Drawable resource, Object model, Target<Drawable> target, DataSource dataSource, boolean isFirstResource) {
                         int w = resource.getIntrinsicWidth();
                         int h = resource.getIntrinsicHeight();
-                        DataUtil.putAsInt(url+"_w", w);
-                        DataUtil.putAsInt(url+"_h", h);
+                        DataUtil.putAsInt(url + "_w", w);
+                        DataUtil.putAsInt(url + "_h", h);
                         return false;
                     }
                 })
@@ -2021,6 +2026,7 @@ public class ViewUtil {
             }
         }
     }
+
     public static void roundedCornersImage1(ImageView imageView, String pictures, int radius) {
         if (imageView != null) {
             if (TextUtils.isEmpty(pictures)) {
@@ -2211,6 +2217,7 @@ public class ViewUtil {
             view.setVisibility(isVisible ? View.VISIBLE : View.GONE);
         }
     }
+
     public static void setVisibility(View view, int visible) {
         if (view != null) {
             view.setVisibility(visible);
@@ -2360,9 +2367,9 @@ public class ViewUtil {
         int[] pngs = {
 //        R.mipmap.share_face_to_face");
                 R.mipmap.share_wx,
-        R.mipmap.share_qq,
-        R.mipmap.share_weixin_circle,
-        R.mipmap.share_qzone,
+                R.mipmap.share_qq,
+                R.mipmap.share_weixin_circle,
+                R.mipmap.share_qzone,
 //        R.mipmap.share_copy_share_link,
         };
         final List<String> nameList = ListUtil.emptyList();
@@ -2537,13 +2544,14 @@ public class ViewUtil {
 
         return view;
     }
+
     public static void showThenHide(Activity activity, View view, boolean isShow) {
         ViewUtil.setVisibility(view, true);
         int a = -1;
         int b = 2;
         int y1 = isShow ? a : b;
         int y2 = isShow ? b : a;
-        Animation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF,0,Animation.RELATIVE_TO_SELF, 0,Animation.RELATIVE_TO_SELF, y1,Animation.RELATIVE_TO_SELF, y2);//平移动画
+        Animation translateAnimation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, y1, Animation.RELATIVE_TO_SELF, y2);//平移动画
         translateAnimation.setDuration(200);//动画持续的时间
         translateAnimation.setFillEnabled(true);//使其可以填充效果从而不回到原地
         translateAnimation.setFillAfter(true);//不回到起始位置
@@ -2557,7 +2565,7 @@ public class ViewUtil {
 
             @Override
             public void onAnimationEnd(Animation animation) {
-                if(isShow) {//显示几秒后消失
+                if (isShow) {//显示几秒后消失
                     ViewUtil.delay(new AbsObserver<Integer>() {
                         @Override
                         public void onNext(Integer integer) {
@@ -2569,7 +2577,7 @@ public class ViewUtil {
                 } else {
                     ViewUtil.setVisibility(view, false);
                     ViewParent viewParent = view.getParent();
-                    if(viewParent instanceof ViewGroup){
+                    if (viewParent instanceof ViewGroup) {
                         ViewGroup viewGroup = (ViewGroup) viewParent;
                         viewGroup.removeView(view);
                         viewGroup.setTag(null);
@@ -2594,6 +2602,7 @@ public class ViewUtil {
             e.printStackTrace();
         }
     }
+
     //取消注册eventBus
     public static void unregister(Object object) {
         try {

+ 95 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/ActPay.java

@@ -2,12 +2,28 @@ package com.sheep.gamegroup.view.activity;
 
 import android.content.Intent;
 import android.os.Bundle;
+import android.text.TextUtils;
+
+import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.WebParams;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
+import com.sheep.gamegroup.module.pay.activity.SheepWXPayEntryActivity;
 import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.Constant;
 import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.jiuyan.samllsheep.Config;
+import com.sheep.jiuyan.samllsheep.SheepApp;
+import com.tencent.mm.opensdk.constants.ConstantsAPI;
+import com.tencent.mm.opensdk.modelpay.PayResp;
+
+import org.greenrobot.eventbus.Subscribe;
+
+import java.util.Locale;
+
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.schedulers.Schedulers;
 
 /**
  * Created by realicing on 2018/10/18.
@@ -16,18 +32,28 @@ import com.sheep.jiuyan.samllsheep.Config;
  */
 public class ActPay extends BaseActivity {
 
+    private final static String PAY_TYPE_WX = "wx";
+    private final static String PAY_TYPE_ALI = "ali";
+    private final static String PAY_TYPE_COIN = "coin";
+
     @Override
     protected boolean needButterKnife() {
         return false;
     }
 
     @Override
+    protected boolean needRegisterEventBus() {
+        return true;
+    }
+
+    @Override
     protected int getLayoutId() {
         return 0;
     }
 
     private String token;
     private String order_no;
+    private String pay_type;
 
     @Override
     public void initView() {
@@ -40,15 +66,62 @@ public class ActPay extends BaseActivity {
         Bundle bundle = intent.getExtras();
         if (bundle != null) {
             order_no = bundle.getString("order_no");
+            pay_type = bundle.getString("pay_type");
             token = bundle.getString("token");
-            CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_DIRECTIONAL_PAY_URL, url -> {
-                url = url + "?authorization=" + token + "&order=" + order_no + "&ssnocache=1";
-                WebParams webParams = new WebParams(url, "支付").setShowTitle(false).setForResult(true).setAction(Constant.INTENT_PAY);
-                Jump2View.getInstance().goWeb(this, webParams);
-            });
+            if (TextUtils.isEmpty(pay_type) || PAY_TYPE_COIN.equals(pay_type)) {
+                CommonUtil.getInstance().initUrlConfigByNet(Config.KEY_DIRECTIONAL_PAY_URL, url -> {
+                    url = url + "?authorization=" + token + "&order=" + order_no + "&ssnocache=1";
+                    WebParams webParams = new WebParams(url, "支付").setShowTitle(false).setForResult(true).setAction(Constant.INTENT_PAY);
+                    Jump2View.getInstance().goWeb(this, webParams);
+                });
+            } else if (PAY_TYPE_WX.equals(pay_type)) {
+                SheepApp.getInstance().getNetComponent().getApiService().sdkFindOrder(token, order_no)
+                        .subscribeOn(Schedulers.io())
+                        .observeOn(AndroidSchedulers.mainThread())
+                        .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                            @Override
+                            public void onError(BaseMessage baseMessage) {
+                                Intent intent = new Intent();
+                                intent.putExtra(EXTRA_NAME_ORDERNO, order_no);
+                                intent.putExtra(EXTRA_NAME_STATUS, STATUS_PAY_ORDER_ERROR);
+                                setResult(RESULT_CODE, intent);
+                                finish();
+                            }
+
+                            @Override
+                            public void onNext(BaseMessage baseMessage) {
+                                tryWxOrder();
+                            }
+                        });
+            } else if (PAY_TYPE_ALI.equals(pay_type)) {
+
+            }
         }
     }
 
+    public void tryWxOrder() {
+        SheepApp.getInstance().getNetComponent().getApiService().getPayWxParams(order_no)
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.getInstance()) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        Intent intent = new Intent();
+                        intent.putExtra(EXTRA_NAME_ORDERNO, order_no);
+                        intent.putExtra(EXTRA_NAME_STATUS, STATUS_PAY_ORDER_ERROR);
+                        setResult(RESULT_CODE, intent);
+                        finish();
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        JSONObject jsonObject = baseMessage.getData(JSONObject.class);
+                        SheepWXPayEntryActivity.close = true;
+                        CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(), jsonObject);
+                    }
+                });
+    }
+
     public void onActivityResult(int requestCode, int resultCode, Intent in) {
         if (resultCode == RESULT_OK) {
             if (requestCode == Constant.INTENT_PAY) {
@@ -66,6 +139,23 @@ public class ActPay extends BaseActivity {
         }
     }
 
+    @Subscribe
+    public void onEventMainThread(PayResp resp) {
+        String result = "";
+        if (resp.getType() == ConstantsAPI.COMMAND_PAY_BY_WX) {
+            if (resp.errCode == 0) {
+                status = STATUS_PAY_ORDER_SUCCESS;
+            } else {
+                status = STATUS_PAY_ORDER_ERROR;
+            }
+            Intent intent = new Intent();
+            intent.putExtra(EXTRA_NAME_ORDERNO, order_no);
+            intent.putExtra(EXTRA_NAME_STATUS, status);
+            setResult(RESULT_CODE, intent);
+            finish();
+        }
+    }
+
     private int status = STATUS_INIT;//状态 正常状态大于0 错误状态小于0
     public static final int STATUS_INIT = 0;//初始状态
     public static final int STATUS_GET_ORDER_SUCCESS = 1;//获取order成功

+ 7 - 5
app/src/main/java/com/sheep/jiuyan/samllsheep/SheepApp.java

@@ -45,6 +45,7 @@ import com.sheep.gamegroup.util.SysAppUtil;
 import com.sheep.gamegroup.util.TextToSpeechUtil;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.view.activity.GameCertificationActivity;
+import com.sheep.gamegroup.view.activity.SplashAct;
 import com.sheep.jiuyan.samllsheep.service.AutoCheckService;
 import com.sheep.jiuyan.samllsheep.service.DownloadService;
 import com.sheep.jiuyan.samllsheep.service.FloatShotScreenService;
@@ -286,7 +287,7 @@ public class SheepApp extends MultiDexApplication {
 //        CacheFactory.setCacheManager(ProxyCacheManager.class);//代理缓存模式,支持所有模式,不支持m3u8等
 
         //鸿途信达 广告 需要添加 两行代码顺序不能变
-        if(ArticleAd.showAd) {
+        if (ArticleAd.showAd) {
             PManager.getInstance().setChannel(this, 18122801);
             PManager.getInstance().onCreate(this);
         }
@@ -297,6 +298,7 @@ public class SheepApp extends MultiDexApplication {
         // 将该app注册到微信
         wxApi.registerApp(Config.WX_PAY_APP_ID);
     }
+
     private IWXAPI wxApi;
 
     public IWXAPI getWxApi() {
@@ -477,15 +479,15 @@ public class SheepApp extends MultiDexApplication {
                     Jump2View.getInstance().startShotScreenFloat(activity, false);
                 }
             }
-            if (mActivityCount == 1) { // 应用回到前台
-                CommonUtil.getInstance().checkCopyText();
-            }
         }
 
         @Override
         public void onActivityResumed(Activity activity) {
             if (activityRef != null) activityRef.clear();
             activityRef = new WeakReference<>(activity);
+            if (getCurrentActivity() != null && !(getCurrentActivity() instanceof SplashAct)) { // 应用回到前台
+                CommonUtil.getInstance().checkCopyText();
+            }
         }
 
         @Override
@@ -585,7 +587,7 @@ public class SheepApp extends MultiDexApplication {
         MultiDex.install(this);
         PluginManager.getInstance(base).init();//插件化框架
         //鸿途信达 广告 需要添加
-        if(ArticleAd.showAd) {
+        if (ArticleAd.showAd) {
             PManager.getInstance().attachBaseContext(base);
         }
     }