mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-11 09:00:15 -07:00
Get the user to the main fragment before starting mod installation
This commit is contained in:
parent
6b0ec1f524
commit
4aec0d538a
3 changed files with 14 additions and 0 deletions
|
|
@ -3,6 +3,7 @@ package net.kdt.pojavlaunch.fragments;
|
|||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.widget.Adapter;
|
||||
import android.widget.AdapterView;
|
||||
|
|
@ -16,6 +17,7 @@ import android.widget.Toast;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import net.kdt.pojavlaunch.JavaGUILauncherActivity;
|
||||
import net.kdt.pojavlaunch.R;
|
||||
|
|
@ -127,6 +129,13 @@ public class FabricInstallFragment extends Fragment implements AdapterView.OnIte
|
|||
sTaskProxy.detachListener();
|
||||
sTaskProxy = null;
|
||||
mStartButton.setEnabled(true);
|
||||
// This works because the due to the fact that we have transitioned here
|
||||
// without adding a transaction to the back stack, which caused the previous
|
||||
// transaction to be amended (i guess?? thats how the back stack dump looks like)
|
||||
// we can get back to the main fragment with just one back stack pop.
|
||||
// For some reason that amendment causes the transaction to lose its tag
|
||||
// so we cant use the tag here.
|
||||
getParentFragmentManager().popBackStackImmediate();
|
||||
Intent intent = new Intent(context, JavaGUILauncherActivity.class);
|
||||
FabricUtils.addAutoInstallArgs(intent, downloadedFile, mSelectedGameVersion, mSelectedLoaderVersion, mSelectedSnapshot, true);
|
||||
context.startActivity(intent);
|
||||
|
|
|
|||
|
|
@ -117,6 +117,8 @@ public abstract class ModVersionListFragment<T> extends Fragment implements Runn
|
|||
getTaskProxy().detachListener();
|
||||
setTaskProxy(null);
|
||||
mExpandableListView.setEnabled(true);
|
||||
// Read FabricInstallFragment line 132-137 to see why
|
||||
getParentFragmentManager().popBackStack();
|
||||
onDownloadFinished(context, downloadedFile);
|
||||
});
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,6 +21,9 @@ public class ProfileTypeSelectFragment extends Fragment {
|
|||
super.onViewCreated(view, savedInstanceState);
|
||||
view.findViewById(R.id.vanilla_profile).setOnClickListener(v -> Tools.swapFragment(requireActivity(), ProfileEditorFragment.class,
|
||||
ProfileEditorFragment.TAG, false, new Bundle(1)));
|
||||
|
||||
// NOTE: Special care needed! If you wll decide to add these to the back stack, please read FabricInstallFragment line 132-137
|
||||
// and amend FabricInstallFragment line 138 and ModVersionListFragment line 121
|
||||
view.findViewById(R.id.optifine_profile).setOnClickListener(v -> Tools.swapFragment(requireActivity(), OptiFineInstallFragment.class,
|
||||
OptiFineInstallFragment.TAG, false, null));
|
||||
view.findViewById(R.id.modded_profile_fabric).setOnClickListener((v)->
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue