房间相册 解锁
This commit is contained in:
@@ -0,0 +1,55 @@
|
||||
package com.yizhuan.erban.avroom.room_album
|
||||
|
||||
import android.annotation.SuppressLint
|
||||
import android.os.Bundle
|
||||
import com.hjq.toast.ToastUtils
|
||||
import com.yizhuan.erban.base.BaseDialog
|
||||
import com.yizhuan.erban.databinding.DialogLockRoomAlbumPhotoBinding
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
import com.yizhuan.xchat_android_core.room.model.AvRoomModel
|
||||
|
||||
class UnlockRoomAlbumPhotoDialog : BaseDialog<DialogLockRoomAlbumPhotoBinding>(){
|
||||
|
||||
var onUnlockRoomPhotoListener: OnUnlockRoomPhotoListener? = null
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
override fun init() {
|
||||
val arguments = requireArguments()
|
||||
val giftUrl = arguments.getString("giftUrl")
|
||||
val giftName = arguments.getString("giftName")
|
||||
val price = arguments.getInt("price")
|
||||
val photoId = arguments.getInt("photoId")
|
||||
|
||||
ImageLoadUtilsV2.loadImage(binding.ivGift, giftUrl)
|
||||
binding.tvGiftName.text = giftName
|
||||
binding.tvValue.text = price.toString()
|
||||
|
||||
binding.tvAction.setOnClickListener {
|
||||
AvRoomModel.get().unlockRoomPhoto(AvRoomDataManager.get().roomUid, photoId)
|
||||
.subscribe({
|
||||
onUnlockRoomPhotoListener?.onUnlockRoomPhoto()
|
||||
dismiss()
|
||||
}, {
|
||||
ToastUtils.show(it.message)
|
||||
})
|
||||
}
|
||||
}
|
||||
|
||||
companion object{
|
||||
fun newInstance(photoId:Int, giftUrl: String, giftName:String, price:Int): UnlockRoomAlbumPhotoDialog {
|
||||
val args = Bundle()
|
||||
args.putInt("photoId", photoId)
|
||||
args.putString("giftUrl", giftUrl)
|
||||
args.putString("giftName", giftName)
|
||||
args.putInt("price", price)
|
||||
val fragment = UnlockRoomAlbumPhotoDialog()
|
||||
fragment.arguments = args
|
||||
return fragment
|
||||
}
|
||||
}
|
||||
|
||||
fun interface OnUnlockRoomPhotoListener{
|
||||
fun onUnlockRoomPhoto()
|
||||
}
|
||||
}
|
@@ -70,6 +70,7 @@ import com.yizhuan.erban.R;
|
||||
import com.yizhuan.erban.UIHelper;
|
||||
import com.yizhuan.erban.avroom.activity.AVRoomActivity;
|
||||
import com.yizhuan.erban.avroom.dialog.PKResultDialog;
|
||||
import com.yizhuan.erban.avroom.room_album.UnlockRoomAlbumPhotoDialog;
|
||||
import com.yizhuan.erban.common.util.Utils;
|
||||
import com.yizhuan.erban.common.widget.CustomAutoWidthImageSpan;
|
||||
import com.yizhuan.erban.common.widget.CustomImageSpan;
|
||||
@@ -131,6 +132,7 @@ import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomLuckySeaMsgBean;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomNoticeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomPhoto;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomReceivedLuckyGiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomTipAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.TarotAttachment;
|
||||
@@ -1043,6 +1045,7 @@ public class MessageView extends FrameLayout {
|
||||
ImageView ivGift = baseViewHolder.itemView.findViewById(R.id.iv_gift);
|
||||
TextView tvNick = baseViewHolder.itemView.findViewById(R.id.tv_nick);
|
||||
TextView tvValue = baseViewHolder.itemView.findViewById(R.id.tv_value);
|
||||
TextView tvUnlock = baseViewHolder.itemView.findViewById(R.id.tv_unlock);
|
||||
|
||||
RoomAlbumAttachment attachment = (RoomAlbumAttachment) chatRoomMessage.getAttachment();
|
||||
RoomAlbumMsgInfo mRoomAlbumMsgInfo = attachment.getMRoomAlbumMsgInfo();
|
||||
@@ -1052,10 +1055,26 @@ public class MessageView extends FrameLayout {
|
||||
|
||||
ImageLoadUtilsV2.loadImage(ivUserLevel, mRoomAlbumMsgInfo.getUserLevel().getExperUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivUserCharm, mRoomAlbumMsgInfo.getUserLevel().getCharmUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivPhoto, mRoomAlbumMsgInfo.getRoomPhoto().getPhotoUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivGift, mRoomAlbumMsgInfo.getRoomPhoto().getGiftUrl());
|
||||
RoomPhoto roomPhoto = mRoomAlbumMsgInfo.getRoomPhoto();
|
||||
ImageLoadUtilsV2.loadImage(ivPhoto, roomPhoto.getPhotoUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivGift, roomPhoto.getGiftUrl());
|
||||
tvNick.setText(mRoomAlbumMsgInfo.getUser().getNick());
|
||||
tvValue.setText(String.valueOf(mRoomAlbumMsgInfo.getRoomPhoto().getTotalGoldPrice()));
|
||||
tvValue.setText(String.valueOf(roomPhoto.getTotalGoldPrice()));
|
||||
tvUnlock.setOnClickListener(v -> {
|
||||
UnlockRoomAlbumPhotoDialog unlockRoomAlbumPhotoDialog = UnlockRoomAlbumPhotoDialog.Companion
|
||||
.newInstance(roomPhoto.getId(), roomPhoto.getGiftUrl(), roomPhoto.getGiftName(), roomPhoto.getTotalGoldPrice());
|
||||
unlockRoomAlbumPhotoDialog.setOnUnlockRoomPhotoListener(() -> {
|
||||
|
||||
});
|
||||
unlockRoomAlbumPhotoDialog.show(mContext);
|
||||
//new DialogManager(mContext).showOkDialog("是否解锁", () -> {
|
||||
// AvRoomModel.get().unlockRoomPhoto(AvRoomDataManager.get().getRoomUid(), mRoomAlbumMsgInfo.getRoomPhoto().getId())
|
||||
// .subscribe(data -> {
|
||||
// ToastUtils.show("成功");
|
||||
// }, e -> {});
|
||||
//});
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
10
app/src/main/res/drawable/bg_5aecfa_cf70ff_20.xml
Normal file
10
app/src/main/res/drawable/bg_5aecfa_cf70ff_20.xml
Normal file
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<corners android:radius="@dimen/dp_20" />
|
||||
|
||||
<gradient
|
||||
android:endColor="@color/color_CF70FF"
|
||||
android:startColor="#5AECFA" />
|
||||
|
||||
</shape>
|
91
app/src/main/res/layout/dialog_lock_room_album_photo.xml
Normal file
91
app/src/main/res/layout/dialog_lock_room_album_photo.xml
Normal file
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/bg_white_cornor_8">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_title"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:text="贈送禮物解鎖照片"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_close"
|
||||
android:layout_width="@dimen/dp_32"
|
||||
android:layout_height="@dimen/dp_32"
|
||||
android:padding="@dimen/dp_10"
|
||||
android:src="@drawable/ic_confirm_payment_close"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift"
|
||||
android:layout_width="@dimen/dp_80"
|
||||
android:layout_height="@dimen/dp_80"
|
||||
android:layout_marginTop="@dimen/dp_24"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_title" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_gift_name"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="礼物名字"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_gift" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_diamond"
|
||||
android:layout_width="@dimen/dp_18"
|
||||
android:layout_height="@dimen/dp_18"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:src="@mipmap/ic_charge_diamond"
|
||||
app:layout_constraintEnd_toStartOf="@id/tv_value"
|
||||
app:layout_constraintHorizontal_chainStyle="packed"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_gift_name" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_2"
|
||||
android:text="礼物名字"
|
||||
android:textColor="@color/color_1F1B4F"
|
||||
android:textSize="@dimen/sp_14"
|
||||
app:layout_constraintBottom_toBottomOf="@id/iv_diamond"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/iv_diamond"
|
||||
app:layout_constraintTop_toTopOf="@id/iv_diamond" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_action"
|
||||
android:layout_width="@dimen/dp_250"
|
||||
android:layout_height="@dimen/dp_44"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:layout_marginBottom="@dimen/dp_24"
|
||||
android:background="@drawable/bg_5aecfa_cf70ff_20"
|
||||
android:gravity="center"
|
||||
android:text="馬上解鎖"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/sp_16"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/tv_value" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
Reference in New Issue
Block a user