Przeglądaj źródła

兼容性bug问题修改

liujiangyao 8 lat temu
rodzic
commit
d7157340b8

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

@@ -238,7 +238,7 @@ public class FgtSmallSheep extends BaseCompatFragment implements SmallSheepContr
             return;
         }
         balance = userEntity.getBalance();
-        myPrice.setText(userEntity.getBalance() + " 元");
+        myPrice.setText(balance + " 元");
         myAllPrice.setText("累计资产 " + userEntity.getTotal_asset() + " 元");
         nameTv.setText(userEntity.getNickname() + "");//绵羊号:123456789
         sheepNumTv.setText("绵羊号:" + userEntity.getInvitation_code());

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

@@ -9,6 +9,7 @@ import android.text.TextUtils;
 import android.view.ViewTreeObserver;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.arialyy.aria.core.Aria;
 import com.arialyy.aria.core.download.DownloadTarget;
@@ -16,12 +17,15 @@ import com.arialyy.aria.core.inf.IEntity;
 import com.kfzs.duanduan.datashare.provider.download.DownLoadInfo;
 import com.kfzs.duanduan.fragment.FgtSmallSheep;
 import com.sheep.gamegroup.absBase.BaseActivity;
+import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.HomeListEntity;
 import com.sheep.gamegroup.model.entity.RequestParameEty;
 import com.sheep.gamegroup.model.entity.TaskEty;
 import com.sheep.gamegroup.model.entity.TaskListen;
+import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.model.entity.WebviewEntity;
 import com.sheep.gamegroup.model.entity.WithdrawalEty;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.TryMakeMoneyPresenter;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -37,6 +41,9 @@ import java.lang.reflect.Field;
 import java.util.HashMap;
 import java.util.Map;
 
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
+
 /**
  * 一些公用的class
  * Created by ljy on 2018/3/21.
@@ -486,4 +493,36 @@ public class CommonUtil {
         view.setCompoundDrawables(drawable, null, null, null);
         view.setTextColor(context.getResources().getColor(color));
     }
+
+    /**
+     * 更新用户信息
+     */
+    public void getUserInfo(Context context){
+        SheepApp.get(context)
+                .getNetComponent()
+                .getApiService()
+                .getInfo()
+                .subscribeOn(Schedulers.io())
+                .observeOn(AndroidSchedulers.mainThread())
+                .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                    @Override
+                    public void onError(BaseMessage baseMessage) {
+                        G.showToast(baseMessage.getMsg() +"");
+
+                    }
+
+                    @Override
+                    public void onNext(BaseMessage baseMessage) {
+                        UserEntity userEntity = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
+                        if(userEntity == null){
+                            return;
+                        }
+                        try {
+                            MyDbManager.getInstance().saveOrUpdateUser(userEntity);
+                        } catch (Exception e) {
+                            e.printStackTrace();
+                        }
+                    }
+                });
+    }
 }

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

@@ -129,7 +129,7 @@ public class Jump2View {
             return;
         }
         if(TextUtils.isEmpty(userEntity.getReal_name()) || TextUtils.isEmpty(userEntity.getId_number())){//没有实名认证
-            goRealNameAuther(context, userEntity);
+            goRealNameAuther(context, userEntity, 1);
             return;
         }
         Intent intent = new Intent(context, WithdrawalAct.class);
@@ -518,10 +518,12 @@ public class Jump2View {
      * 跳转到验证界面
      * @param context
      * @param o
+     * @param whereFrom 0:不作处理 1:跳到充值页面
      */
-    public void goRealNameAuther(Context context, UserEntity o){
+    public void goRealNameAuther(Context context, UserEntity o, int whereFrom){
         Intent i = new Intent(context, RealNameAuthenAct.class);
         i.putExtra("info", o);
+        i.putExtra("where_from", whereFrom);
         context.startActivity(i);
     }
     /**

+ 10 - 14
app/src/main/java/com/sheep/gamegroup/view/activity/AccountAndSecurityAct.java

@@ -7,6 +7,8 @@ import android.widget.ImageView;
 import android.widget.RelativeLayout;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
+import com.alibaba.fastjson.JSONObject;
 import com.bumptech.glide.Glide;
 import com.bumptech.glide.request.RequestOptions;
 import com.kfzs.duanduan.event.BigEvent;
@@ -17,7 +19,9 @@ import com.sheep.gamegroup.event.ImageHeadChange;
 import com.sheep.gamegroup.event.MoneyChange;
 import com.sheep.gamegroup.event.RealNameAutehrChange;
 import com.sheep.gamegroup.event.UserNameChange;
+import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.AccountAndSecuritContract;
 import com.sheep.gamegroup.presenter.AccountAndSecuritPresenter;
 import com.sheep.gamegroup.util.ActivityManager;
@@ -37,6 +41,7 @@ import com.umeng.socialize.bean.SHARE_MEDIA;
 import org.greenrobot.eventbus.EventBus;
 import org.greenrobot.eventbus.Subscribe;
 import org.greenrobot.eventbus.ThreadMode;
+import org.xutils.ex.DbException;
 
 import java.util.Map;
 
@@ -44,6 +49,8 @@ import javax.inject.Inject;
 
 import butterknife.BindView;
 import butterknife.OnClick;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
 
 /**
  * Created by Administrator on 2018/3/16.
@@ -123,7 +130,7 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
     @Override
     protected void onResume() {
         super.onResume();
-
+//        initData();
     }
 
     @Subscribe(threadMode = ThreadMode.MAIN)
@@ -170,7 +177,7 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
                 }
                 break;
             case R.id.rl_auther: ////跳转授权
-                Jump2View.getInstance().goRealNameAuther(AccountAndSecurityAct.this,mEntity);
+                Jump2View.getInstance().goRealNameAuther(AccountAndSecurityAct.this,mEntity, 0);
                 break;
 
             case R.id.rl_top:
@@ -196,16 +203,6 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
 
     @Override
     public void showTask(final UserEntity entity) {
-        UserEntity userEntity = null;
-        try{
-            userEntity = MyDbManager.getInstance()
-                    .dbFindUser();
-            if(userEntity == null){
-                userEntity = new UserEntity();
-            }
-        }catch (Exception e){
-            e.printStackTrace();
-        }
                 mEntity = entity;
                 tvName.setText(entity.getNickname());
                 tvLinkContent.setText("绵羊号:" + entity.getInvitation_code());
@@ -213,7 +210,6 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
                     tvPhone.setText("未绑定");
                 } else {
                     tvPhone.setText(entity.getMobile());
-                    userEntity.setMobile(entity.getMobile());
                     SpUtils.savePhone(activity, entity.getMobile());
                 }
 
@@ -226,7 +222,6 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
                 } else {
                     tvWx.setText(entity.getWx_nickname());
                     SpUtils.saveWeixin(activity, entity.getWx_nickname());
-                    userEntity.setWx_nickname(entity.getWx_nickname());
                 }
 
                 refalshAuther(entity);
@@ -277,4 +272,5 @@ public class AccountAndSecurityAct extends BaseActivity implements AccountAndSec
         EventBus.getDefault().unregister(this);
     }
 
+
 }

+ 3 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/BindOrChangeWeixinAct.java

@@ -16,6 +16,7 @@ import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.presenter.BindOrChangeWeixinContract;
 import com.sheep.gamegroup.presenter.BindOrChangeWeixinPresenter;
 import com.sheep.gamegroup.util.ActivityManager;
+import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.jiuyan.samllsheep.R;
 import com.sheep.jiuyan.samllsheep.SheepApp;
@@ -122,6 +123,8 @@ public class BindOrChangeWeixinAct extends BaseActivity implements BindOrChangeW
         } catch (Exception e) {
             e.printStackTrace();
         }
+        CommonUtil.getInstance()
+                .getUserInfo(SheepApp.mContext);
         ActivityManager.getInstance()
                 .endActivity(ChangeWxOrTelAct.class);
         finish();

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

@@ -20,6 +20,7 @@ import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.presenter.PhoneContract;
 import com.sheep.gamegroup.presenter.PhonePresenter;
+import com.sheep.gamegroup.util.CommonUtil;
 import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.SelfCountDownTimer;
 import com.sheep.gamegroup.util.UMConfigUtils;
@@ -311,7 +312,8 @@ public class ChangeTelAct extends BaseActivity implements PhoneContract.View{
             }else if(step == 4){
                 SpUtils.savePhone(activity,mobile);
                 G.showToast(o.getMsg()+"");
-
+                CommonUtil.getInstance()
+                        .getUserInfo(SheepApp.mContext);
                 EventBus.getDefault().post(new BigEvent().setEventTypes(EventTypes.REFRESH_DATA_PHONE));
                 finish();
             }

+ 7 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/RealNameAuthenAct.java

@@ -12,6 +12,7 @@ import com.sheep.gamegroup.event.RealNameAutehrChange;
 import com.sheep.gamegroup.model.entity.UserEntity;
 import com.sheep.gamegroup.presenter.RealNameAutherContract;
 import com.sheep.gamegroup.presenter.RealNameAutherPresenter;
+import com.sheep.gamegroup.util.Jump2View;
 import com.sheep.gamegroup.util.StringUtils;
 import com.sheep.gamegroup.util.UMConfigUtils;
 import com.sheep.gamegroup.view.dialog.DialogRealNameAuther;
@@ -50,6 +51,8 @@ public class RealNameAuthenAct extends BaseActivity implements RealNameAutherCon
 
     HashMap<String ,String>  map=new HashMap<>();
 
+    private int whereFrom;
+
     private  int  count=0;
 
     @Override
@@ -77,6 +80,7 @@ public class RealNameAuthenAct extends BaseActivity implements RealNameAutherCon
         Intent i = getIntent();
         if (i != null && i.hasExtra("info")) {
             mEntity = (UserEntity) i.getSerializableExtra("info");
+            whereFrom = i.getIntExtra("where_from", 0);
             if(mEntity!=null) {
 
                 if(!android.text.TextUtils.isEmpty(mEntity.getReal_name())){
@@ -127,6 +131,9 @@ public class RealNameAuthenAct extends BaseActivity implements RealNameAutherCon
 
          }
         EventBus.getDefault().post(change);
+           if(whereFrom == 1){
+               Jump2View.getInstance().goWithdrawal(RealNameAuthenAct.this, null);
+           }
           finish();
     }
 

+ 53 - 4
app/src/main/java/com/sheep/gamegroup/view/activity/RechargeQAct.java

@@ -13,15 +13,19 @@ import android.widget.AdapterView;
 import android.widget.EditText;
 import android.widget.TextView;
 
+import com.alibaba.fastjson.JSON;
 import com.alibaba.fastjson.JSONObject;
 import com.sheep.gamegroup.absBase.BaseActivity;
 import com.sheep.gamegroup.di.components.DaggerRechargeQComponent;
 import com.sheep.gamegroup.di.modules.RechargeQModule;
 import com.sheep.gamegroup.model.entity.BaseMessage;
 import com.sheep.gamegroup.model.entity.RechargeQEntity;
+import com.sheep.gamegroup.model.entity.UserEntity;
+import com.sheep.gamegroup.model.util.SheepSubscriber;
 import com.sheep.gamegroup.presenter.RechargeQContract;
 import com.sheep.gamegroup.presenter.RechargeQPresenter;
 import com.sheep.gamegroup.util.Jump2View;
+import com.sheep.gamegroup.util.MyDbManager;
 import com.sheep.gamegroup.util.MyGridview;
 import com.sheep.gamegroup.view.adapter.RechargeQAdapter;
 import com.sheep.jiuyan.samllsheep.R;
@@ -29,6 +33,8 @@ import com.sheep.jiuyan.samllsheep.SheepApp;
 import com.sheep.jiuyan.samllsheep.utils.G;
 import com.sheep.jiuyan.samllsheep.utils.TitleBarUtils;
 
+import org.xutils.ex.DbException;
+
 import java.util.ArrayList;
 import java.util.List;
 
@@ -36,6 +42,8 @@ import javax.inject.Inject;
 
 import butterknife.BindView;
 import butterknife.OnClick;
+import rx.android.schedulers.AndroidSchedulers;
+import rx.schedulers.Schedulers;
 
 /**
  * Q币充值
@@ -67,6 +75,8 @@ public class RechargeQAct extends BaseActivity implements RechargeQContract.View
     String text_qq;//充值QQ号
     String text_QBNumber;//充值金额
 
+    private UserEntity userEntity;
+
     @Override
     protected int getLayoutId() {
         return R.layout.rechargeq_layout;
@@ -104,12 +114,51 @@ public class RechargeQAct extends BaseActivity implements RechargeQContract.View
                 }
                 adapter.notifyDataSetChanged();
                 text_QBNumber = rechargeQEntity.getPrice();
-                tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),text_QBNumber));
+//                tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),text_QBNumber));
             }
         });
 
         tvZk.setText(getSpannableString());
-        tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),"0"));
+
+        try {
+            userEntity = MyDbManager.getInstance().dbFindUser();
+        } catch (DbException e) {
+            e.printStackTrace();
+        }
+        if(userEntity != null){
+            tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),userEntity.getBalance() +""));
+        }else {
+            SheepApp.get(activity)
+                    .getNetComponent()
+                    .getApiService()
+                    .getInfo()
+                    .subscribeOn(Schedulers.io())
+                    .observeOn(AndroidSchedulers.mainThread())
+                    .subscribe(new SheepSubscriber<BaseMessage>(SheepApp.mContext) {
+                        @Override
+                        public void onError(BaseMessage baseMessage) {
+                            G.showToast(baseMessage.getMsg() +"");
+
+                        }
+
+                        @Override
+                        public void onNext(BaseMessage baseMessage) {
+                            userEntity = JSON.parseObject(JSONObject.toJSONString(baseMessage.getData()), UserEntity.class);
+                            if(userEntity == null){
+                                tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),"0"));
+                                return;
+                            }
+                            try {
+                                MyDbManager.getInstance().saveOrUpdateUser(userEntity);
+                            } catch (Exception e) {
+                                e.printStackTrace();
+                            }
+                            tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),userEntity.getBalance() +""));
+                        }
+                    });
+
+        }
+
 
         etQbNumber.addTextChangedListener(new TextWatcher() {
             @Override
@@ -124,11 +173,11 @@ public class RechargeQAct extends BaseActivity implements RechargeQContract.View
                     if(select != -1 ){
                         RechargeQEntity rechargeQEntity = adapter.getItem(select);
                         text_QBNumber = rechargeQEntity.getPrice();
-                        tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),text_QBNumber));
+//                        tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),text_QBNumber));
                     }
                 }else{
                     adapter.setInPut(true);
-                    tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),s.toString()));
+//                    tvMybNumber.setText(String.format(getString(R.string.rechargeq_amount),s.toString()));
                 }
             }
 

+ 2 - 0
app/src/main/java/com/sheep/gamegroup/view/activity/TaskDetailAddQQAct.java

@@ -174,6 +174,7 @@ public class TaskDetailAddQQAct extends AbsChooseImageActivity {
                                 System.out.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
                             setLoaddingText("完成");
                             onGetNetImageUrl(url);
+                            G.showToast(baseMessage.getMsg() +"");
                             dismissLoaddingDialog();
                             finish();
                         }
@@ -197,6 +198,7 @@ public class TaskDetailAddQQAct extends AbsChooseImageActivity {
                                 System.out.println("baseMessage onNext " + JSON.toJSONString(baseMessage));
                             setLoaddingText("完成");
                             onGetNetImageUrl(url);
+                            G.showToast(baseMessage.getMsg() +"");
                             dismissLoaddingDialog();
                             finish();
                         }

+ 8 - 4
app/src/main/res/layout/activity_main.xml

@@ -46,7 +46,8 @@
                 android:layout_width="0dp"
                 android:layout_height="@dimen/tab_height"/>
             <TextView
-                android:layout_width="@dimen/tab_width"
+                android:layout_width="wrap_content"
+                android:minWidth="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_game"
                 android:textSize="10sp"
@@ -57,7 +58,8 @@
                 android:layout_width="0dp"
                 android:layout_height="@dimen/tab_height"/>
             <TextView
-                android:layout_width="@dimen/tab_width"
+                android:layout_width="wrap_content"
+                android:minWidth="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_class"
                 android:textSize="10sp"
@@ -68,7 +70,8 @@
                 android:layout_width="0dp"
                 android:layout_height="@dimen/tab_height"/>
             <TextView
-                android:layout_width="@dimen/tab_width"
+                android:layout_width="wrap_content"
+                android:minWidth="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_task"
                 android:textSize="10sp"
@@ -79,7 +82,8 @@
                 android:layout_width="0dp"
                 android:layout_height="@dimen/tab_height"/>
             <TextView
-                android:layout_width="@dimen/tab_width"
+                android:layout_width="wrap_content"
+                android:minWidth="@dimen/tab_width"
                 android:layout_height="@dimen/tab_height"
                 android:drawableTop="@drawable/drawable_selector_bp"
                 android:textSize="10sp"

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

@@ -27,7 +27,7 @@
                 android:layout_marginBottom="@dimen/content_padding_small"
                 android:layout_marginLeft="@dimen/content_padding_10"
                 android:layout_marginTop="@dimen/content_padding_small"
-                android:text="aaaa"
+                android:text=""
                 android:textColor="@color/txt_white"
                 android:textSize="@dimen/text_size_12"/>
 

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

@@ -82,7 +82,7 @@
                         android:layout_width="match_parent"
                         android:layout_height="40dp"
                         android:background="@null"
-                        android:hint="请输入充值QB数"
+                        android:hint="请输入充值Q数"
                         android:textColor="@color/black_444444"
                         android:textColorHint="@color/disenable_color"
                         android:textSize="@dimen/text_size_3" />