fix bugs.11

This commit is contained in:
2025-12-06 11:20:19 +08:00
parent 87b73e7ca2
commit 335147f962
2 changed files with 10 additions and 25 deletions

View File

@@ -6,6 +6,7 @@ import android.os.CountDownTimer;
import android.text.Spannable;
import android.text.SpannableStringBuilder;
import android.text.style.ForegroundColorSpan;
import android.util.Log;
import android.view.View;
import androidx.annotation.NonNull;
@@ -435,11 +436,11 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
}
if (newFragment != null) {
if (currentFragment == null){
performFragmentReplacement(newFragment, R.id.container);
}else {
// if (currentFragment == null){
// performFragmentReplacement(newFragment, R.id.container);
// }else {
switchFragment(newFragment, R.id.container);
}
// }
} else {
LogUtils.e("newFragment==null");
}
@@ -468,6 +469,7 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
ft.add(containerId, newFragment, newFragment.getClass().getSimpleName());
} else if (newFragment.getView() == null) {
ft.attach(newFragment); // 确保 view 被创建
LogUtils.e("switchFragment attach");
}
// 2. 显示新 Fragment
@@ -483,12 +485,6 @@ public class RoomFragment extends BaseMvpFragment<RoomPresenter, FragmentRoomBin
currentFragment = newFragment;
}
// RoomFragment.java
/**
* 安全替换子 Fragment
*/