优化头像框加载、麦圈加载,二卡八放到对应fragment加载。
This commit is contained in:
@@ -96,9 +96,7 @@ open class Application : CommonAppContext() {
|
||||
configureLeakCanary()
|
||||
|
||||
|
||||
// 初始化并预绘制视图 二卡八列
|
||||
WheatLayoutSingManager.init(this)
|
||||
WheatLayoutSingManager.getInstance().setWheatData(null)
|
||||
|
||||
|
||||
// 默认情况下,SVGA 内部不会输出任何 log,所以需要手动设置为 true
|
||||
SVGALogger.setLogEnabled(false)
|
||||
|
||||
@@ -484,26 +484,30 @@ public class RoomAuctionFragment extends BaseMvpFragment<RoomAuctionPresenterTow
|
||||
|
||||
|
||||
private void getTextView() {
|
||||
int defaultColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_0DFFB9); // 亲密拍默认颜色(绿色)
|
||||
int selectedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white); // 选中颜色(白色)
|
||||
int clickedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_BB8BE2); // 真爱拍选中颜色(蓝色)
|
||||
float defaultSize = 16f; // 默认字体大小
|
||||
float selectedSize = 24f; // 选中字体大小
|
||||
mBinding.zhenai.setText("真爱拍");
|
||||
mBinding.qinmi.setText("亲密拍");
|
||||
// 根据type设置初始状态
|
||||
if (type == 1) {
|
||||
// type=1 真爱拍模式
|
||||
mBinding.zhenai.setTextColor(clickedColor); // 真爱拍蓝色
|
||||
mBinding.zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 真爱拍24号字体
|
||||
mBinding.qinmi.setTextColor(selectedColor); // 亲密拍白色
|
||||
mBinding.qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 亲密拍16号字体
|
||||
} else {
|
||||
// type=2 亲密拍模式
|
||||
mBinding.qinmi.setTextColor(defaultColor); // 亲密拍绿色
|
||||
mBinding.qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 亲密拍24号字体
|
||||
mBinding.zhenai.setTextColor(selectedColor); // 真爱拍白色
|
||||
mBinding.zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 真爱拍16号字体
|
||||
try {
|
||||
int defaultColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_0DFFB9); // 亲密拍默认颜色(绿色)
|
||||
int selectedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_white); // 选中颜色(白色)
|
||||
int clickedColor = ContextCompat.getColor(requireContext(), com.xscm.moduleutil.R.color.color_BB8BE2); // 真爱拍选中颜色(蓝色)
|
||||
float defaultSize = 16f; // 默认字体大小
|
||||
float selectedSize = 24f; // 选中字体大小
|
||||
mBinding.zhenai.setText("真爱拍");
|
||||
mBinding.qinmi.setText("亲密拍");
|
||||
// 根据type设置初始状态
|
||||
if (type == 1) {
|
||||
// type=1 真爱拍模式
|
||||
mBinding.zhenai.setTextColor(clickedColor); // 真爱拍蓝色
|
||||
mBinding.zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 真爱拍24号字体
|
||||
mBinding.qinmi.setTextColor(selectedColor); // 亲密拍白色
|
||||
mBinding.qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 亲密拍16号字体
|
||||
} else {
|
||||
// type=2 亲密拍模式
|
||||
mBinding.qinmi.setTextColor(defaultColor); // 亲密拍绿色
|
||||
mBinding.qinmi.setTextSize(TypedValue.COMPLEX_UNIT_SP, selectedSize); // 亲密拍24号字体
|
||||
mBinding.zhenai.setTextColor(selectedColor); // 真爱拍白色
|
||||
mBinding.zhenai.setTextSize(TypedValue.COMPLEX_UNIT_SP, defaultSize); // 真爱拍16号字体
|
||||
}
|
||||
}catch (Exception e){
|
||||
LogUtils.e("getTextView",e.getMessage());
|
||||
}
|
||||
mBinding.zhenai.setOnClickListener(v -> {
|
||||
if (wheatView.getUserId().equals(SpUtil.getUserId() + "")) {
|
||||
|
||||
@@ -449,7 +449,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
|
||||
if (newFragment != null) {
|
||||
// switchFragment(newFragment, mBinding.roomItem.getId(), false);
|
||||
performFragmentReplacement(newFragment);
|
||||
performFragmentReplacementReplace(newFragment);
|
||||
} else {
|
||||
LogUtils.e("newFragment==null");
|
||||
}
|
||||
@@ -474,6 +474,47 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
}
|
||||
|
||||
private Fragment currentFragment = null;
|
||||
@SuppressLint("CheckResult")
|
||||
private void performFragmentReplacementReplace(Fragment newFragment) {
|
||||
if (getActivity() != null && getActivity() instanceof RoomActivity) {
|
||||
if (newFragment instanceof RoomKtvFragment) {
|
||||
Objects.requireNonNull(((RoomActivity) getActivity()).getBinding()).recyclerView.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
Objects.requireNonNull(((RoomActivity) getActivity()).getBinding()).recyclerView.setVisibility(View.GONE);
|
||||
}
|
||||
}
|
||||
|
||||
if (getChildFragmentManager().isDestroyed()) {
|
||||
return; // 避免状态销毁后操作导致崩溃
|
||||
}
|
||||
|
||||
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
|
||||
|
||||
// 动画(可选,不想动画可以删掉)
|
||||
transaction.setCustomAnimations(
|
||||
com.xscm.moduleutil.R.anim.a_slide_right_in,
|
||||
com.xscm.moduleutil.R.anim.a_slide_left_out
|
||||
);
|
||||
|
||||
// 使用 replace 替换当前 fragment
|
||||
transaction.replace(mBinding.roomItem.getId(), newFragment, newFragment.getClass().getSimpleName());
|
||||
|
||||
// 如果需要保留回退栈可用 addToBackStack
|
||||
// transaction.addToBackStack(newFragment.getClass().getSimpleName());
|
||||
|
||||
transaction.commitAllowingStateLoss();
|
||||
|
||||
// 更新当前 fragment 引用
|
||||
currentFragment = newFragment;
|
||||
|
||||
// 延迟启动透明 Activity(保持原逻辑)
|
||||
Observable.timer(1000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(aLong -> {
|
||||
if (ActivityUtils.getTopActivity() instanceof RoomActivity)
|
||||
startActivity(new Intent(ActivityUtils.getTopActivity(), TransparentActivity.class));
|
||||
});
|
||||
}
|
||||
|
||||
@SuppressLint("CheckResult")
|
||||
private void performFragmentReplacement(Fragment newFragment) {
|
||||
@@ -730,7 +771,6 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
|
||||
}
|
||||
|
||||
if (getActivity() instanceof RoomActivity) {
|
||||
RoomActivity roomActivity = (RoomActivity) getActivity();
|
||||
if (!haveMe) {
|
||||
AgoraManager.getInstance().ClientRole(false);
|
||||
AgoraManager.getInstance().setLocalAudioEnabled(false, SpUtil.getUserId() + "");
|
||||
|
||||
@@ -94,13 +94,10 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
protected String pitNumber;//当前点击的麦序
|
||||
protected CommonDialog commonDialog;
|
||||
// private WheatLayoutManager wheatLayoutManager;
|
||||
private final WheatLayoutSingManager wheatLayoutSingManager = WheatLayoutSingManager.Companion.getInstance();
|
||||
private WheatLayoutSingManager wheatLayoutSingManager = null;
|
||||
private WheatLayoutManager wheatLayoutManager1;
|
||||
private WheatLayoutManager wheatLayoutManager2;
|
||||
|
||||
|
||||
private RoomPitBean roomPitBean;
|
||||
|
||||
private PopupWindow popupWindow;
|
||||
CountDownTimer mCountDownTimer;
|
||||
CountDownTimer mCountDownTimersta;
|
||||
@@ -148,6 +145,11 @@ public class SingSongFragment extends BaseRoomFragment<SingSongPresenter, Fragme
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
// initPopupWindow(); 2025年12月24日11:18:58,去掉弹框,直接进行抱麦
|
||||
|
||||
// 初始化并预绘制视图 二卡八列
|
||||
WheatLayoutSingManager.Companion.init(getActivity());
|
||||
WheatLayoutSingManager.Companion.getInstance().setWheatData(null);
|
||||
wheatLayoutSingManager = WheatLayoutSingManager.Companion.getInstance();
|
||||
flexboxLayout = mBinding.flexboxLayout;
|
||||
var wheatContainer = WheatLayoutSingManager.Companion.getInstance().getRootContainer();
|
||||
flexboxLayout.addView(wheatContainer);
|
||||
|
||||
Reference in New Issue
Block a user