fix bugs.11
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user