1:修改飘屏问题,在BaseActivity中进行监听
2:修改礼物问题
This commit is contained in:
4
.idea/deploymentTargetSelector.xml
generated
4
.idea/deploymentTargetSelector.xml
generated
@@ -4,10 +4,10 @@
|
||||
<selectionStates>
|
||||
<SelectionState runConfigName="app">
|
||||
<option name="selectionMode" value="DROPDOWN" />
|
||||
<DropdownSelection timestamp="2025-09-05T11:48:42.014930600Z">
|
||||
<DropdownSelection timestamp="2025-09-06T01:15:31.429305Z">
|
||||
<Target type="DEFAULT_BOOT">
|
||||
<handle>
|
||||
<DeviceId pluginId="PhysicalDevice" identifier="serial=3142478285001BV" />
|
||||
<DeviceId pluginId="Default" identifier="serial=emulator-5554;connection=3358318f" />
|
||||
</handle>
|
||||
</Target>
|
||||
</DropdownSelection>
|
||||
|
||||
3
.idea/inspectionProfiles/Project_Default.xml
generated
3
.idea/inspectionProfiles/Project_Default.xml
generated
@@ -1,6 +1,9 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AutoCloseableResource" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="METHOD_MATCHER_CONFIG" value="java.util.Formatter,format,java.io.Writer,append,com.google.common.base.Preconditions,checkNotNull,org.hibernate.Session,close,java.io.PrintWriter,printf,java.io.PrintStream,printf,java.lang.foreign.Arena,ofAuto,java.lang.foreign.Arena,global,android.content.Context,obtainStyledAttributes" />
|
||||
</inspection_tool>
|
||||
<inspection_tool class="ComposePreviewDimensionRespectsLimit" enabled="true" level="WARNING" enabled_by_default="true">
|
||||
<option name="composableFile" value="true" />
|
||||
<option name="previewFile" value="true" />
|
||||
|
||||
@@ -30,7 +30,7 @@ isBuildModule=false
|
||||
android.injected.testOnly=false
|
||||
|
||||
APP_VERSION_NAME=1.0.0
|
||||
APP_VERSION_CODE=114
|
||||
APP_VERSION_CODE=115
|
||||
|
||||
org.gradle.jvm.toolchain.useLegacyAdapters=false
|
||||
#org.gradle.java.home=C\:\\Users\\qx\\.jdks\\ms-17.0.15
|
||||
|
||||
@@ -2,6 +2,9 @@ package com.xscm.moduleutil.activity;
|
||||
|
||||
import static androidx.core.content.ContextCompat.getSystemService;
|
||||
|
||||
import android.animation.Animator;
|
||||
import android.animation.AnimatorListenerAdapter;
|
||||
import android.animation.ObjectAnimator;
|
||||
import android.content.BroadcastReceiver;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
@@ -13,11 +16,18 @@ import android.net.Uri;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.ViewTreeObserver;
|
||||
import android.view.WindowManager;
|
||||
import android.view.animation.DecelerateInterpolator;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.EditText;
|
||||
import android.widget.FrameLayout;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
@@ -32,10 +42,13 @@ import com.hjq.toast.ToastUtils;
|
||||
import com.tencent.qcloud.tuikit.tuichat.bean.ChatInfo;
|
||||
import com.xscm.moduleutil.R;
|
||||
import com.xscm.moduleutil.base.CommonAppContext;
|
||||
import com.xscm.moduleutil.bean.XLHBean;
|
||||
import com.xscm.moduleutil.event.MqttBean;
|
||||
import com.xscm.moduleutil.utils.ARouteConstants;
|
||||
import com.xscm.moduleutil.utils.BackgroundManager;
|
||||
import com.xscm.moduleutil.utils.ColorManager;
|
||||
import com.xscm.moduleutil.utils.DisplayUtil;
|
||||
import com.xscm.moduleutil.utils.ImageUtils;
|
||||
import com.xscm.moduleutil.utils.LanguageUtil;
|
||||
import com.xscm.moduleutil.utils.SpUtil;
|
||||
import com.xscm.moduleutil.widget.PiaoPingManager;
|
||||
@@ -52,9 +65,14 @@ import java.util.Map;
|
||||
public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends AppCompatActivity
|
||||
implements BackgroundManager.BackgroundUpdateListener, ColorManager.ColorChangeListener {
|
||||
|
||||
// @Override
|
||||
// protected void attachBaseContext(Context newBase) {
|
||||
// super.attachBaseContext(LanguageUtil.attachBaseContext(newBase));
|
||||
// }
|
||||
@Override
|
||||
protected void attachBaseContext(Context newBase) {
|
||||
super.attachBaseContext(LanguageUtil.attachBaseContext(newBase));
|
||||
// 设置字体缩放比例为1.0f,即不跟随系统字体大小变化
|
||||
super.attachBaseContext(DisplayUtil.attachBaseContext(newBase, 1.0f));
|
||||
}
|
||||
|
||||
protected VDB mBinding;
|
||||
@@ -82,7 +100,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
|
||||
ActivityUtils.finishAllActivities();
|
||||
}
|
||||
private PiaoPingManager piaoPingManager;
|
||||
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
@@ -126,22 +145,8 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
}
|
||||
|
||||
|
||||
// // 设置全屏模式,隐藏状态栏和导航栏
|
||||
// View decorView = getWindow().getDecorView();
|
||||
// decorView.setSystemUiVisibility(
|
||||
// View.SYSTEM_UI_FLAG_LAYOUT_STABLE
|
||||
// | View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION
|
||||
// | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN
|
||||
// | View.SYSTEM_UI_FLAG_HIDE_NAVIGATION
|
||||
// | View.SYSTEM_UI_FLAG_FULLSCREEN
|
||||
// | View.SYSTEM_UI_FLAG_IMMERSIVE_STICKY);
|
||||
|
||||
// if (piaoPingManager==null){
|
||||
// piaoPingManager = PiaoPingManager.getInstance(this);
|
||||
// }
|
||||
|
||||
|
||||
}
|
||||
|
||||
// 在Activity中
|
||||
private static final int REQUEST_OVERLAY_PERMISSION = 1001;
|
||||
|
||||
@@ -355,16 +360,398 @@ public abstract class BaseAppCompatActivity<VDB extends ViewDataBinding> extends
|
||||
return false;
|
||||
}
|
||||
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// public void onMessageReceived(MqttBean mqttBean) {
|
||||
//// PiaoPingManager.getInstance(this).showPiaoPingMessage(mqttBean);
|
||||
// FxAppHelper fxAppHelper = FxAppHelper.builder().setContext(this).setLayout(R.layout.item_piaoping).build();
|
||||
// FloatingX.install(fxAppHelper).show();
|
||||
// 在类中添加以下成员变量
|
||||
private final List<MqttBean> messageQueue = new ArrayList<>(); // 消息队列
|
||||
private boolean isPlaying = false; // 播放状态标志
|
||||
private final Object queueLock = new Object(); // 队列同步锁
|
||||
///礼物特效
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageReceived(MqttBean mqttBean) {
|
||||
if (mqttBean == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 将消息添加到队列
|
||||
synchronized (queueLock) {
|
||||
messageQueue.add(mqttBean);
|
||||
}
|
||||
// 尝试播放下一个消息
|
||||
processNextMessage();
|
||||
|
||||
}
|
||||
|
||||
|
||||
private void processNextMessage() {
|
||||
synchronized (queueLock) {
|
||||
// 如果正在播放或队列为空,则不处理
|
||||
if (isPlaying || messageQueue.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
|
||||
// 标记为正在播放
|
||||
isPlaying = true;
|
||||
}
|
||||
|
||||
MqttBean mqttBean;
|
||||
synchronized (queueLock) {
|
||||
mqttBean = messageQueue.remove(0); // 取出队列中的第一个消息
|
||||
}
|
||||
|
||||
// 显示飘屏消息
|
||||
showFloatingMessage(mqttBean);
|
||||
}
|
||||
|
||||
private View floatingView; // 成员变量保存浮动视图
|
||||
private boolean isFloatingViewAdded = false; // 标记浮动视图是否已添加到 decorView
|
||||
|
||||
private void showFloatingMessage(MqttBean mqttBean) {
|
||||
ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
|
||||
// 如果浮动视图未创建,则创建一次
|
||||
if (floatingView == null) {
|
||||
floatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
|
||||
|
||||
// 设置布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 70);
|
||||
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
|
||||
floatingView.setLayoutParams(layoutParams);
|
||||
|
||||
// 初始化动画监听器
|
||||
setupAnimationListener(floatingView, decorView);
|
||||
}
|
||||
|
||||
// 更新视图数据
|
||||
updateFloatingViewData(mqttBean);
|
||||
|
||||
// 如果浮动视图未添加到 decorView,则添加
|
||||
if (!isFloatingViewAdded) {
|
||||
decorView.addView(floatingView);
|
||||
isFloatingViewAdded = true;
|
||||
}
|
||||
|
||||
// 重置视图位置并开始动画
|
||||
resetAndStartAnimation(floatingView);
|
||||
}
|
||||
|
||||
private void setupAnimationListener(View floatingView, ViewGroup decorView) {
|
||||
// 为视图添加一个全局布局监听器,确保在视图完全加载后再设置动画
|
||||
floatingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
// 移除监听器,避免重复调用
|
||||
floatingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
|
||||
// 确保初始位置在屏幕右侧外部
|
||||
floatingView.setTranslationX(floatingView.getWidth());
|
||||
|
||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
floatingView.getWidth(), 0f);
|
||||
animator1.setDuration(1500); // 延长动画时间到1.5秒
|
||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
animator1.start();
|
||||
|
||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
floatingView.postDelayed(() -> {
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
0f, -floatingView.getWidth());
|
||||
animator2.setDuration(1500); // 延长动画时间到1.5秒
|
||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
animator2.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// 动画结束后移除悬浮窗
|
||||
if (isFloatingViewAdded) {
|
||||
decorView.removeView(floatingView);
|
||||
isFloatingViewAdded = false;
|
||||
}
|
||||
|
||||
// 标记播放结束并处理下一个消息
|
||||
synchronized (queueLock) {
|
||||
isPlaying = false;
|
||||
}
|
||||
processNextMessage();
|
||||
}
|
||||
});
|
||||
animator2.start();
|
||||
}, 3000); // 停留1秒
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void resetAndStartAnimation(View floatingView) {
|
||||
// 重置视图位置并开始动画
|
||||
floatingView.setTranslationX(floatingView.getWidth());
|
||||
|
||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
floatingView.getWidth(), 0f);
|
||||
animator1.setDuration(1500);
|
||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
animator1.start();
|
||||
|
||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
floatingView.postDelayed(() -> {
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
0f, -floatingView.getWidth());
|
||||
animator2.setDuration(1500);
|
||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
animator2.start();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
private void updateFloatingViewData(MqttBean mqttBean) {
|
||||
TextView textView = floatingView.findViewById(R.id.tv_name);
|
||||
TextView textView2 = floatingView.findViewById(R.id.tv_to_name);
|
||||
TextView tv_time = floatingView.findViewById(R.id.tv_num);
|
||||
|
||||
if (mqttBean.getList() != null) {
|
||||
if (mqttBean.getList().getToUserName() != null) {
|
||||
textView2.setText("送给" + mqttBean.getList().getToUserName());
|
||||
} else {
|
||||
textView2.setText("送给");
|
||||
}
|
||||
|
||||
if (mqttBean.getList().getFromUserName() != null) {
|
||||
textView.setText(mqttBean.getList().getFromUserName());
|
||||
} else {
|
||||
textView.setText("");
|
||||
}
|
||||
|
||||
if (mqttBean.getList().getGift_picture() != null) {
|
||||
ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), floatingView.findViewById(R.id.iv_piaoping));
|
||||
}
|
||||
|
||||
if (mqttBean.getList().getNumber() != null) {
|
||||
tv_time.setText("x" + mqttBean.getList().getNumber());
|
||||
} else {
|
||||
tv_time.setText("x1");
|
||||
}
|
||||
} else {
|
||||
textView2.setText("送给");
|
||||
textView.setText("");
|
||||
tv_time.setText("x1");
|
||||
}
|
||||
}
|
||||
|
||||
// private void showFloatingMessage(MqttBean mqttBean) {
|
||||
// ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
|
||||
// View floatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping, null);
|
||||
//
|
||||
// // 设置布局参数,使整个布局显示在屏幕顶部并距离顶部100dp
|
||||
// FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
// FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
// FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
// );
|
||||
// layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100); // 距离顶部100dp
|
||||
// layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL; // 顶部居中
|
||||
// floatingView.setLayoutParams(layoutParams);
|
||||
//
|
||||
// TextView textView = floatingView.findViewById(R.id.tv_name);
|
||||
// TextView textView2 = floatingView.findViewById(R.id.tv_to_name);
|
||||
// TextView tv_time = floatingView.findViewById(R.id.tv_num);
|
||||
//
|
||||
// // 添加对 getList() 返回值的空值检查
|
||||
// if (mqttBean.getList() != null) {
|
||||
// // 检查各个字段是否为 null
|
||||
// if (mqttBean.getList().getToUserName() != null) {
|
||||
// textView2.setText("送给" + mqttBean.getList().getToUserName());
|
||||
// } else {
|
||||
// textView2.setText("送给");
|
||||
// }
|
||||
//
|
||||
// if (mqttBean.getList().getFromUserName() != null) {
|
||||
// textView.setText(mqttBean.getList().getFromUserName());
|
||||
// } else {
|
||||
// textView.setText("");
|
||||
// }
|
||||
//
|
||||
// // 检查礼物图片
|
||||
// if (mqttBean.getList().getGift_picture() != null) {
|
||||
// ImageUtils.loadHeadCC(mqttBean.getList().getGift_picture(), floatingView.findViewById(R.id.iv_piaoping));
|
||||
// }
|
||||
//
|
||||
// // 检查数量
|
||||
// if (mqttBean.getList().getNumber() != null) {
|
||||
// tv_time.setText("x" + mqttBean.getList().getNumber());
|
||||
// } else {
|
||||
// tv_time.setText("x1");
|
||||
// }
|
||||
// } else {
|
||||
// // 如果 getList() 返回 null,设置默认值
|
||||
// textView2.setText("送给");
|
||||
// textView.setText("");
|
||||
// tv_time.setText("x1");
|
||||
// }
|
||||
//
|
||||
// floatingView.setTranslationX(10000); // 先放到屏幕外
|
||||
//
|
||||
// floatingView.post(() -> {
|
||||
// // 确保初始位置在屏幕右侧外部
|
||||
// floatingView.setTranslationX(floatingView.getWidth());
|
||||
//
|
||||
// // 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
// ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
// floatingView.getWidth(), 0f);
|
||||
// animator1.setDuration(1500); // 延长动画时间到1.5秒
|
||||
// animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
// animator1.start();
|
||||
//
|
||||
// // 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
// floatingView.postDelayed(() -> {
|
||||
// ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
// 0f, -floatingView.getWidth());
|
||||
// animator2.setDuration(1500); // 延长动画时间到1.5秒
|
||||
// animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
// animator2.addListener(new AnimatorListenerAdapter() {
|
||||
// @Override
|
||||
// public void onAnimationEnd(Animator animation) {
|
||||
// // 动画结束后移除悬浮窗
|
||||
// decorView.removeView(floatingView);
|
||||
//
|
||||
// // 标记播放结束并处理下一个消息
|
||||
// synchronized (queueLock) {
|
||||
// isPlaying = false;
|
||||
// }
|
||||
// processNextMessage();
|
||||
// }
|
||||
// });
|
||||
// animator2.start();
|
||||
// }, 3000); // 停留1秒
|
||||
// });
|
||||
// decorView.addView(floatingView);
|
||||
// }
|
||||
|
||||
|
||||
// 在类中添加新的成员变量
|
||||
private View xlhFloatingView; // XLH类型的浮动视图
|
||||
private boolean isXlhFloatingViewAdded = false; // 标记XLH浮动视图是否已添加到 decorView
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(XLHBean event) {
|
||||
showPiaoPingMessageXlh(event);
|
||||
}
|
||||
|
||||
private void showPiaoPingMessageXlh(XLHBean event) {
|
||||
// 创建 FloatingX 配置
|
||||
ViewGroup decorView = (ViewGroup) this.getWindow().getDecorView();
|
||||
|
||||
// 如果XLH浮动视图未创建,则创建一次
|
||||
if (xlhFloatingView == null) {
|
||||
xlhFloatingView = LayoutInflater.from(this).inflate(R.layout.item_piaoping_xlh, null);
|
||||
|
||||
// 设置布局参数
|
||||
FrameLayout.LayoutParams layoutParams = new FrameLayout.LayoutParams(
|
||||
FrameLayout.LayoutParams.MATCH_PARENT,
|
||||
FrameLayout.LayoutParams.WRAP_CONTENT
|
||||
);
|
||||
layoutParams.topMargin = com.sunfusheng.marqueeview.DisplayUtil.dip2px(this, 100);
|
||||
layoutParams.gravity = android.view.Gravity.TOP | android.view.Gravity.CENTER_HORIZONTAL;
|
||||
xlhFloatingView.setLayoutParams(layoutParams);
|
||||
|
||||
// 初始化动画监听器
|
||||
setupXlhAnimationListener(xlhFloatingView, decorView);
|
||||
} // 更新视图数据
|
||||
updateXlhFloatingViewData(event);
|
||||
|
||||
// 如果浮动视图未添加到 decorView,则添加
|
||||
if (!isXlhFloatingViewAdded) {
|
||||
decorView.addView(xlhFloatingView);
|
||||
isXlhFloatingViewAdded = true;
|
||||
}
|
||||
|
||||
// 重置视图位置并开始动画
|
||||
resetAndStartXlhAnimation(xlhFloatingView);
|
||||
}
|
||||
private void setupXlhAnimationListener(View floatingView, ViewGroup decorView) {
|
||||
// 为视图添加一个全局布局监听器,确保在视图完全加载后再设置动画
|
||||
floatingView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() {
|
||||
@Override
|
||||
public void onGlobalLayout() {
|
||||
// 移除监听器,避免重复调用
|
||||
floatingView.getViewTreeObserver().removeOnGlobalLayoutListener(this);
|
||||
|
||||
// 确保初始位置在屏幕右侧外部
|
||||
floatingView.setTranslationX(floatingView.getWidth());
|
||||
|
||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
floatingView.getWidth(), 0f);
|
||||
animator1.setDuration(1500); // 延长动画时间到1.5秒
|
||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
animator1.start();
|
||||
|
||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
floatingView.postDelayed(() -> {
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
0f, -floatingView.getWidth());
|
||||
animator2.setDuration(1500); // 延长动画时间到1.5秒
|
||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f)); // 更平缓的减速效果
|
||||
animator2.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// 动画结束后移除悬浮窗
|
||||
if (isXlhFloatingViewAdded) {
|
||||
decorView.removeView(floatingView);
|
||||
isXlhFloatingViewAdded = false;
|
||||
}
|
||||
|
||||
// 标记播放结束并处理下一个消息
|
||||
synchronized (queueLock) {
|
||||
isPlaying = false;
|
||||
}
|
||||
processNextMessage();
|
||||
}
|
||||
});
|
||||
animator2.start();
|
||||
}, 3000); // 停留1秒
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void resetAndStartXlhAnimation(View floatingView) {
|
||||
// 重置视图位置并开始动画
|
||||
floatingView.setTranslationX(floatingView.getWidth());
|
||||
|
||||
// 第一阶段:从右到屏幕右侧边缘(缓慢进入)
|
||||
ObjectAnimator animator1 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
floatingView.getWidth(), 0f);
|
||||
animator1.setDuration(1500);
|
||||
animator1.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
animator1.start();
|
||||
|
||||
// 第二阶段:延迟1秒后从当前位置向左滑出
|
||||
floatingView.postDelayed(() -> {
|
||||
ObjectAnimator animator2 = ObjectAnimator.ofFloat(floatingView, "translationX",
|
||||
0f, -floatingView.getWidth());
|
||||
animator2.setDuration(1500);
|
||||
animator2.setInterpolator(new DecelerateInterpolator(2.0f));
|
||||
animator2.start();
|
||||
}, 3000);
|
||||
}
|
||||
|
||||
private void updateXlhFloatingViewData(XLHBean xlhBean) {
|
||||
TextView textView = xlhFloatingView.findViewById(R.id.tv_name);
|
||||
ImageView xlh_image = xlhFloatingView.findViewById(R.id.im_xlh);
|
||||
|
||||
if (xlhBean!=null){
|
||||
xlh_image.setImageDrawable(xlhBean.getFrom_type() == 1 ? getResources().getDrawable(R.mipmap.xlh_jjks) : getResources().getDrawable(R.mipmap.xlh_zsks));
|
||||
|
||||
textView.setText(xlhBean.getText());
|
||||
|
||||
} else {
|
||||
textView.setText("");
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onEvent(ChatInfo event) {
|
||||
String id = event.getId().replace("g", "");
|
||||
ARouter.getInstance().build(ARouteConstants.H5).withString("url", CommonAppContext.getInstance().getCurrentEnvironment().getH5Url() + "/web/index.html#/pages/union/setGroup?id=" + SpUtil.getToken() + "&guildId=" + id).navigation();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -100,6 +100,16 @@ public class GiftRoomAdapter extends BaseAdapter {
|
||||
}
|
||||
}
|
||||
|
||||
public void updateData(List<RoonGiftModel> newData) {
|
||||
this.mDatas.clear();
|
||||
// 确保新数据都不处于选中状态
|
||||
for (RoonGiftModel model : newData) {
|
||||
model.setChecked(false);
|
||||
}
|
||||
this.mDatas.addAll(newData);
|
||||
}
|
||||
|
||||
|
||||
// private static class MyGestureDetector extends GestureDetector {
|
||||
// private GiftRoomAdapter mAdapter;
|
||||
// private RoonGiftModel mGiftModel;
|
||||
@@ -146,18 +156,6 @@ public class GiftRoomAdapter extends BaseAdapter {
|
||||
viewHolder.item_layout = (ConstraintLayout) convertView.findViewById(R.id.cl_gift);
|
||||
viewHolder.ivDownOn = (ImageView) convertView.findViewById(R.id.iv_down_on);
|
||||
viewHolder.cl_iv_down_on = (ConstraintLayout) convertView.findViewById(R.id.cl_iv_down_on);
|
||||
// viewHolder.tv_gift_num = convertView.findViewById(R.id.tv_gift_num);
|
||||
|
||||
// viewHolder.tv_gift_change_love_values = convertView.findViewById(R.id.tv_gift_change_love_values);
|
||||
// viewHolder.item_layout.setOnTouchListener((v, event) -> {
|
||||
// gestureDetector.setGiftModel(GiftRoomAdapter.this, giftModel);
|
||||
// gestureDetector.onTouchEvent(event);
|
||||
//
|
||||
// return true;
|
||||
// });
|
||||
|
||||
|
||||
|
||||
|
||||
convertView.setTag(viewHolder);
|
||||
} else {
|
||||
|
||||
@@ -41,11 +41,11 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
private int pageSize = 100;//一页显示的礼物个数
|
||||
private int pageCount;//页数
|
||||
private int type;//1:房间点击进入的;2:打赏进入的
|
||||
private List<RoonGiftModel> giftList=new ArrayList<>();
|
||||
private List<GiftPackBean> giftPackList=new ArrayList<>();
|
||||
private List<RoonGiftModel> giftList = new ArrayList<>();
|
||||
private List<GiftPackBean> giftPackList = new ArrayList<>();
|
||||
private String roomId;
|
||||
|
||||
public static GiftTwoDetailsFragment newInstance(String id,int type,String roomId) {
|
||||
public static GiftTwoDetailsFragment newInstance(String id, int type, String roomId) {
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putString("id", id);
|
||||
@@ -64,6 +64,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
roomId = arguments.getString("roomId");
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
@@ -75,14 +76,30 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
return new RewardGiftPresenter(this, getActivity());
|
||||
}
|
||||
|
||||
public void loadDataIfNeeded(String id, int type, String roomId) {
|
||||
if (id.equals("0")) {
|
||||
MvpPre.giftPack();
|
||||
} else {
|
||||
if (type == 0) {
|
||||
MvpPre.getGiftList("0", type, roomId);
|
||||
} else {
|
||||
if (id==null){
|
||||
id="0";
|
||||
}
|
||||
MvpPre.getGiftList(id, type, roomId);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initData() {
|
||||
if (id.equals("0")){
|
||||
if (id.equals("0")) {
|
||||
MvpPre.giftPack();
|
||||
}else {
|
||||
if (type==0) {
|
||||
} else {
|
||||
if (type == 0) {
|
||||
MvpPre.getGiftList("0", type, roomId);
|
||||
}else {
|
||||
} else {
|
||||
MvpPre.getGiftList(id, type, roomId);
|
||||
}
|
||||
|
||||
@@ -121,30 +138,21 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> data,int type) {
|
||||
if (type == 1){
|
||||
giftList=new ArrayList<>();
|
||||
giftList.addAll(data);
|
||||
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
|
||||
for (int j = 0; j < pageCount; j++) {
|
||||
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0");
|
||||
mBinding.rvGift.setAdapter(roomAdapter);
|
||||
}
|
||||
}else {
|
||||
giftList=new ArrayList<>();
|
||||
giftList.addAll(data);
|
||||
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
|
||||
for (int j = 0; j < pageCount; j++) {
|
||||
// mAdapter = new GiftTwoAdapter(getActivity(), data, j, "0");
|
||||
// mBinding.rvGift.setAdapter(mAdapter);
|
||||
roomAdapter = new GiftRoomAdapter(getActivity(), data, j, "0");
|
||||
mBinding.rvGift.setAdapter(roomAdapter);
|
||||
}
|
||||
public void setGiftList(List<RoonGiftModel> data, int type) {
|
||||
giftList = new ArrayList<>();
|
||||
giftList.addAll(data);
|
||||
pageCount = (int) Math.ceil(data.size() * 1.0 / pageSize);
|
||||
|
||||
// 只需要创建一次Adapter并设置,循环设置没有意义
|
||||
if (pageCount > 0) {
|
||||
roomAdapter = new GiftRoomAdapter(getActivity(), data, 0, "0");
|
||||
mBinding.rvGift.setAdapter(roomAdapter);
|
||||
}
|
||||
// EventBus.getDefault().post(new RoomGiftEvent(data));
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void giveGift() {
|
||||
|
||||
@@ -167,7 +175,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
|
||||
@Override
|
||||
public void giftPack(List<GiftPackBean> giftPackBean) {
|
||||
giftPackList=new ArrayList<>();
|
||||
giftPackList = new ArrayList<>();
|
||||
giftPackList.addAll(giftPackBean);
|
||||
pageCount = (int) Math.ceil(giftPackBean.size() * 1.0 / pageSize);
|
||||
for (int j = 0; j < pageCount; j++) {
|
||||
@@ -190,7 +198,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftClicRoomkEvent(RoomGiftClickEvent event) {
|
||||
if (giftList == null){
|
||||
if (giftList == null) {
|
||||
giftList = new ArrayList<>();
|
||||
giftList.add(event.gift);
|
||||
}
|
||||
@@ -200,7 +208,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
RoonGiftModel giftModel = giftList.get(i);
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type, event.gift));
|
||||
giftModel.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
@@ -218,7 +226,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
selGift = giftModel;
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type, event.gift));
|
||||
giftModel.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
@@ -240,7 +248,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
giftPackList = new ArrayList<>();
|
||||
giftPackList.add(event.gift);
|
||||
}
|
||||
if (event.type == 1){
|
||||
if (event.type == 1) {
|
||||
String id = event.gift.getGift_id();
|
||||
for (int i = 0; i < giftPackList.size(); i++) {
|
||||
GiftPackBean giftModel = giftPackList.get(i);
|
||||
@@ -252,7 +260,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
roonGiftModel.setNum(Integer.parseInt(giftModel.getNum()));
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
giftModel.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
@@ -262,7 +270,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
if (event.adapter != null && event.adapter.get() != null) {
|
||||
event.adapter.get().notifyDataSetChanged();
|
||||
}
|
||||
}else {
|
||||
} else {
|
||||
String id = event.gift.getGift_id();
|
||||
GiftPackBean selGift = null;
|
||||
for (int i = 0; i < giftPackList.size(); i++) {
|
||||
@@ -276,12 +284,12 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
selGift = giftModel;
|
||||
if (!giftModel.isChecked()) {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,roonGiftModel));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, roonGiftModel));
|
||||
giftModel.setChecked(true);
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
|
||||
}
|
||||
}
|
||||
if (event.adapter != null && event.adapter.get() != null) {
|
||||
@@ -296,7 +304,7 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftClicRoomkTEvent(RoomGiftClickToEvent event) {
|
||||
if (giftList == null){
|
||||
if (giftList == null) {
|
||||
giftList = new ArrayList<>();
|
||||
giftList.add(event.gift);
|
||||
}
|
||||
@@ -307,10 +315,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
if (giftModel.getGift_id().equals(id)) {
|
||||
if (giftModel.isChecked()) {
|
||||
giftModel.setChecked(false);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
|
||||
}else {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
|
||||
} else {
|
||||
giftModel.setChecked(true);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type,event.gift));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(true, event.type, event.gift));
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
@@ -328,10 +336,10 @@ public class GiftTwoDetailsFragment extends BaseMvpFragment<RewardGiftPresenter,
|
||||
selGift = giftModel;
|
||||
if (giftModel.isChecked()) {
|
||||
giftModel.setChecked(false);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type,null));
|
||||
}else {
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(false, event.type, null));
|
||||
} else {
|
||||
giftModel.setChecked(true);
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type,event.gift));
|
||||
EventBus.getDefault().post(new GiftUserRefreshEvent(giftModel.isCan_send_self(), event.type, event.gift));
|
||||
}
|
||||
} else {
|
||||
giftModel.setChecked(false);
|
||||
|
||||
@@ -130,7 +130,7 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
SpUtil.getInstance().setBooleanValue("youth_model_shown", false);
|
||||
}
|
||||
}
|
||||
piaoPingManager = PiaoPingManager.getInstance(this);
|
||||
// piaoPingManager = PiaoPingManager.getInstance(this);
|
||||
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
|
||||
if (!Settings.canDrawOverlays(this)) {
|
||||
@@ -144,7 +144,7 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
}
|
||||
|
||||
|
||||
private PiaoPingManager piaoPingManager;
|
||||
// private PiaoPingManager piaoPingManager;
|
||||
|
||||
private void initARouter() {
|
||||
if (true) {
|
||||
@@ -243,9 +243,9 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
// 确保在主线程中订阅
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (piaoPingManager != null) {
|
||||
piaoPingManager.subscribe();
|
||||
}
|
||||
// if (piaoPingManager != null) {
|
||||
// piaoPingManager.subscribe();
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -273,9 +273,9 @@ public class CommonAppContext extends MultiDexApplication {
|
||||
AppLifecycleUtil.onAppBackGround();
|
||||
if (activity != null && !activity.isFinishing()) {
|
||||
activity.runOnUiThread(() -> {
|
||||
if (piaoPingManager != null) {
|
||||
piaoPingManager.unsubscribe();
|
||||
}
|
||||
// if (piaoPingManager != null) {
|
||||
// piaoPingManager.unsubscribe();
|
||||
// }
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -405,9 +405,14 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
playQueue.add(new PlayItem(url, type2));
|
||||
Logger.d("AvatarFrameView", "Added to queue, queue size: " + playQueue.size() + ", url: " + url);
|
||||
|
||||
// 如果当前没有在播放,则开始播放
|
||||
if (!isPlaying || !isActuallyPlaying()) {
|
||||
if (type2==3){
|
||||
playNextFromQueue();
|
||||
}else {
|
||||
|
||||
// 如果当前没有在播放,则开始播放
|
||||
if (!isPlaying || !isActuallyPlaying()) {
|
||||
playNextFromQueue();
|
||||
}
|
||||
}
|
||||
|
||||
// 异步处理URL解析等耗时操作
|
||||
@@ -765,7 +770,7 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
});
|
||||
// 设置循环次数
|
||||
if (mType == 1) {
|
||||
if (mType == 1|| mType == 3) {
|
||||
svgaSurface.setLoops(0); // 无限循环
|
||||
} else {
|
||||
svgaSurface.setLoops(1); // 播放一次
|
||||
@@ -817,6 +822,12 @@ public class AvatarFrameView extends FrameLayout implements IAnimListener {
|
||||
}
|
||||
}
|
||||
});
|
||||
// 设置循环次数
|
||||
if (mType == 1|| mType == 3) {
|
||||
svgaSurface.setLoops(0); // 无限循环
|
||||
} else {
|
||||
svgaSurface.setLoops(1); // 播放一次
|
||||
}
|
||||
svgaSurface.startAnimation();
|
||||
} catch (Exception e) {
|
||||
LogUtils.e(TAG, "Error playing cached SVGA: " + e.getMessage());
|
||||
|
||||
@@ -70,7 +70,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
public String pitNumber;
|
||||
public int pitImageVId;
|
||||
|
||||
// public ImageView iv_on_line;
|
||||
public ImageView iv_on_line;
|
||||
private boolean showGiftAnim = true;//显示麦位动画
|
||||
private ImageView iv_tag_type;
|
||||
|
||||
@@ -99,7 +99,7 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
tvTime = findViewById(R.id.tv_time);
|
||||
tv_time_pk = findViewById(R.id.tv_time_pk);
|
||||
mTvNo = findViewById(R.id.tv_no);
|
||||
// iv_on_line = findViewById(R.id.iv_online);
|
||||
iv_on_line = findViewById(R.id.iv_online);/**/
|
||||
iv_tag_type = findViewById(R.id.iv_tag_type);
|
||||
tv_zhul=findViewById(R.id.tv_zhul);
|
||||
setClipChildren(false);
|
||||
@@ -272,20 +272,20 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
public void userJoined(int userId, int elapsd) {
|
||||
if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
if (pitBean.getUser_id().equals(userId + "")) {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void userOffline(int userId, int reason) {
|
||||
if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
if (pitBean.getUser_id().equals(userId + "")) {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
}else if (pitBean.getUser_id()==null || pitBean.getUser_id().equals("0") || pitBean.getUser_id().equals("")){
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
}
|
||||
// if (pitBean != null && pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0")) {
|
||||
// if (pitBean.getUser_id().equals(userId + "")) {
|
||||
//// iv_on_line.setVisibility(VISIBLE);
|
||||
// }
|
||||
// }else if (pitBean.getUser_id()==null || pitBean.getUser_id().equals("0") || pitBean.getUser_id().equals("")){
|
||||
//// iv_on_line.setVisibility(GONE);
|
||||
// }
|
||||
}
|
||||
|
||||
});
|
||||
@@ -346,9 +346,9 @@ public abstract class BaseWheatView extends ConstraintLayout implements IBaseWhe
|
||||
if (pitBean.getUser_id() != null && !pitBean.getUser_id().equals("0") && !pitBean.getUser_id().isEmpty()) {
|
||||
if (pitBean.getUser_id().equals(isOnline.getUser_id())) {
|
||||
if (isOnline.getIs_online() == 1) {
|
||||
// iv_on_line.setVisibility(GONE);
|
||||
iv_on_line.setVisibility(GONE);
|
||||
} else {
|
||||
// iv_on_line.setVisibility(VISIBLE);
|
||||
iv_on_line.setVisibility(VISIBLE);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,7 +173,7 @@ public class PiaoPingManager {
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
// 动画结束后移除悬浮窗
|
||||
FloatingX.uninstallAll();
|
||||
// windowManager.removeView(floatingView);
|
||||
windowManager.removeView(floatingView);
|
||||
// 处理下一个消息
|
||||
processNextMessage();
|
||||
}
|
||||
@@ -212,7 +212,7 @@ public class PiaoPingManager {
|
||||
XLHisAnimating = false;
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
// @Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onMessageReceived(MqttBean mqttBean) {
|
||||
showPiaoPingMessage(mqttBean);
|
||||
ToastUtils.show("飘屏");
|
||||
|
||||
@@ -69,7 +69,7 @@ public class RoomDefaultWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(pitBean.getDress(), 1);
|
||||
mIvFrame.setSource(pitBean.getDress(), 3);
|
||||
// ImageUtils.loadDecorationAvatar(pitBean.getDress_picture(), mIvFrame);
|
||||
}
|
||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||
|
||||
@@ -84,10 +84,11 @@ public class RoomFriendshipWheatView extends BaseWheatView {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadCenterCrop(bean.getAvatar(), mRiv);
|
||||
if (TextUtils.isEmpty(pitBean.getDress_picture())) {
|
||||
if (TextUtils.isEmpty(pitBean.getDress())) {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(pitBean.getDress(), 3);
|
||||
}
|
||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||
mIvTagBoss.setVisibility(GONE);
|
||||
|
||||
@@ -65,7 +65,7 @@ public class RoomKtvWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(pitBean.getDress(), 1);
|
||||
mIvFrame.setSource(pitBean.getDress(), 3);
|
||||
// ImageUtils.loadDecorationAvatar(pitBean.getDress_picture(), mIvFrame);
|
||||
}
|
||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||
|
||||
@@ -72,10 +72,11 @@ public class RoomMakeWheatView extends BaseWheatView {
|
||||
mIvRipple.setVisibility(VISIBLE);
|
||||
mTvName.setText(bean.getNickname());
|
||||
ImageUtils.loadHeadCC(bean.getAvatar(), mRiv);
|
||||
if (TextUtils.isEmpty(pitBean.getDress_picture())) {
|
||||
if (TextUtils.isEmpty(pitBean.getDress())) {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(pitBean.getDress(), 3);
|
||||
}
|
||||
if (showBoss && WHEAT_BOSS.equals(pitNumber)) {
|
||||
mIvTagBoss.setVisibility(GONE);
|
||||
|
||||
@@ -87,7 +87,7 @@ public class RoomSingSongWheatView extends BaseWheatView {
|
||||
mIvFrame.setVisibility(INVISIBLE);
|
||||
} else {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(bean.getDress(), 1);
|
||||
mIvFrame.setSource(bean.getDress(), 3);
|
||||
}
|
||||
|
||||
if (showBoss && TextUtils.equals(WHEAT_BOSS, pitNumber)) {
|
||||
|
||||
@@ -124,7 +124,7 @@ public class RoomSingWheatView extends LinearLayout {
|
||||
} else {
|
||||
if (mIvFrame != null) {
|
||||
mIvFrame.setVisibility(VISIBLE);
|
||||
mIvFrame.setSource(pitBean.getDress(), 1);
|
||||
mIvFrame.setSource(pitBean.getDress(), 3);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
|
||||
@@ -243,7 +243,7 @@ public class DynamicDetailActivity extends BaseMvpActivity<CirclePresenter, Acti
|
||||
|
||||
@Override
|
||||
public void setLikeZone() {
|
||||
MvpPre.topicId(zone_id, 2);
|
||||
// MvpPre.topicId(zone_id, 2);
|
||||
finish();
|
||||
}
|
||||
|
||||
|
||||
@@ -2,26 +2,37 @@ package com.example.moduleroom.dialog;
|
||||
|
||||
import android.app.Dialog;
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.util.Log;
|
||||
import android.util.TypedValue;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.Window;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentStatePagerAdapter;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
import androidx.recyclerview.widget.LinearLayoutManager;
|
||||
import androidx.viewpager.widget.ViewPager;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.example.moduleroom.R;
|
||||
import com.example.moduleroom.adapter.GiftUserAdapter;
|
||||
import com.example.moduleroom.databinding.RoomGiftDialogBinding;
|
||||
import com.example.moduletablayout.listener.OnTabSelectListener;
|
||||
import com.google.android.material.tabs.TabLayout;
|
||||
import com.google.android.material.tabs.TabLayoutMediator;
|
||||
import com.hjq.toast.ToastUtils;
|
||||
import com.xscm.moduleutil.adapter.GiftTwoDetailsFragment;
|
||||
import com.xscm.moduleutil.base.BaseMvpDialogFragment;
|
||||
@@ -29,6 +40,7 @@ import com.xscm.moduleutil.bean.GiftLabelBean;
|
||||
import com.xscm.moduleutil.bean.GiftNumBean;
|
||||
import com.xscm.moduleutil.bean.GiftPackBean;
|
||||
import com.xscm.moduleutil.bean.RewardUserBean;
|
||||
import com.xscm.moduleutil.bean.RoomTypeModel;
|
||||
import com.xscm.moduleutil.bean.RoonGiftModel;
|
||||
import com.xscm.moduleutil.bean.UserInfo;
|
||||
import com.xscm.moduleutil.bean.WalletBean;
|
||||
@@ -166,16 +178,6 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
} else {
|
||||
|
||||
rewardUserBeanList = getSortedRewardUserList(roomInfoResp.getRoom_info().getPit_list(), "9", "10");
|
||||
// for (int i = 0; i < roomInfoResp.getRoom_info().getPit_list().size(); i++) {
|
||||
// if (!(SpUtil.getUserId() + "").equals(roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id()) && !roomInfoResp.getRoom_info().getPit_list().get(i).getPit_number().equals("0") && !roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id().equals("0")) {
|
||||
// RewardUserBean rewardUserBean = new RewardUserBean();
|
||||
// rewardUserBean.setUser_id(roomInfoResp.getRoom_info().getPit_list().get(i).getUser_id());
|
||||
// rewardUserBean.setNickname(roomInfoResp.getRoom_info().getPit_list().get(i).getNickname());
|
||||
// rewardUserBean.setAvatar(roomInfoResp.getRoom_info().getPit_list().get(i).getAvatar());
|
||||
// rewardUserBean.setPit_number(roomInfoResp.getRoom_info().getPit_list().get(i).getPit_number());
|
||||
// rewardUserBeanList.add(rewardUserBean);
|
||||
// }
|
||||
// }
|
||||
}
|
||||
mBinding.rvGiftUser.setLayoutManager(new LinearLayoutManager(getContext(), LinearLayoutManager.HORIZONTAL, false));
|
||||
gifyuseradapter = new GiftUserAdapter();
|
||||
@@ -332,7 +334,11 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
giftNumber = mGiftNumList.get(i).getNumber();
|
||||
}
|
||||
}
|
||||
giveGift(giftNumber);
|
||||
if (packType==1) {
|
||||
giveGift(giftNumber);
|
||||
}else {
|
||||
giveGift(giftNumber);
|
||||
}
|
||||
} else if (view1.getId() == R.id.cz) {
|
||||
RechargeDialogFragment.show(roomId, null, getActivity().getSupportFragmentManager());
|
||||
} else if (view1.getId() == R.id.tv_all_wheat) {//全麦
|
||||
@@ -352,10 +358,13 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
private String giftNumber = "";
|
||||
private RoomGiftGiveEvent roomGiftGiveEvent;
|
||||
|
||||
int packType;
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
public void onGiftDoubleClickEvent(GiftDoubleClickEvent event) {
|
||||
getSelectedGift();
|
||||
giveGift("1");
|
||||
packType=1;
|
||||
|
||||
}
|
||||
|
||||
@Subscribe(threadMode = ThreadMode.MAIN)
|
||||
@@ -455,26 +464,26 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
int currentItem = mBinding.viewPager.getCurrentItem();
|
||||
String userId = gifyuseradapter.getUserIdToString();
|
||||
String pit = gifyuseradapter.getUserPitToString();
|
||||
if (currentItem < 1) {
|
||||
if (giftModel == null) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
}
|
||||
int count = gifyuseradapter.getSelectCount();
|
||||
if (count <= 0) {
|
||||
ToastUtils.show("请选择打赏对象");
|
||||
return;
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(num)) {
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
if (Integer.valueOf(num) <= 0) {
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
// if (currentItem < 1) {
|
||||
// if (giftModel == null) {
|
||||
// ToastUtils.show("请选择礼物");
|
||||
// return;
|
||||
// }
|
||||
// int count = gifyuseradapter.getSelectCount();
|
||||
// if (count <= 0) {
|
||||
// ToastUtils.show("请选择打赏对象");
|
||||
// return;
|
||||
// }
|
||||
//
|
||||
// if (TextUtils.isEmpty(num)) {
|
||||
// ToastUtils.show("请选择打赏礼物数量");
|
||||
// return;
|
||||
// }
|
||||
// if (Integer.valueOf(num) <= 0) {
|
||||
// ToastUtils.show("请选择打赏礼物数量");
|
||||
// return;
|
||||
// }
|
||||
// } else {
|
||||
if (roonGiftModel == null) {
|
||||
ToastUtils.show("请选择礼物");
|
||||
return;
|
||||
@@ -493,7 +502,7 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
ToastUtils.show("请选择打赏礼物数量");
|
||||
return;
|
||||
}
|
||||
}
|
||||
// }
|
||||
if (roonGiftModel != null && roonGiftModel.getGift_id() != null) {
|
||||
if (currentItem != 0) {
|
||||
//礼物打赏
|
||||
@@ -561,9 +570,11 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
mBinding.rvGiftUser.setVisibility(View.INVISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
private List<GiftLabelBean> giftLabelBeanList;
|
||||
@Override
|
||||
public void getGiftLabel(List<GiftLabelBean> giftLabelBeans) {
|
||||
giftLabelBeanList=new ArrayList<>();
|
||||
giftLabelBeanList.addAll(giftLabelBeans);
|
||||
GiftLabelBean giftLabelBean = new GiftLabelBean();
|
||||
giftLabelBean.setId("0");
|
||||
giftLabelBean.setName("背包");
|
||||
@@ -572,8 +583,25 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
mBinding.viewPager.setOffscreenPageLimit(0);
|
||||
mBinding.slidingTabLayout.setViewPager(mBinding.viewPager);
|
||||
mBinding.slidingTabLayout.setCurrentTab(1);
|
||||
}
|
||||
|
||||
|
||||
// // 在 initView() 方法中添加
|
||||
// mBinding.viewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
|
||||
// @Override
|
||||
// public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPageSelected(int position) {
|
||||
// // 页面切换时更新选中状态
|
||||
// updateGiftSelection(position);
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onPageScrollStateChanged(int state) {
|
||||
// }
|
||||
// });
|
||||
}
|
||||
@Override
|
||||
public void setGiftList(List<RoonGiftModel> roonGiftModels, int type) {
|
||||
|
||||
@@ -627,16 +655,38 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
|
||||
public MyFragmentPagerAdapter(FragmentManager fm, List<GiftLabelBean> list, List<Fragment> fragmentList, String roomId) {
|
||||
super(fm);
|
||||
this.list = list;
|
||||
this.fragmentList = fragmentList;
|
||||
this.roomId = roomId;
|
||||
this.list = list != null ? list : new ArrayList<>();
|
||||
// 不直接使用传入的 fragmentList,而是创建一个新的列表
|
||||
this.fragmentList = new ArrayList<>();
|
||||
// 初始化 fragmentList 的大小,用 null 填充
|
||||
for (int i = 0; i < this.list.size(); i++) {
|
||||
this.fragmentList.add(null);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
// 边界检查
|
||||
if (position < 0 || list == null || position >= list.size()) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 检查该位置是否已经有 Fragment 实例
|
||||
if (position < fragmentList.size() && fragmentList.get(position) != null) {
|
||||
return fragmentList.get(position);
|
||||
}
|
||||
|
||||
// 创建新的 Fragment
|
||||
GiftLabelBean model = list.get(position);
|
||||
Fragment fragment = GiftTwoDetailsFragment.newInstance(model.getId(), 1, roomId);
|
||||
fragmentList.add(fragment); // 保存 Fragment 实例
|
||||
|
||||
// 确保 fragmentList 有足够的空间
|
||||
while (fragmentList.size() <= position) {
|
||||
fragmentList.add(null);
|
||||
}
|
||||
|
||||
// 在指定位置设置 Fragment 实例
|
||||
fragmentList.set(position, fragment);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@@ -648,6 +698,9 @@ public class RoomGiftDialogFragment extends BaseMvpDialogFragment<RewardGiftPres
|
||||
@Nullable
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
if (list == null || position < 0 || position >= list.size()) {
|
||||
return null;
|
||||
}
|
||||
GiftLabelBean model = list.get(position);
|
||||
return model.getName();
|
||||
}
|
||||
|
||||
@@ -1258,7 +1258,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
pitBean.setNickname(messageEvent.getText().getFromUserInfo().getNickname());
|
||||
pitBean.setSex(messageEvent.getText().getFromUserInfo().getSex() + "");
|
||||
pitBean.setCharm(messageEvent.getText().getFromUserInfo().getCharm());
|
||||
|
||||
pitBean.setDress(messageEvent.getText().getFromUserInfo().getDress());
|
||||
return pitBean;
|
||||
}
|
||||
|
||||
@@ -1272,6 +1272,7 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
pitBean.setSex("");
|
||||
pitBean.setCharm("");
|
||||
pitBean.setIs_pm(1);
|
||||
pitBean.setDress("");
|
||||
return pitBean;
|
||||
}
|
||||
|
||||
|
||||
@@ -276,7 +276,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
mRoomInfoResp = resp;
|
||||
loadSubFragment();
|
||||
// 更新子Fragment视图
|
||||
// updateChildFragmentViews();
|
||||
updateChildFragmentViews();
|
||||
}
|
||||
|
||||
private <T extends Fragment> T findFragmentByTag(Class<T> fragmentClass) {
|
||||
|
||||
Reference in New Issue
Block a user