删除房间停留获取免费礼物相关代码
This commit is contained in:
@@ -1,68 +0,0 @@
|
||||
package com.chwl.app.avroom.dialog;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Display;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
||||
import androidx.databinding.DataBindingUtil;
|
||||
|
||||
import com.google.android.material.bottomsheet.BottomSheetDialog;
|
||||
import com.chwl.app.R;
|
||||
import com.chwl.app.databinding.DialogRoomFreeGiftBinding;
|
||||
import com.chwl.app.ui.utils.ImageLoadUtilsV2;
|
||||
import com.chwl.core.gift.bean.GiftFreeInfo;
|
||||
import com.chwl.library.utils.TimeUtils;
|
||||
|
||||
/**
|
||||
* 房间免费礼物弹窗
|
||||
* Created by wushaocheng on 2022/12/14.
|
||||
*/
|
||||
public class RoomFreeGiftDialog extends BottomSheetDialog implements View.OnClickListener {
|
||||
private Context context;
|
||||
private GiftFreeInfo giftFreeInfo;
|
||||
private DialogRoomFreeGiftBinding binding;
|
||||
|
||||
public RoomFreeGiftDialog(Context context, GiftFreeInfo giftFreeInfo) {
|
||||
super(context, R.style.ErbanBottomSheetDialog);
|
||||
this.context = context;
|
||||
this.giftFreeInfo = giftFreeInfo;
|
||||
}
|
||||
|
||||
@SuppressWarnings("ConstantConditions")
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setCanceledOnTouchOutside(true);
|
||||
setContentView(R.layout.dialog_room_free_gift);
|
||||
binding = DataBindingUtil.bind(findViewById(R.id.dialog_container));
|
||||
binding.setClick(this);
|
||||
|
||||
WindowManager windowManager = (WindowManager) context.getSystemService(Context.WINDOW_SERVICE);
|
||||
Display d = windowManager.getDefaultDisplay();
|
||||
DisplayMetrics realDisplayMetrics = new DisplayMetrics();
|
||||
d.getRealMetrics(realDisplayMetrics);
|
||||
WindowManager.LayoutParams params = getWindow().getAttributes();
|
||||
params.width = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.height = WindowManager.LayoutParams.MATCH_PARENT;
|
||||
params.dimAmount = 0f;
|
||||
getWindow().setAttributes(params);
|
||||
|
||||
binding.tvTop.setText(context.getString(R.string.dialog_free_gift_top, TimeUtils.secondsToTime(giftFreeInfo.getFirstSecond())));
|
||||
binding.tvBottom.setText(String.format(context.getString(R.string.dialog_free_gift_bottom_text), giftFreeInfo.getGiftName(), giftFreeInfo.getMaxStage()));
|
||||
ImageLoadUtilsV2.loadImage(binding.ivGiftIcon, giftFreeInfo.getGiftUrl());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.iv_delete:
|
||||
case R.id.tv_know:
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
@@ -40,7 +40,6 @@ import com.chwl.app.avroom.activity.RoomTitleEditActivity
|
||||
import com.chwl.app.avroom.adapter.OnMicroItemClickListener
|
||||
import com.chwl.app.avroom.dialog.AttentionHintDialog
|
||||
import com.chwl.app.avroom.dialog.DatingVipRuleDialog
|
||||
import com.chwl.app.avroom.dialog.RoomFreeGiftDialog
|
||||
import com.chwl.app.avroom.firstcharge.FirstChargeDialog
|
||||
import com.chwl.app.avroom.presenter.BaseRoomPresenter
|
||||
import com.chwl.app.avroom.room_album.RoomAlbumModel
|
||||
@@ -102,7 +101,6 @@ import com.chwl.core.user.bean.BaseInfo
|
||||
import com.chwl.core.user.bean.UserInfo
|
||||
import com.chwl.core.utils.net.VipLevelNotEnoughException
|
||||
import com.chwl.library.common.util.LimitClickUtils
|
||||
import com.chwl.library.common.util.SPUtils
|
||||
import com.chwl.library.net.rxnet.utils.RxNetWorkUtils
|
||||
import com.chwl.library.rxbus.RxBus
|
||||
import com.chwl.library.utils.*
|
||||
@@ -138,8 +136,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
private var isCloseScreen = false
|
||||
private var isOpenRedPackage = false
|
||||
|
||||
private var roomFreeGiftDialog: RoomFreeGiftDialog? = null
|
||||
|
||||
private val mClickLimit by lazy { LimitClickUtils() }
|
||||
|
||||
@JvmField
|
||||
@@ -503,7 +499,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
}
|
||||
|
||||
private fun releaseView() {
|
||||
roomFreeGiftDialog?.dismiss()
|
||||
messageView.release()
|
||||
microView.release()
|
||||
musicPlayerView?.release()
|
||||
@@ -1135,16 +1130,6 @@ open class BaseRoomFragment<V : IBaseRoomView?, P : BaseRoomPresenter<V>?> :
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
fun onRoomFreeGiftEvent(event: RoomFreeGiftEvent) {
|
||||
event.giftFreeInfo?.let {
|
||||
if (UIUtils.isTopActivity(context as Activity?) && isResumed) {
|
||||
if (roomFreeGiftDialog?.isShowing == true) {
|
||||
roomFreeGiftDialog?.dismiss()
|
||||
}
|
||||
roomFreeGiftDialog = RoomFreeGiftDialog(context, it)
|
||||
roomFreeGiftDialog?.show()
|
||||
SPUtils.putBoolean(Constants.IS_SHOW_FREE_GIFT, true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
@@ -1,81 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="click"
|
||||
type="android.view.View.OnClickListener" />
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/dialog_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="349dp"
|
||||
android:background="@drawable/bg_common_top_25_black"
|
||||
android:orientation="vertical">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_delete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="end"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:layout_marginEnd="@dimen/dp_15"
|
||||
android:onClick="@{click}"
|
||||
android:src="@drawable/dialog_free_gift_delete" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_top"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginStart="55dp"
|
||||
android:layout_marginTop="@dimen/dp_5"
|
||||
android:layout_marginEnd="55dp"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_free_gift_top"
|
||||
android:textColor="@color/color_white"
|
||||
android:textSize="@dimen/sp_15" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_gift_icon"
|
||||
android:layout_width="120dp"
|
||||
android:layout_height="106dp"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:layout_marginTop="@dimen/dp_16" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_bottom"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_24"
|
||||
android:layout_marginTop="@dimen/dp_22"
|
||||
android:layout_marginEnd="@dimen/dp_24"
|
||||
android:gravity="center"
|
||||
android:text="@string/dialog_free_gift_bottom_text"
|
||||
android:textColor="@color/color_B3B3C3"
|
||||
android:textSize="@dimen/sp_12" />
|
||||
|
||||
<View
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_know"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="46dp"
|
||||
android:layout_gravity="bottom"
|
||||
android:layout_marginStart="88dp"
|
||||
android:layout_marginEnd="88dp"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
android:background="@drawable/base_shape_theme_30dp"
|
||||
android:gravity="center"
|
||||
android:onClick="@{click}"
|
||||
android:text="@string/dialog_free_gift_know"
|
||||
android:textColor="@color/base_color_theme_text"
|
||||
android:textSize="@dimen/sp_16" />
|
||||
|
||||
</LinearLayout>
|
||||
</layout>
|
Reference in New Issue
Block a user