Fix refresh top scene

This commit is contained in:
NekoInverter committed 2020-12-28 17:13:10 +08:00
1 parent 0f569cf415
commit 4544ece624
1 file changed
+11 -5
@@ -17,6 +17,7 @@
package com.hippo.scene;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
@@ -556,11 +557,16 @@ public abstract class StageActivity extends EhActivity {
FragmentManager fragmentManager = getSupportFragmentManager();
Fragment fragment = fragmentManager.findFragmentByTag(tag);
FragmentTransaction transaction = fragmentManager.beginTransaction();
transaction.detach(fragment);
transaction.attach(fragment);
transaction.commitAllowingStateLoss();
onTransactScene();
if (fragment == null) {
return;
}
if(Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
fragmentManager.beginTransaction().detach(fragment).commitAllowingStateLoss();
fragmentManager.beginTransaction().attach(fragment).commitAllowingStateLoss();
}else{
fragmentManager.beginTransaction().detach(fragment).attach(fragment).commitAllowingStateLoss();
}
}
@Override