fix
This commit is contained in:
parent
80cff6c269
commit
988b177011
|
@ -16,7 +16,6 @@ import androidx.core.view.forEach
|
||||||
import androidx.databinding.DataBindingUtil
|
import androidx.databinding.DataBindingUtil
|
||||||
import com.mio.util.AnimUtil
|
import com.mio.util.AnimUtil
|
||||||
import com.mio.util.AnimUtil.Companion.interpolator
|
import com.mio.util.AnimUtil.Companion.interpolator
|
||||||
import com.mio.util.AnimUtil.Companion.startAfter
|
|
||||||
import com.tungsten.fcl.R
|
import com.tungsten.fcl.R
|
||||||
import com.tungsten.fcl.databinding.ActivityMainBinding
|
import com.tungsten.fcl.databinding.ActivityMainBinding
|
||||||
import com.tungsten.fcl.game.JarExecutorHelper
|
import com.tungsten.fcl.game.JarExecutorHelper
|
||||||
|
@ -265,7 +264,7 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
manage -> {
|
manage -> {
|
||||||
val version = Profiles.getSelectedVersion()
|
val version = Profiles.getSelectedProfile().selectedVersion
|
||||||
if (version == null) {
|
if (version == null) {
|
||||||
refreshMenuView(null)
|
refreshMenuView(null)
|
||||||
title.setTextWithAnim(getString(R.string.version))
|
title.setTextWithAnim(getString(R.string.version))
|
||||||
|
@ -472,13 +471,13 @@ class MainActivity : FCLActivity(), OnSelectListener, View.OnClickListener {
|
||||||
bind.apply {
|
bind.apply {
|
||||||
AnimUtil.playTranslationX(
|
AnimUtil.playTranslationX(
|
||||||
leftMenu,
|
leftMenu,
|
||||||
ThemeEngine.getInstance().getTheme().animationSpeed * 30L,
|
ThemeEngine.getInstance().getTheme().animationSpeed * 200L,
|
||||||
-100f,
|
-100f,
|
||||||
0f
|
0f
|
||||||
).interpolator(BounceInterpolator()).start()
|
).interpolator(BounceInterpolator()).start()
|
||||||
AnimUtil.playTranslationX(
|
AnimUtil.playTranslationX(
|
||||||
rightMenu,
|
rightMenu,
|
||||||
ThemeEngine.getInstance().getTheme().animationSpeed * 30L,
|
ThemeEngine.getInstance().getTheme().animationSpeed * 200L,
|
||||||
100f,
|
100f,
|
||||||
0f
|
0f
|
||||||
).interpolator(BounceInterpolator()).start()
|
).interpolator(BounceInterpolator()).start()
|
||||||
|
|
|
@ -102,8 +102,9 @@ public class Controllers {
|
||||||
|
|
||||||
initialized = true;
|
initialized = true;
|
||||||
CALLBACKS.forEach(callback -> {
|
CALLBACKS.forEach(callback -> {
|
||||||
Schedulers.androidUIThread().execute(callback::run);
|
Schedulers.androidUIThread().execute(callback);
|
||||||
});
|
});
|
||||||
|
CALLBACKS.clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ArrayList<Controller> getControllersFromDisk() {
|
private static ArrayList<Controller> getControllersFromDisk() {
|
||||||
|
|
|
@ -359,14 +359,15 @@ public final class VersionSetting implements Cloneable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void checkController() {
|
public void checkController() {
|
||||||
Controllers.checkControllers();
|
Controllers.addCallback(() -> {
|
||||||
|
Controllers.checkControllers();
|
||||||
|
Controller controller = Controllers.getControllers().stream()
|
||||||
|
.filter(it -> it.getName().equals(getController()))
|
||||||
|
.findFirst()
|
||||||
|
.orElse(Controllers.getControllers().get(0));
|
||||||
|
|
||||||
Controller controller = Controllers.getControllers().stream()
|
setController(controller.getName());
|
||||||
.filter(it -> it.getName().equals(getController()))
|
});
|
||||||
.findFirst()
|
|
||||||
.orElse(Controllers.getControllers().get(0));
|
|
||||||
|
|
||||||
setController(controller.getName());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addPropertyChangedListener(InvalidationListener listener) {
|
public void addPropertyChangedListener(InvalidationListener listener) {
|
||||||
|
|
|
@ -47,31 +47,28 @@ public class ManageUI extends FCLMultiPageUI implements TabLayout.OnTabSelectedL
|
||||||
container = findViewById(R.id.container);
|
container = findViewById(R.id.container);
|
||||||
|
|
||||||
tabLayout.addOnTabSelectedListener(this);
|
tabLayout.addOnTabSelectedListener(this);
|
||||||
container.post(this::initPages);
|
initPages();
|
||||||
|
|
||||||
listenerHolder.add(EventBus.EVENT_BUS.channel(RefreshedVersionsEvent.class).registerWeak(event -> checkSelectedVersion(), EventPriority.HIGHEST));
|
listenerHolder.add(EventBus.EVENT_BUS.channel(RefreshedVersionsEvent.class).registerWeak(event -> checkSelectedVersion(), EventPriority.HIGHEST));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onStart() {
|
public void onStart() {
|
||||||
super.onStart();
|
super.onStart();
|
||||||
// If we jumped to game list page and deleted this version
|
addLoadingCallback(()->{
|
||||||
// and back to this page, we should return to main page.
|
// If we jumped to game list page and deleted this version
|
||||||
if (!getProfile().getRepository().isLoaded() ||
|
// and back to this page, we should return to main page.
|
||||||
!getProfile().getRepository().hasVersion(getVersion())) {
|
if (!getProfile().getRepository().isLoaded() ||
|
||||||
Schedulers.androidUIThread().execute(() -> {
|
!getProfile().getRepository().hasVersion(getVersion())) {
|
||||||
if (isShowing()) {
|
Schedulers.androidUIThread().execute(() -> {
|
||||||
MainActivity.getInstance().refreshMenuView(null);
|
if (isShowing()) {
|
||||||
MainActivity.getInstance().bind.home.setSelected(true);
|
MainActivity.getInstance().refreshMenuView(null);
|
||||||
}
|
MainActivity.getInstance().bind.home.setSelected(true);
|
||||||
});
|
}
|
||||||
return;
|
});
|
||||||
}
|
return;
|
||||||
|
}
|
||||||
if (pageManager == null) {
|
loadVersion(getVersion(), getProfile());
|
||||||
pageManager = new ManagePageManager(getContext(), container, ManagePageManager.PAGE_ID_MANAGE_MANAGE, null);
|
});
|
||||||
}
|
|
||||||
loadVersion(getVersion(), getProfile());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -17,11 +17,14 @@ public abstract class FCLCommonUI extends FCLBaseUI {
|
||||||
|
|
||||||
private UILoadingCallback callback;
|
private UILoadingCallback callback;
|
||||||
|
|
||||||
|
private boolean init = false;
|
||||||
|
|
||||||
public FCLCommonUI(Context context, FCLUILayout parent, @LayoutRes int id) {
|
public FCLCommonUI(Context context, FCLUILayout parent, @LayoutRes int id) {
|
||||||
super(context);
|
super(context);
|
||||||
this.parent = parent;
|
this.parent = parent;
|
||||||
setContentView(id, () -> {
|
setContentView(id, () -> {
|
||||||
onCreate();
|
onCreate();
|
||||||
|
init = true;
|
||||||
if (callback != null) {
|
if (callback != null) {
|
||||||
callback.onLoad();
|
callback.onLoad();
|
||||||
}
|
}
|
||||||
|
@ -78,5 +81,8 @@ public abstract class FCLCommonUI extends FCLBaseUI {
|
||||||
|
|
||||||
public void addLoadingCallback(UILoadingCallback callback) {
|
public void addLoadingCallback(UILoadingCallback callback) {
|
||||||
this.callback = callback;
|
this.callback = callback;
|
||||||
|
if (init) {
|
||||||
|
callback.onLoad();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue