房间相册 发送图片至公屏
This commit is contained in:
@@ -74,7 +74,11 @@ class RoomAlbumFragment : BaseViewBindingFragment<FragmentRoomAlbumBinding>() {
|
||||
setOnItemChildClickListener { _, view, position ->
|
||||
if (view.id == R.id.v_action) {
|
||||
val buttonItems = listOf(
|
||||
ButtonItem("發送到公屏", {}),
|
||||
ButtonItem("發送到公屏") {
|
||||
dialogManager.showOkCancelDialog("確認將該照片發送至公屏") {
|
||||
viewModel.sendPhoto(data[position].id)
|
||||
}
|
||||
},
|
||||
ButtonItem("刪除照片", {}),
|
||||
ButtonItem("查看大圖", {})
|
||||
)
|
||||
|
@@ -2,6 +2,7 @@ package com.yizhuan.erban.avroom.room_album
|
||||
|
||||
import androidx.lifecycle.LiveData
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import com.hjq.toast.ToastUtils
|
||||
import com.yizhuan.erban.avroom.bean.RoomAlbumPhotoInfo
|
||||
import com.yizhuan.erban.base.BaseViewModel
|
||||
import com.yizhuan.xchat_android_core.manager.AvRoomDataManager
|
||||
@@ -25,4 +26,13 @@ class RoomAlbumFragmentViewModel : BaseViewModel() {
|
||||
_myPhotosLiveData.value = value
|
||||
}
|
||||
}
|
||||
|
||||
fun sendPhoto(photoId: Int) {
|
||||
safeLaunch(block = {
|
||||
RoomAlbumModel.sendPhoto(AvRoomDataManager.get().roomUid, photoId)
|
||||
}, onComplete = {
|
||||
ToastUtils.show("發送成功")
|
||||
})
|
||||
|
||||
}
|
||||
}
|
@@ -26,6 +26,12 @@ object RoomAlbumModel {
|
||||
}
|
||||
}
|
||||
|
||||
suspend fun sendPhoto(roomUid: Long, photoId: Int) : String? {
|
||||
return launchRequest {
|
||||
api.sendPhoto(roomUid, photoId)
|
||||
}
|
||||
}
|
||||
|
||||
private interface Api {
|
||||
|
||||
@GET("roomAlbum/pagePhoto")
|
||||
@@ -44,5 +50,12 @@ object RoomAlbumModel {
|
||||
@Field("photoUrls") photoUrls: String,
|
||||
@Field("giftId") giftId: Int?,
|
||||
): ServiceResult<String>
|
||||
|
||||
@FormUrlEncoded
|
||||
@POST("roomAlbum/sendPhoto")
|
||||
suspend fun sendPhoto(
|
||||
@Field("roomUid") roomUid: Long,
|
||||
@Field("id") photoId: Int,
|
||||
): ServiceResult<String>
|
||||
}
|
||||
}
|
@@ -77,6 +77,7 @@ import com.yizhuan.erban.common.widget.OriginalDrawStatusClickSpan;
|
||||
import com.yizhuan.erban.treasure_box.widget.GoldBoxHelper;
|
||||
import com.yizhuan.erban.treasurefairy.HomeFairyActivity;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtils;
|
||||
import com.yizhuan.erban.ui.utils.ImageLoadUtilsV2;
|
||||
import com.yizhuan.erban.ui.widget.DividerItemDecoration;
|
||||
import com.yizhuan.erban.ui.widget.MyItemAnimator;
|
||||
import com.yizhuan.erban.ui.widget.RecyclerViewNoViewpagerScroll;
|
||||
@@ -122,6 +123,8 @@ import com.yizhuan.xchat_android_core.im.custom.bean.MultiGiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.MultiLuckyGiftAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.NobleAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RedPackageRoomMsgAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomAlbumAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomAlbumMsgInfo;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomBoxPrizeAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment;
|
||||
import com.yizhuan.xchat_android_core.im.custom.bean.RoomFollowOwnerAttachment2;
|
||||
@@ -1036,6 +1039,23 @@ public class MessageView extends FrameLayout {
|
||||
private void setRoomAlbumMsg(ChatRoomMessage chatRoomMessage, MessageViewHolder baseViewHolder) {
|
||||
ImageView ivUserLevel = baseViewHolder.itemView.findViewById(R.id.iv_user_level);
|
||||
ImageView ivUserCharm = baseViewHolder.itemView.findViewById(R.id.iv_user_charm);
|
||||
ImageView ivPhoto = baseViewHolder.itemView.findViewById(R.id.iv_photo);
|
||||
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);
|
||||
|
||||
RoomAlbumAttachment attachment = (RoomAlbumAttachment) chatRoomMessage.getAttachment();
|
||||
RoomAlbumMsgInfo mRoomAlbumMsgInfo = attachment.getMRoomAlbumMsgInfo();
|
||||
if (mRoomAlbumMsgInfo == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
ImageLoadUtilsV2.loadImage(ivUserLevel, mRoomAlbumMsgInfo.getUserLevel().getExperUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivUserCharm, mRoomAlbumMsgInfo.getUserLevel().getCharmUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivPhoto, mRoomAlbumMsgInfo.getRoomPhoto().getPhotoUrl());
|
||||
ImageLoadUtilsV2.loadImage(ivGift, mRoomAlbumMsgInfo.getRoomPhoto().getGiftUrl());
|
||||
tvNick.setText(mRoomAlbumMsgInfo.getUser().getNick());
|
||||
tvValue.setText(String.valueOf(mRoomAlbumMsgInfo.getRoomPhoto().getTotalGoldPrice()));
|
||||
|
||||
}
|
||||
|
||||
|
@@ -43,6 +43,7 @@
|
||||
android:layout_width="@dimen/dp_140"
|
||||
android:layout_height="@dimen/dp_140"
|
||||
android:layout_marginTop="@dimen/dp_4"
|
||||
android:scaleType="centerCrop"
|
||||
android:src="@drawable/default_cover"
|
||||
app:layout_constraintStart_toStartOf="@id/iv_user_level"
|
||||
app:layout_constraintTop_toBottomOf="@id/iv_user_level"
|
||||
|
Reference in New Issue
Block a user