diff --git a/app/src/main/java/com/nnbc123/app/avroom/fragment/PrivilegeCardFragment.kt b/app/src/main/java/com/nnbc123/app/avroom/fragment/PrivilegeCardFragment.kt index 20297e52d..a2fb0e90c 100644 --- a/app/src/main/java/com/nnbc123/app/avroom/fragment/PrivilegeCardFragment.kt +++ b/app/src/main/java/com/nnbc123/app/avroom/fragment/PrivilegeCardFragment.kt @@ -190,6 +190,12 @@ class PrivilegeCardFragment : BaseViewBindingFragment baseQuickAdapter; + public GiftDialog(Context context, int giftId) { this(context, 0, true, false, true, giftId); } @@ -406,6 +413,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene lineTabType = findViewById(R.id.line_tab_type); sendGiftButton = findViewById(R.id.btn_send); layoutEmpty = findViewById(R.id.layout_empty); + tvEmpty = findViewById(R.id.tv_empty); layoutLoading = findViewById(R.id.layout_loading); layoutLoadFiled = findViewById(R.id.layout_load_failed); reloadView = findViewById(R.id.tv_reload); @@ -474,6 +482,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene csPrivilege = findViewById(R.id.cs_privilege); tvNum = findViewById(R.id.tv_num); tvPrivilegeGive = findViewById(R.id.tv_privilege_give); + groupPrivilege = findViewById(R.id.group_privilege); ivWeekStarIcon = findViewById(R.id.iv_week_star_icon); ivAvatarCharm = findViewById(R.id.iv_avatar_charm); @@ -574,12 +583,12 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene compositeDisposable.add(GiftModel.get().requestKnapGiftInfos().subscribe()); //更新特权卡礼物 compositeDisposable.add(GiftModel.get().requestPrivilegeGiftInfos().subscribe((listServiceResult, throwable) -> { - if (throwable == null) { - if (listServiceResult.getData() != null && listServiceResult.getData().size() == 0) { - giftIndicator.hidePosition(GiftIndicator.TYPE_PRIVILEGE); - } - } - })); +// if (throwable == null) { +// if (listServiceResult.getData() != null && listServiceResult.getData().size() == 0) { +// giftIndicator.hidePosition(GiftIndicator.TYPE_PRIVILEGE); +// } +// } + })); initVipPager(); viewNewFeature = findViewById(R.id.view_new_feature); if (DemoCache.readNewGiftTypeTipIndicator()) { @@ -703,8 +712,50 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene if (position == GiftIndicator.TYPE_PRIVILEGE) { showPrivilegeEmptyView(); if (!ListUtils.isListEmpty(currentGiftPrivilegeInfoList)) { + tvPrivilegeGive.setText("赠送"); showPrivilegeView(); + } else { + tvEmpty.setText(context.getText(R.string.text_gift_privilege_empty)); + layoutEmpty.setVisibility(View.VISIBLE); + groupPrivilege.setVisibility(View.GONE); + tvPrivilegeGive.setText("说明"); } + tvPrivilegeGive.setOnClickListener(v -> { + if (tvPrivilegeGive.getText().toString().equals("说明")) { + if (privilegeTipDialog == null) { + privilegeTipDialog = new PrivilegeTipDialog(context); + privilegeTipDialog.setOnActionListener(new PrivilegeTipDialog.OnActionListener() { + @Override + public void onOk() { + privilegeTipDialog.dismiss(); + } + }); + privilegeTipDialog.show(); + } else { + privilegeTipDialog.show(); + } + } else { + if (currentGiftPrivilegeInfoList.get(mPrivilegePosition).getDailyNum() == 0) { + SingleToastUtil.showToast("今日可赠送次数不足"); + } else { + compositeDisposable.add(GiftModel.get() + .givePrivilegeCard(String.valueOf(baseQuickAdapter.getItem(mPrivilegePosition).getId()), + AvRoomDataManager.get().getRoomUid() + "", AuthModel.get().getCurrentUid() + "") + .subscribe((listServiceResult, throwable) -> { + if (throwable == null) { + GiftPrivilegeInfo giftPrivilegeInfo = currentGiftPrivilegeInfoList.get(mPrivilegePosition); + giftPrivilegeInfo.setDailyNum(giftPrivilegeInfo.getDailyNum() - 1); + baseQuickAdapter.notifyItemChanged(mPrivilegePosition); + tvNum.setText(String.valueOf(giftPrivilegeInfo.getDailyNum())); + + } else { + SingleToastUtil.showToast(throwable.getMessage()); + } + }) + ); + } + } + }); } else if (isKnap) { tvGiftValue.setVisibility(View.VISIBLE); showEmptyView(); @@ -785,7 +836,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene private void showPrivilegeView() { currentGiftPrivilegeInfoList.get(0).setSelected(true); tvNum.setText(String.valueOf(currentGiftPrivilegeInfoList.get(0).getDailyNum())); - BaseQuickAdapter baseQuickAdapter = new BaseQuickAdapter<>(R.layout.item_gift_privilege, currentGiftPrivilegeInfoList) { + baseQuickAdapter = new BaseQuickAdapter<>(R.layout.item_gift_privilege, currentGiftPrivilegeInfoList) { @Override protected void convert(BaseViewHolder helper, GiftPrivilegeInfo item) { if (item == null) { @@ -820,27 +871,6 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene mPrivilegePosition = position; }); privilegeView.setAdapter(baseQuickAdapter); - tvPrivilegeGive.setOnClickListener(v -> { - if (currentGiftPrivilegeInfoList.get(mPrivilegePosition).getDailyNum() == 0) { - SingleToastUtil.showToast("今日可赠送次数不足"); - } else { - compositeDisposable.add(GiftModel.get() - .givePrivilegeCard(String.valueOf(baseQuickAdapter.getItem(mPrivilegePosition).getId()), - AvRoomDataManager.get().getRoomUid() + "", AuthModel.get().getCurrentUid() + "") - .subscribe((listServiceResult, throwable) -> { - if (throwable == null) { - GiftPrivilegeInfo giftPrivilegeInfo = currentGiftPrivilegeInfoList.get(mPrivilegePosition); - giftPrivilegeInfo.setDailyNum(giftPrivilegeInfo.getDailyNum() - 1); - baseQuickAdapter.notifyItemChanged(mPrivilegePosition); - tvNum.setText(String.valueOf(giftPrivilegeInfo.getDailyNum())); - - } else { - SingleToastUtil.showToast(throwable.getMessage()); - } - }) - ); - } - }); } private void updateLuckyBagIntro() { @@ -1040,6 +1070,7 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene private void showEmptyView() { //tab对应的礼物列表为空的情况 + tvEmpty.setText(context.getText(R.string.text_gift_knapsack_empty)); layoutEmpty.setVisibility(View.VISIBLE); layoutLoadFiled.setVisibility(View.GONE); layoutLoading.setVisibility(View.GONE); @@ -1641,6 +1672,9 @@ public class GiftDialog extends BottomSheetDialog implements View.OnClickListene compositeDisposable.dispose(); compositeDisposable = null; } + if (privilegeTipDialog != null && privilegeTipDialog.isShowing()) { + privilegeTipDialog.dismiss(); + } } @Subscribe(threadMode = ThreadMode.MAIN) diff --git a/app/src/main/java/com/nnbc123/app/ui/widget/dialog/PrivilegeTipDialog.java b/app/src/main/java/com/nnbc123/app/ui/widget/dialog/PrivilegeTipDialog.java new file mode 100644 index 000000000..67d8bee72 --- /dev/null +++ b/app/src/main/java/com/nnbc123/app/ui/widget/dialog/PrivilegeTipDialog.java @@ -0,0 +1,57 @@ +package com.nnbc123.app.ui.widget.dialog; + +import android.content.Context; +import android.os.Bundle; +import android.widget.TextView; + +import com.nnbc123.app.R; + +/** + * @author jack + * @Description + * @Date 2019/1/21 + */ +public class PrivilegeTipDialog extends BaseDialog { + + public PrivilegeTipDialog(Context context) { + super(context, R.style.dialog); + init(); + } + + private void init() { + this.setCancelable(true); + this.setCanceledOnTouchOutside(true); + } + + @Override + protected void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.layout_privilege_dialog); + + TextView ok = findViewById(R.id.btn_ok); + if (ok != null) { + ok.setOnClickListener(v -> { + this.dismiss(); + if (l != null) { + l.onOk(); + } + }); + } + } + + private OnActionListener l; + + public void setOnActionListener(OnActionListener l) { + this.l = l; + } + + public interface OnActionListener { + default void onOk() { + } + + default void onCancel() { + } + } + + +} diff --git a/app/src/main/res/layout/dialog_bottom_gift.xml b/app/src/main/res/layout/dialog_bottom_gift.xml index e38f57ec0..e1b61d66b 100644 --- a/app/src/main/res/layout/dialog_bottom_gift.xml +++ b/app/src/main/res/layout/dialog_bottom_gift.xml @@ -506,7 +506,7 @@ android:layout_marginEnd="@dimen/dp_10" android:visibility="gone" app:layoutManager="androidx.recyclerview.widget.GridLayoutManager" - app:spanCount="2"/> + app:spanCount="2" /> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintTop_toTopOf="parent" /> + app:layout_constraintStart_toEndOf="@+id/tv_num" + app:layout_constraintTop_toTopOf="parent" /> + app:solid="@color/color_FFDA24" /> + + diff --git a/app/src/main/res/layout/layout_ok_cancel_dialog.xml b/app/src/main/res/layout/layout_ok_cancel_dialog.xml index dc7561707..312505311 100644 --- a/app/src/main/res/layout/layout_ok_cancel_dialog.xml +++ b/app/src/main/res/layout/layout_ok_cancel_dialog.xml @@ -31,15 +31,15 @@ android:id="@+id/message" android:layout_width="match_parent" android:layout_height="0dp" + android:gravity="center" android:layout_marginBottom="@dimen/dp_32" android:layout_weight="1" - android:gravity="center" android:lineSpacingMultiplier="1.2" android:paddingStart="20dp" android:paddingEnd="20dp" android:textColor="@color/color_333333" android:textSize="14sp" - tools:text="购买成功,是否立即驾驶sd水电费水电费?sfasdfasdfasdfasdfasdf" /> + tools:text="购买成功,是否立即驾驶sd水电费水电费?" /> + + + + + + + + + + + + + + + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index b4a3f7134..6672ccd49 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -748,6 +748,7 @@ 房主位 加载中,请稍候 暂时木有礼物~ + 暂时木有特权卡~ 请更新应用 余额不足,是否充值 加载失败,请重新加载 diff --git a/core/src/main/java/com/nnbc123/core/bean/PrivateChatLimitInfo.java b/core/src/main/java/com/nnbc123/core/bean/PrivateChatLimitInfo.java index e536a2526..f1a067fe9 100644 --- a/core/src/main/java/com/nnbc123/core/bean/PrivateChatLimitInfo.java +++ b/core/src/main/java/com/nnbc123/core/bean/PrivateChatLimitInfo.java @@ -7,6 +7,7 @@ public class PrivateChatLimitInfo implements Serializable { private String message; private int wealthLevel; private int charmLevel; + private int model; // @SuppressWarnings("all") @@ -53,6 +54,14 @@ public class PrivateChatLimitInfo implements Serializable { this.charmLevel = charmLevel; } + public int getModel() { + return model; + } + + public void setModel(int model) { + this.model = model; + } + @Override @SuppressWarnings("all") public boolean equals(final Object o) { @@ -63,9 +72,11 @@ public class PrivateChatLimitInfo implements Serializable { if (this.isChat() != other.isChat()) return false; if (this.getWealthLevel() != other.getWealthLevel()) return false; if (this.getCharmLevel() != other.getCharmLevel()) return false; + if (this.getModel() != other.getModel()) return false; final Object this$message = this.getMessage(); final Object other$message = other.getMessage(); - if (this$message == null ? other$message != null : !this$message.equals(other$message)) return false; + if (this$message == null ? other$message != null : !this$message.equals(other$message)) + return false; return true; } @@ -82,6 +93,7 @@ public class PrivateChatLimitInfo implements Serializable { result = result * PRIME + (this.isChat() ? 79 : 97); result = result * PRIME + this.getWealthLevel(); result = result * PRIME + this.getCharmLevel(); + result = result * PRIME + this.getModel(); final Object $message = this.getMessage(); result = result * PRIME + ($message == null ? 43 : $message.hashCode()); return result; @@ -90,7 +102,7 @@ public class PrivateChatLimitInfo implements Serializable { @Override @SuppressWarnings("all") public String toString() { - return "PrivateChatLimitInfo(chat=" + this.isChat() + ", message=" + this.getMessage() + ", wealthLevel=" + this.getWealthLevel() + ", charmLevel=" + this.getCharmLevel() + ")"; + return "PrivateChatLimitInfo(chat=" + this.isChat() + ", message=" + this.getMessage() + ", wealthLevel=" + this.getWealthLevel() + ", charmLevel=" + this.getCharmLevel() + ", model=" + this.getModel() + ")"; } // } diff --git a/nim_uikit/src/com/netease/nim/uikit/business/session/module/input/InputPanel.java b/nim_uikit/src/com/netease/nim/uikit/business/session/module/input/InputPanel.java index dcb364b71..07466105c 100644 --- a/nim_uikit/src/com/netease/nim/uikit/business/session/module/input/InputPanel.java +++ b/nim_uikit/src/com/netease/nim/uikit/business/session/module/input/InputPanel.java @@ -121,9 +121,10 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba private volatile boolean disable; - private boolean isChat; + private String hintText; + public InputPanel(Container container, View view, List actions, boolean isTextAudioSwitchShow) { this.container = container; this.view = view; @@ -952,14 +953,15 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba container.proxy.sendMessage(customMessage); } - public void setLimitLevel(boolean isChat, String msg) { + public void setLimitLevel(boolean isChat, String hintText) { this.isChat = isChat; + this.hintText = hintText; setEditTextState(); } private void setEditTextState() { if (!isChat) { - messageEditText.setHint("暂未达到可发起私聊等级"); + messageEditText.setHint(hintText); messageEditText.setFocusable(false); messageEditText.setFocusableInTouchMode(false); messageEditText.setEnabled(false);