Selaa lähdekoodia

1、 修改直播间用户信息弹窗 背景暗度 和 进入退出动画 2、修改友盟采集到的bug

ZhangYuDong 4 vuotta sitten
vanhempi
commit
b4976671f1

+ 1 - 0
uchat_common/src/main/java/com/shanp/youqi/common/ui/dialog/PayDialog.java

@@ -300,6 +300,7 @@ public class PayDialog {
             @Override
             public void onSuccess(PayEnableInfo payEnableInfo) {
                 super.onSuccess(payEnableInfo);
+                if (payEnableInfo == null) return;  //增强稳定性
                 mPayEnableInfo = payEnableInfo;
                 showPayLayout(payEnableInfo);
             }

+ 11 - 1
uchat_room/src/main/java/com/hncx/xxm/room/widget/dialog/UserInfoDialog.java

@@ -9,6 +9,7 @@ import android.view.Gravity;
 import android.view.View;
 import android.view.ViewGroup;
 import android.view.Window;
+import android.view.WindowManager;
 import android.widget.ImageView;
 import android.widget.LinearLayout;
 import android.widget.TextView;
@@ -92,7 +93,8 @@ public class UserInfoDialog extends Dialog implements View.OnClickListener {
     private ConstraintLayout cltBottom;
 
     public UserInfoDialog(Context context, long uid) {
-        super(context, R.style.UserInfoBottomSheetDialog);
+        //更换style ,改变 弹起和退出 动画
+        super(context, R.style.uq_base_dialog);
         this.context = context;
         this.uid = uid;
     }
@@ -130,7 +132,15 @@ public class UserInfoDialog extends Dialog implements View.OnClickListener {
         if (window != null) {
             window.setGravity(Gravity.BOTTOM);
             window.setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
+
+            //修改 半透明背景
+            WindowManager.LayoutParams attributes = window.getAttributes();
+            if (attributes == null) return;
+            attributes.dimAmount = 0.5f;
+            window.setAttributes(attributes);
         }
+
+
     }
 
     private void initView() {

+ 16 - 3
uchat_show/src/main/java/com/shanp/youqi/module/dynamic/activity/DynamicDetailsActivity.java

@@ -214,10 +214,18 @@ public class DynamicDetailsActivity extends UChatActivity {
                 mEtCommentEdit.setSelection(mEtCommentEdit.length());
 
             } else if (id == R.id.lav_comment_like) {
-                if (!((AttentionBean) adapter.getData().get(position)).getCommentInfo().isHasLiked()) {
-                    likeComment((LottieAnimationView) view, position, String.valueOf(mAdapter.getData().get(position).getCommentInfo().getDynamicCommentId()));
+                // 修复 get动态id 时 偶发空指针
+                AttentionBean bean = (AttentionBean) adapter.getData().get(position);
+                if (bean == null) return;
+                DynamicComment commentInfo = bean.getCommentInfo();
+                if (commentInfo == null) return;
+                if (!commentInfo.isHasLiked()) {
+                    long dynamicCommentId = commentInfo.getDynamicCommentId();
+                    if (dynamicCommentId <= 0) return;
+                    likeComment((LottieAnimationView) view, position, String.valueOf(dynamicCommentId));
                 }
 
+
             } else if (id == R.id.civ_comment_head_img) {
                 if (AppPermissionClickUtils.INSTANCE.checkOtherUserHomePage(getSupportFragmentManager())) {
                     return;
@@ -257,10 +265,15 @@ public class DynamicDetailsActivity extends UChatActivity {
             @Override
             public void onLoadMore(@NonNull RefreshLayout refreshLayout) {
                 List<AttentionBean> list = mAdapter.getData();
+                //修复 加载更多传动态id时 可能出现的空指针
                 if (list.size() > 2) {
                     AttentionBean bean = list.get(list.size() - 1);
                     if (bean != null) {
-                        loadComment(mDynamicId, String.valueOf(bean.getCommentInfo().getDynamicCommentId()));
+                        DynamicComment commentInfo = bean.getCommentInfo();
+                        if (commentInfo == null) return;
+                        long dynamicCommentId = commentInfo.getDynamicCommentId();
+                        if (dynamicCommentId <= 0) return;
+                        loadComment(mDynamicId, String.valueOf(dynamicCommentId));
                     }
                 }
                 stopAnim();

+ 10 - 7
uchat_user/src/main/java/com/shanp/youqi/user/activity/AccountBindActivity.java

@@ -5,7 +5,6 @@ import android.text.TextUtils;
 import android.view.View;
 
 import androidx.recyclerview.widget.GridLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
 
 import com.alibaba.android.arouter.facade.annotation.Route;
 import com.alipay.sdk.app.OpenAuthTask;
@@ -31,8 +30,8 @@ import com.shanp.youqi.core.model.UserBindWeChat;
 import com.shanp.youqi.core.pay.PayCore;
 import com.shanp.youqi.core.wallet.WalletCore;
 import com.shanp.youqi.user.R;
-import com.shanp.youqi.user.R2;
 import com.shanp.youqi.user.adapter.AccountBindAdapter;
+import com.shanp.youqi.user.databinding.ActivityAccountBindBinding;
 import com.shanp.youqi.user.vo.ItemAccountBind;
 import com.tencent.mm.opensdk.modelmsg.SendAuth;
 import com.tencent.mm.opensdk.openapi.IWXAPI;
@@ -41,7 +40,6 @@ import com.tencent.mm.opensdk.openapi.WXAPIFactory;
 import java.util.ArrayList;
 import java.util.List;
 
-import butterknife.BindView;
 import me.jessyan.autosize.utils.AutoSizeUtils;
 
 
@@ -51,14 +49,18 @@ public class AccountBindActivity extends UChatActivity {
 
     public static final int BIND_STATUS_BIND = 1;
     public static final String AUTH_CODE = "auth_code";
-    @BindView(R2.id.rec)
-    RecyclerView rec;
+
+
+    ActivityAccountBindBinding binding;
     AccountBindAdapter mAdapter;
     private List<ItemAccountBind> mDataList = new ArrayList<>();
     private IWXAPI api;
+    private String mAuthCode;
 
     @Override
     protected void initEventAndData() {
+        // 换成viewBind
+        binding = ActivityAccountBindBinding.bind(getContentView());
         initTitleBar().setBackClick(new View.OnClickListener() {
             @Override
             public void onClick(View v) {
@@ -67,6 +69,7 @@ public class AccountBindActivity extends UChatActivity {
             }
         });
 
+
         // 微信
         api = WXAPIFactory.createWXAPI(this, C.wchat.WECHAT_APP_ID);
         api.registerApp(C.wchat.WECHAT_APP_ID);
@@ -141,8 +144,8 @@ public class AccountBindActivity extends UChatActivity {
         mAdapter = new AccountBindAdapter(null);
         mAdapter.setEmptyView(noDataView);
         mAdapter.isUseEmpty(false);
-        rec.setAdapter(mAdapter);
-        rec.setLayoutManager(new GridLayoutManager(mContext, 1));
+        binding.rec.setAdapter(mAdapter);
+        binding.rec.setLayoutManager(new GridLayoutManager(mContext, 1));
     }
 
     private void initListener() {

+ 12 - 0
uchat_user/src/main/java/com/shanp/youqi/user/activity/MeActivity.java

@@ -50,6 +50,7 @@ import com.shanp.youqi.core.model.UserMenu;
 import com.shanp.youqi.core.model.UserMine;
 import com.shanp.youqi.core.model.UserVerifyStatus;
 import com.shanp.youqi.core.utils.FormatUtils;
+import com.shanp.youqi.user.BuildConfig;
 import com.shanp.youqi.user.R;
 import com.shanp.youqi.user.R2;
 import com.shanp.youqi.user.adapter.PersonalRecAdapter;
@@ -161,6 +162,13 @@ public class MeActivity extends UChatActivity {
         return R.layout.user_activity_me;
     }
 
+    private void test() {
+        if (!BuildConfig.DEBUG) {
+            return;
+        }
+        ARouterFun.startUserWalletRechargeDemo();
+    }
+
     //陪聊记录 是否隐藏
     private void isVoiceChatHistory() {
 
@@ -193,6 +201,10 @@ public class MeActivity extends UChatActivity {
 
     private void initListener() {
 
+//        tvQSugar.setOnClickListener(v -> {
+//            test();
+//        });
+
 
         register(RxBus.get().toFlowable(LoginSuccessEvent.class), new EventSubscriber<LoginSuccessEvent>() {
             @Override

+ 34 - 11
uchat_wallet/src/main/java/com/shanp/youqi/wallet/activity/UBeanRechargeDemoActivity.kt

@@ -9,6 +9,7 @@ import androidx.core.content.res.ResourcesCompat
 import androidx.recyclerview.widget.RecyclerView
 import com.alibaba.android.arouter.facade.annotation.Autowired
 import com.alibaba.android.arouter.facade.annotation.Route
+import com.alibaba.android.arouter.utils.TextUtils
 import com.blankj.utilcode.util.ToastUtils
 import com.shanp.youqi.base.util.LogUtil
 import com.shanp.youqi.base.view.CoreCallback
@@ -25,7 +26,7 @@ import com.shanp.youqi.core.utils.SP
 import com.shanp.youqi.core.wallet.WalletCore
 import com.shanp.youqi.wallet.R
 import com.shanp.youqi.wallet.adapter.UBeanRechargeAdapter
-import com.shanp.youqi.wallet.databinding.ActivityUbeanRechargeDemoBinding
+import com.shanp.youqi.wallet.databinding.ActivityUbeanRechargeBinding
 import me.jessyan.autosize.utils.AutoSizeUtils
 import java.lang.ref.SoftReference
 
@@ -33,10 +34,14 @@ import java.lang.ref.SoftReference
 @Route(path = RouterUrl.WALLET_RECHARGE_DEMO)
 class UBeanRechargeDemoActivity : UChatActivity() {
 
-    private lateinit var binding: ActivityUbeanRechargeDemoBinding
+    private lateinit var binding: ActivityUbeanRechargeBinding
 
     private lateinit var mAdapter: UBeanRechargeAdapter
 
+    companion object {
+        const val ITEM_REFRESH_TYPE: Int = 1 //item 局部 刷新
+    }
+
     @JvmField
     @Autowired(name = "sign")
     var sign = 0
@@ -44,11 +49,11 @@ class UBeanRechargeDemoActivity : UChatActivity() {
     private var mUBean: UserUBean? = null  //选中的礼物
 
 
-    override fun getLayoutId() = R.layout.activity_ubean_recharge_demo
+    override fun getLayoutId() = R.layout.activity_ubean_recharge
 
 
     override fun initEventAndData() {
-        binding = ActivityUbeanRechargeDemoBinding.bind(contentView)
+        binding = ActivityUbeanRechargeBinding.bind(contentView)
 
         titleBar()
 
@@ -62,12 +67,14 @@ class UBeanRechargeDemoActivity : UChatActivity() {
 
     }
 
+
     //  请求 U豆充值档位数据
     private fun getData() {
 
         execute(WalletCore.get().getUBeanList("android"), object : CoreCallback<List<UserUBean>>() {
             override fun onSuccess(t: List<UserUBean>?) {
                 super.onSuccess(t)
+                if (t == null) return
                 mAdapter.setNewData(t)
             }
 
@@ -88,8 +95,24 @@ class UBeanRechargeDemoActivity : UChatActivity() {
         execute(WalletCore.get().rechargeAccountInfo, object : CoreCallback<RechargeAccountInfo>() {
             override fun onSuccess(t: RechargeAccountInfo?) {
                 super.onSuccess(t)
-                binding.tvUBeanSurplusValue.text = t?.beans?.toString()
-                binding.tvUBeanBalanceDes.text = t?.des?.toString()
+                if (t == null) return
+
+                binding.tvUBeanSurplusValue.text = if (TextUtils.isEmpty(t.beans.toString())) "0" else t.beans.toString()
+
+                if (!TextUtils.isEmpty(t.des?.toString())) {
+                    binding.tvUBeanBalanceDes.visibility = View.VISIBLE
+                    binding.tvUBeanBalanceDes.text = t.des?.toString()
+                } else {
+                    binding.tvUBeanBalanceDes.visibility = View.GONE
+                }
+
+
+                if (!TextUtils.isEmpty(t.tip?.toString())) {
+                    binding.tvUBeanTip.visibility = View.VISIBLE
+                    binding.tvUBeanTip.text = t.tip?.toString()
+                } else {
+                    binding.tvUBeanTip.visibility = View.GONE
+                }
 
             }
 
@@ -100,6 +123,7 @@ class UBeanRechargeDemoActivity : UChatActivity() {
         })
     }
 
+
     //  绑定点击事件
     private fun initClickListener() {
 
@@ -112,10 +136,10 @@ class UBeanRechargeDemoActivity : UChatActivity() {
                 val i = mAdapter.getmSelectPosition()
                 mAdapter.setSelectPosition(position)
 
-                mAdapter.notifyItemChanged(i, 1)
-                mAdapter.notifyItemChanged(position, 1)
+                mAdapter.notifyItemChanged(i, ITEM_REFRESH_TYPE)
+                mAdapter.notifyItemChanged(position, ITEM_REFRESH_TYPE)
 
-                mUBean = mAdapter.getItem(position)!!
+                mUBean = mAdapter.getItem(position)
 
             }
         }
@@ -141,18 +165,17 @@ class UBeanRechargeDemoActivity : UChatActivity() {
                             return@run;
                         }
 
-
                         if (binding.cbBeanAgreement.isChecked) {
                             if (mUBean == null) {
                                 ToastUtils.showShort("请选择充值金额");
                                 return@run;
                             }
+
                         } else {
                             ToastUtils.showShort("请勾选协议")
                             return@run;
                         }
 
-
                         showPayDialog()
                     }
                 }

+ 2 - 1
uchat_wallet/src/main/java/com/shanp/youqi/wallet/adapter/UBeanRechargeAdapter.java

@@ -19,6 +19,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils;
 
 public class UBeanRechargeAdapter extends BaseQuickAdapter<UserUBean, BaseViewHolder> {
     private int mSelectPosition = 0;
+    private double ITEM_REFRESH_TYPE = 1; //局部刷新类型
 
     public UBeanRechargeAdapter(@Nullable List<UserUBean> data) {
         super(R.layout.item_ubean_recharge, data);
@@ -45,7 +46,7 @@ public class UBeanRechargeAdapter extends BaseQuickAdapter<UserUBean, BaseViewHo
     protected void convertPayloads(@NonNull BaseViewHolder helper, UserUBean item, @NonNull List<Object> payloads) {
         super.convertPayloads(helper, item, payloads);
         for (Object payload : payloads) {
-            if ((int) payload == 1) {
+            if ((int) payload == ITEM_REFRESH_TYPE) {
 
                 if (helper.getAdapterPosition() == mSelectPosition) {
                     selectView(helper);