hanjing 6 lat temu
rodzic
commit
e3e5cf598c

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

@@ -309,7 +309,7 @@ public abstract class BaseActivity extends RxAppCompatActivity implements BackHa
                     leakFields[i].set(imm, null);
                 }
             } catch (Throwable t) {
-                t.printStackTrace();
+//                t.printStackTrace();
             }
         }
     }

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

@@ -75,9 +75,11 @@ public abstract class SheepWXPayEntryActivity extends Activity implements IWXAPI
         PayResp payResp = (PayResp) resp;
         String frompackage = QQUtil.getWxPayFrom(SheepApp.getInstance(), payResp.prepayId);
         String outorderno = QQUtil.getWxPayOrderNo(SheepApp.getInstance(), payResp.prepayId);
+        int fromorient = QQUtil.getWxPayOrient(SheepApp.getInstance(), payResp.prepayId);
         QQUtil.removeWxPayFrom(this, payResp.prepayId);
         QQUtil.removeWxPayOrderNo(this, payResp.prepayId);
-        Jump2View.getInstance().goRechargeResult(this, result, frompackage, outorderno);
+        QQUtil.removeWxPayOrient(this, payResp.prepayId);
+        Jump2View.getInstance().goRechargeResult(this, result, frompackage, fromorient, outorderno);
         finish();
     }
 

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

@@ -1046,6 +1046,7 @@ public class Jump2View {
         }
         Intent intent = new Intent(context, ActWebX5Single.class);
         intent.putExtra(WebParams.class.getSimpleName(), webParams);
+        intent.putExtra("extra_orient", 1);
         if (needNewTask) {
             intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
         }
@@ -1134,19 +1135,21 @@ public class Jump2View {
         context.startActivity(intent);
     }
 
-    public void goRechargeResult(Context context, String resultStatus, String gowhere, String orderNO) {
+    public void goRechargeResult(Context context, String resultStatus, String gowhere, int fromOrient, String orderNO) {
         Intent intent = new Intent(context, RechargeResultAct.class);
         intent.putExtra("payCode", resultStatus);
         intent.putExtra("gowhere", gowhere);
         intent.putExtra("orderno", orderNO);
+        intent.putExtra("fromorient", fromOrient);
         context.startActivity(intent);
     }
 
-    public void goRechargeResult(Context context, String resultStatus, String gowhere, String orderNO, String msg) {
+    public void goRechargeResult(Context context, String resultStatus, String gowhere, int fromOrient, String orderNO, String msg) {
         Intent intent = new Intent(context, RechargeResultAct.class);
         intent.putExtra("payCode", resultStatus);
         intent.putExtra("gowhere", gowhere);
         intent.putExtra("orderno", orderNO);
+        intent.putExtra("fromorient", fromOrient);
         intent.putExtra("errMsg", msg);
         context.startActivity(intent);
     }

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

@@ -129,4 +129,24 @@ public class QQUtil {
         editor.remove("orderno_" + prepayId);
         editor.commit();
     }
+
+    public static int getWxPayOrient(Context context, String prepayId) {
+        SharedPreferences sp = context.getSharedPreferences("wx_pay_order", Context.MODE_PRIVATE);
+        return sp.getInt("orient_" + prepayId, -1);
+    }
+
+    public static void saveWxPayOrient(Context context, String prepayId, int orient) {
+        SharedPreferences sp = context.getSharedPreferences("wx_pay_order", Context.MODE_PRIVATE);
+        SharedPreferences.Editor editor = sp.edit();
+        editor.putInt("orient_" + prepayId, orient);
+        editor.commit();
+    }
+
+    public static void removeWxPayOrient(Context context, String prepayId) {
+        SharedPreferences sp = context.getSharedPreferences("wx_pay_order", Context.MODE_PRIVATE);
+        if (!sp.contains("orient_" + prepayId)) return;
+        SharedPreferences.Editor editor = sp.edit();
+        editor.remove("orient_" + prepayId);
+        editor.commit();
+    }
 }

+ 6 - 3
app/src/main/java/com/sheep/gamegroup/view/activity/ActPay.java

@@ -67,6 +67,7 @@ public class ActPay extends BaseActivity {
     private String order_no;
     private String pay_type;
     private String from_package;
+    private int from_orient;
 
     @Override
     protected void onCreate(Bundle b) {
@@ -94,13 +95,14 @@ public class ActPay extends BaseActivity {
             pay_type = bundle.getString("pay_type");
             from_package = bundle.getString("from_package");
             token = bundle.getString("token");
+            from_orient = bundle.getInt("from_orient", -1);
             SdkLoginUser user = DDProviderHelper.getInstance().getSdkLoginUser(token);
             if (user != null) {
                 token = user.getToken();
             }
             CommonUtil.getInstance().checkAuth(token, result -> {
                 hideProgress();
-                if(TextUtils.isEmpty(order_no)){
+                if (TextUtils.isEmpty(order_no)) {
                     Intent retIntent = new Intent();
                     retIntent.putExtra("use_flag", result);
                     retIntent.putExtra("say_what", token);
@@ -110,7 +112,7 @@ public class ActPay extends BaseActivity {
                     if (result) {
                         doPay();
                     } else {
-                        Jump2View.getInstance().goRechargeResult(this, "9001", from_package, null, "用户信息不一致,请重新登录");
+                        Jump2View.getInstance().goRechargeResult(this, "9001", from_package, from_orient, null, "用户信息不一致,请重新登录");
                         finish();
                     }
                 }
@@ -185,6 +187,7 @@ public class ActPay extends BaseActivity {
                         if (!TextUtils.isEmpty(from_package)) {
                             QQUtil.saveWxPayFrom(SheepApp.getInstance(), jsonObject.getString("prepayid"), from_package);
                             QQUtil.saveWxPayOrderNo(SheepApp.getInstance(), jsonObject.getString("prepayid"), order_no);
+                            QQUtil.saveWxPayOrient(SheepApp.getInstance(), jsonObject.getString("prepayid"), from_orient);
                         }
                         String attach = jsonObject.getString("attach").split("_")[1];
                         CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(ActPay.this, attach), jsonObject);
@@ -256,7 +259,7 @@ public class ActPay extends BaseActivity {
 //        intent.putExtra(EXTRA_NAME_ORDERNO, order_no);
 //        intent.putExtra(EXTRA_NAME_STATUS, status);
 //        setResult(RESULT_CODE, intent);
-        Jump2View.getInstance().goRechargeResult(this, status == STATUS_PAY_ORDER_SUCCESS ? "9000" : "-1000", from_package, order_no);
+        Jump2View.getInstance().goRechargeResult(this, status == STATUS_PAY_ORDER_SUCCESS ? "9000" : "-1000", from_package, from_orient, order_no);
         finish();
     }
 

+ 16 - 8
app/src/main/java/com/sheep/gamegroup/view/activity/ActWebX5.java

@@ -24,6 +24,8 @@ public class ActWebX5 extends BaseContainerActivity {
 
     private BaseFragment fragment;
 
+    private int orientPara;
+
     @Override
     protected Fragment initFragment() {
         initWebParams();
@@ -38,6 +40,7 @@ public class ActWebX5 extends BaseContainerActivity {
     public void initWebParams() {
         Intent intent = getIntent();
         webParams = (WebParams) intent.getSerializableExtra(WebParams.class.getSimpleName());
+        orientPara = intent.getIntExtra("extra_orient", -1);
     }
 
     @Override
@@ -54,15 +57,20 @@ public class ActWebX5 extends BaseContainerActivity {
 
     @Override
     public void finish() {
-        if (fragment instanceof IWeb) {
-            IWeb webFragment = (IWeb) fragment;
-            String url = webFragment.getWebUrl();
-            if (url.contains(Config.PATH_DIRECTIONAL_RECHARGE)
-                    || url.contains(Config.PATH_DIRECTIONAL_MAKEGOLD)) {
-                setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+        runOnUiThread(new Runnable() {
+            @Override
+            public void run() {
+                if (fragment instanceof IWeb && orientPara > 0) {
+                    IWeb webFragment = (IWeb) fragment;
+                    String url = webFragment.getWebUrl();
+                    if (url.contains(Config.PATH_DIRECTIONAL_RECHARGE)
+                            || url.contains(Config.PATH_DIRECTIONAL_MAKEGOLD)) {
+                        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+                    }
+                }
+                ActWebX5.super.finish();
             }
-        }
-        super.finish();
+        });
     }
 
     @Override

+ 11 - 5
app/src/main/java/com/sheep/gamegroup/view/activity/RechargeAct.java

@@ -36,6 +36,7 @@ import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.ListUtil;
 import com.sheep.gamegroup.util.LogUtil;
 import com.sheep.gamegroup.util.MyGridview;
+import com.sheep.gamegroup.util.QQUtil;
 import com.sheep.gamegroup.util.ViewUtil;
 import com.sheep.gamegroup.view.adapter.RechargePriceAdapter;
 import com.sheep.jiuyan.samllsheep.R;
@@ -84,6 +85,7 @@ public class RechargeAct extends BaseActivity {
     private boolean forResult = false;
     private String fromPackage;
     private String fromToken;
+    private int fromOrient;
 
     @Override
     protected void onCreate(Bundle b) {
@@ -115,6 +117,7 @@ public class RechargeAct extends BaseActivity {
         if (getIntent().hasExtra("from_package")) {
             fromPackage = getIntent().getStringExtra("from_package");
         }
+        fromOrient = getIntent().getIntExtra("from_orient", -1);
         TitleBarUtils.getInstance()
                 .setShowOrHide(this, true)
                 .setTitle(this, "充值")
@@ -144,13 +147,13 @@ public class RechargeAct extends BaseActivity {
                                 //todo 出口三
                                 configView(userEntity.getInvitation_code(), userEntity.getNickname());
                             } else {
-                                Jump2View.getInstance().goRechargeResult(RechargeAct.this, "9002", fromPackage, null, "查询不到用户信息,请登录");
+                                Jump2View.getInstance().goRechargeResult(RechargeAct.this, "9002", fromPackage, fromOrient, null, "查询不到用户信息,请登录");
                                 finish();
                             }
                         });
                     }
                 } else {
-                    Jump2View.getInstance().goRechargeResult(RechargeAct.this, "9002", fromPackage, null, "用户授权已过期,请登录");
+                    Jump2View.getInstance().goRechargeResult(RechargeAct.this, "9002", fromPackage, fromOrient, null, "用户授权已过期,请登录");
                     finish();
                 }
             });
@@ -158,7 +161,7 @@ public class RechargeAct extends BaseActivity {
             // todo 出口二
             UserEntity user = DataUtil.getInstance().getUserEntity();
             if (user == null) {
-                Jump2View.getInstance().goRechargeResult(RechargeAct.this, "9002", fromPackage, null, "请登录");
+                Jump2View.getInstance().goRechargeResult(RechargeAct.this, "9002", fromPackage, fromOrient, null, "请登录");
                 finish();
                 return;
             }
@@ -310,7 +313,7 @@ public class RechargeAct extends BaseActivity {
                         }
                         if (forResult) {
                             String result = resp.respCode.equals("00") ? "9000" : resp.respCode;
-                            Jump2View.getInstance().goRechargeResult(RechargeAct.this, result, fromPackage, null);
+                            Jump2View.getInstance().goRechargeResult(RechargeAct.this, result, fromPackage, fromOrient, null);
                         } else {
                             String result = resp.respCode.equals("00") ? "9000" : resp.respCode;
                             Jump2View.getInstance().goRechargeResultAct(RechargeAct.this, result);
@@ -329,6 +332,9 @@ public class RechargeAct extends BaseActivity {
             return;
         }
         String attach = jsonObject.getString("attach").split("_")[1];
+        QQUtil.saveWxPayFrom(SheepApp.getInstance(), jsonObject.getString("prepayid"), fromPackage);
+        QQUtil.saveWxPayOrderNo(SheepApp.getInstance(), jsonObject.getString("prepayid"), "");
+        QQUtil.saveWxPayOrient(SheepApp.getInstance(), jsonObject.getString("prepayid"), fromOrient);
         CommonUtil.getInstance().wxpay(SheepApp.getInstance().getWxApi(this, attach), jsonObject);
         finish();
     }
@@ -371,7 +377,7 @@ public class RechargeAct extends BaseActivity {
                     setResult(777, intent);
                 } else {
                     if (forResult) {
-                        Jump2View.getInstance().goRechargeResult(RechargeAct.this, result, fromPackage, null);
+                        Jump2View.getInstance().goRechargeResult(RechargeAct.this, result, fromPackage, fromOrient, null);
                     } else {
                         Jump2View.getInstance().goRechargeResultAct(RechargeAct.this, result);
                     }

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

@@ -32,6 +32,7 @@ public class RechargeResultAct extends BaseActivity {
     TextView tvRechargeResultPay;
 
     private String gowhere, orderno, resultStatus, errMsg;
+    private int fromorient;
 
     @Override
     protected int getLayoutId() {
@@ -44,6 +45,7 @@ public class RechargeResultAct extends BaseActivity {
         if (getIntent().hasExtra("gowhere")) {
             gowhere = getIntent().getStringExtra("gowhere");
         }
+        fromorient = getIntent().getIntExtra("fromorient", -1);
         if (getIntent().hasExtra("orderno")) {
             orderno = getIntent().getStringExtra("orderno");
         }
@@ -85,7 +87,9 @@ public class RechargeResultAct extends BaseActivity {
 
     @Override
     public void finish() {
-        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+        if (fromorient >= 0) {
+            setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+        }
         if (!TextUtils.isEmpty(gowhere)) {
             ComponentName appName = new ComponentName(gowhere, "com.yog.kothoth.view.activity.SSRechargeActivity");
             Intent intent = new Intent();