[Android] Fix the handling of orientation changes for the Fragments related to the game list. Now screen orientation changes don't kick you back to the root view.
This commit is contained in:
parent
e8a4cc0f71
commit
777b5a109b
|
@ -9,7 +9,7 @@ package org.dolphinemu.dolphinemu.gamelist;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.AlertDialog;
|
import android.app.AlertDialog;
|
||||||
import android.app.Fragment;
|
import android.app.Fragment;
|
||||||
import android.app.FragmentManager;
|
import android.app.FragmentTransaction;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.res.Configuration;
|
import android.content.res.Configuration;
|
||||||
|
@ -23,6 +23,7 @@ import android.view.MenuItem;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
import org.dolphinemu.dolphinemu.AboutFragment;
|
import org.dolphinemu.dolphinemu.AboutFragment;
|
||||||
import org.dolphinemu.dolphinemu.NativeLibrary;
|
import org.dolphinemu.dolphinemu.NativeLibrary;
|
||||||
import org.dolphinemu.dolphinemu.R;
|
import org.dolphinemu.dolphinemu.R;
|
||||||
|
@ -103,10 +104,16 @@ public final class GameListActivity extends Activity
|
||||||
};
|
};
|
||||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||||
|
|
||||||
// Display the game list fragment.
|
// Display the game list fragment on activity creation,
|
||||||
|
// but only if no previous states have been saved.
|
||||||
|
if (savedInstanceState == null)
|
||||||
|
{
|
||||||
mCurFragment = new GameListFragment();
|
mCurFragment = new GameListFragment();
|
||||||
FragmentManager fragmentManager = getFragmentManager();
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
ft.replace(R.id.content_frame, mCurFragment);
|
||||||
|
ft.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Create an alert telling them that their phone sucks
|
// Create an alert telling them that their phone sucks
|
||||||
if (Build.CPU_ABI.contains("arm") && !NativeLibrary.SupportsNEON())
|
if (Build.CPU_ABI.contains("arm") && !NativeLibrary.SupportsNEON())
|
||||||
|
@ -151,8 +158,9 @@ public final class GameListActivity extends Activity
|
||||||
|
|
||||||
mCurFragmentNum = 0;
|
mCurFragmentNum = 0;
|
||||||
mCurFragment = new GameListFragment();
|
mCurFragment = new GameListFragment();
|
||||||
FragmentManager fragmentManager = getFragmentManager();
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
ft.replace(R.id.content_frame, mCurFragment);
|
||||||
|
ft.commit();
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -161,8 +169,10 @@ public final class GameListActivity extends Activity
|
||||||
{
|
{
|
||||||
mCurFragmentNum = 1;
|
mCurFragmentNum = 1;
|
||||||
mCurFragment = new FolderBrowser();
|
mCurFragment = new FolderBrowser();
|
||||||
FragmentManager fragmentManager = getFragmentManager();
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
ft.replace(R.id.content_frame, mCurFragment);
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
ft.commit();
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -178,8 +188,10 @@ public final class GameListActivity extends Activity
|
||||||
{
|
{
|
||||||
mCurFragmentNum = 3;
|
mCurFragmentNum = 3;
|
||||||
mCurFragment = new AboutFragment();
|
mCurFragment = new AboutFragment();
|
||||||
FragmentManager fragmentManager = getFragmentManager();
|
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
ft.replace(R.id.content_frame, mCurFragment);
|
||||||
|
ft.addToBackStack(null);
|
||||||
|
ft.commit();
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -281,10 +293,4 @@ public final class GameListActivity extends Activity
|
||||||
|
|
||||||
return super.onOptionsItemSelected(item);
|
return super.onOptionsItemSelected(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void onBackPressed()
|
|
||||||
{
|
|
||||||
SwitchPage(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue