diff --git a/Source/Android/AndroidManifest.xml b/Source/Android/AndroidManifest.xml index 80fb93470e..95d8b9a174 100644 --- a/Source/Android/AndroidManifest.xml +++ b/Source/Android/AndroidManifest.xml @@ -33,6 +33,7 @@ + ビルドのバージョン サポートのOpenGL ES 3 サポートのNEON + CPU + GLES 2 + GLES 3 + OpenGL 現在のディレクトリ: %1$s diff --git a/Source/Android/res/values/strings.xml b/Source/Android/res/values/strings.xml index 3557261e66..b60a56e73c 100644 --- a/Source/Android/res/values/strings.xml +++ b/Source/Android/res/values/strings.xml @@ -12,6 +12,11 @@ Build Revision Supports OpenGL ES 3 Supports NEON + General + CPU + GLES 2 + GLES 3 + OpenGL Current Dir: %1$s diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java new file mode 100644 index 0000000000..c3f0f61af8 --- /dev/null +++ b/Source/Android/src/org/dolphinemu/dolphinemu/about/AboutActivity.java @@ -0,0 +1,151 @@ +package org.dolphinemu.dolphinemu.about; + +import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment; + +import android.app.ActionBar; +import android.app.ActionBar.Tab; +import android.app.ActionBar.TabListener; +import android.app.Activity; +import android.app.Fragment; +import android.app.FragmentManager; +import android.app.FragmentTransaction; +import android.os.Bundle; +import android.support.v13.app.FragmentPagerAdapter; +import android.support.v4.view.ViewPager; + +/** + * Activity for the about menu, which displays info + * related to the CPU and GPU. Along with misc other info. + */ +public final class AboutActivity extends Activity implements TabListener +{ + private ViewPager viewPager; + private boolean supportsGles3; + + @Override + protected void onCreate(Bundle savedInstanceState) + { + super.onCreate(savedInstanceState); + + // Set the view pager + setContentView(R.layout.viewpager); + viewPager = (ViewPager) findViewById(R.id.pager); + + // Check if GLES3 is supported + supportsGles3 = VideoSettingsFragment.SupportsGLES3(); + + // Initialize the ViewPager adapter. + final ViewPagerAdapter adapter = new ViewPagerAdapter(getFragmentManager()); + viewPager.setAdapter(adapter); + + // Set up the ActionBar + final ActionBar actionBar = getActionBar(); + actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_TABS); + actionBar.addTab(actionBar.newTab().setText(R.string.general).setTabListener(this)); + actionBar.addTab(actionBar.newTab().setText(R.string.cpu).setTabListener(this)); + actionBar.addTab(actionBar.newTab().setText(R.string.gles_two).setTabListener(this)); + if (supportsGles3) + actionBar.addTab(actionBar.newTab().setText(R.string.gles_three).setTabListener(this)); + // TODO: Check if Desktop GL is possible before enabling. + actionBar.addTab(actionBar.newTab().setText(R.string.desktop_gl).setTabListener(this)); + + // Set the page change listener + viewPager.setOnPageChangeListener(new ViewPager.SimpleOnPageChangeListener() + { + @Override + public void onPageSelected(int position) + { + actionBar.setSelectedNavigationItem(position); + } + }); + } + + @Override + public void onTabSelected(Tab tab, FragmentTransaction ft) + { + // When the given tab is selected, switch to the corresponding page in the ViewPager. + viewPager.setCurrentItem(tab.getPosition()); + } + + @Override + public void onTabReselected(Tab tab, FragmentTransaction ft) + { + // Do nothing. + } + + @Override + public void onTabUnselected(Tab tab, FragmentTransaction ft) + { + // Do nothing. + } + + /** + * {@link FragmentPagerAdapter} subclass responsible for handling + * the individual {@link Fragment}s within the {@link ViewPager}. + */ + private final class ViewPagerAdapter extends FragmentPagerAdapter + { + public ViewPagerAdapter(FragmentManager fm) + { + super(fm); + } + + @Override + public Fragment getItem(int position) + { + switch (position) + { + case 0: return new DolphinInfoFragment(); + // TODO: The rest of these fragments + case 1: return new Fragment(); // CPU + case 2: return new Fragment(); // GLES 2 + case 3: return new Fragment(); // GLES 3 + case 4: return new Fragment(); // Desktop GL + + default: // Should never happen + return null; + } + } + + @Override + public int getCount() + { + // TODO: In the future, make sure to take into account + // whether or not regular Desktop GL is possible. + if (supportsGles3) + { + return 5; + } + else + { + return 4; + } + } + + @Override + public CharSequence getPageTitle(int position) + { + switch (position) + { + case 0: + return getString(R.string.general); + + case 1: + return getString(R.string.cpu); + + case 2: + return getString(R.string.gles_two); + + case 3: + return getString(R.string.gles_three); + + case 4: + return getString(R.string.desktop_gl); + + default: // Should never happen + return null; + } + } + } +} diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java b/Source/Android/src/org/dolphinemu/dolphinemu/about/DolphinInfoFragment.java similarity index 82% rename from Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java rename to Source/Android/src/org/dolphinemu/dolphinemu/about/DolphinInfoFragment.java index 6ca90a2577..fccc20925f 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/about/DolphinInfoFragment.java @@ -4,7 +4,7 @@ * Refer to the license.txt file included. */ -package org.dolphinemu.dolphinemu; +package org.dolphinemu.dolphinemu.about; import android.app.ListFragment; import android.content.Context; @@ -19,12 +19,14 @@ import android.widget.TextView; import java.util.ArrayList; import java.util.List; +import org.dolphinemu.dolphinemu.NativeLibrary; +import org.dolphinemu.dolphinemu.R; import org.dolphinemu.dolphinemu.settings.video.VideoSettingsFragment; /** * Represents the about screen. */ -public final class AboutFragment extends ListFragment +public final class DolphinInfoFragment extends ListFragment { @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) @@ -39,14 +41,14 @@ public final class AboutFragment extends ListFragment Input.add(new AboutFragmentItem(getString(R.string.supports_gles3), VideoSettingsFragment.SupportsGLES3() ? yes : no)); Input.add(new AboutFragmentItem(getString(R.string.supports_neon), NativeLibrary.SupportsNEON() ? yes : no)); - AboutFragmentAdapter adapter = new AboutFragmentAdapter(getActivity(), R.layout.about_layout, Input); + InfoFragmentAdapter adapter = new InfoFragmentAdapter(getActivity(), R.layout.about_layout, Input); rootView.setAdapter(adapter); rootView.setEnabled(false); // Makes the list view non-clickable. return rootView; } - // Represents an item in the AboutFragment. + // Represents an item in the DolphinInfoFragment. private static final class AboutFragmentItem { private final String title; @@ -69,14 +71,14 @@ public final class AboutFragment extends ListFragment } } - // The adapter that manages the displaying of items in this AboutFragment. - private static final class AboutFragmentAdapter extends ArrayAdapter + // The adapter that manages the displaying of items in this DolphinInfoFragment. + private static final class InfoFragmentAdapter extends ArrayAdapter { private final Context ctx; private final int id; private final List items; - public AboutFragmentAdapter(Context ctx, int id, List items) + public InfoFragmentAdapter(Context ctx, int id, List items) { super(ctx, id, items); diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java index 85fa9a62da..6a5f806da4 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java @@ -23,9 +23,10 @@ import android.view.MenuItem; import android.view.View; import android.widget.AdapterView; import android.widget.ListView; -import org.dolphinemu.dolphinemu.AboutFragment; + import org.dolphinemu.dolphinemu.NativeLibrary; import org.dolphinemu.dolphinemu.R; +import org.dolphinemu.dolphinemu.about.AboutActivity; import org.dolphinemu.dolphinemu.folderbrowser.FolderBrowser; import org.dolphinemu.dolphinemu.settings.PrefsActivity; import org.dolphinemu.dolphinemu.sidemenu.SideMenuAdapter; @@ -119,11 +120,7 @@ public final class GameListActivity extends Activity AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.device_compat_warning); builder.setMessage(R.string.device_compat_warning_msg); - builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) { - // Do Nothing. Just create the Yes button - } - }); + builder.setPositiveButton(R.string.yes, null); builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { @@ -184,13 +181,8 @@ public final class GameListActivity extends Activity case 3: // About { - mCurFragmentNum = 3; - final AboutFragment aboutFragment = new AboutFragment(); - FragmentTransaction ft = getFragmentManager().beginTransaction(); - ft.replace(R.id.content_frame, aboutFragment); - ft.addToBackStack(null); - ft.commit(); - invalidateOptionsMenu(); + Intent intent = new Intent(this, AboutActivity.class); + startActivity(intent); } break; @@ -261,7 +253,8 @@ public final class GameListActivity extends Activity AlertDialog.Builder builder = new AlertDialog.Builder(this); builder.setTitle(R.string.clear_game_list); builder.setMessage(getString(R.string.clear_game_list_confirm)); - builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener(){ + builder.setNegativeButton(R.string.no, null); + builder.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() { public void onClick(DialogInterface dialog, int which) { String directories = NativeLibrary.GetConfig("Dolphin.ini", "General", "GCMPathes", "0"); @@ -279,12 +272,6 @@ public final class GameListActivity extends Activity ((GameListFragment) getFragmentManager().findFragmentById(R.id.content_frame)).clearGameList(); } }); - builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, int which) - { - // Do nothing. This just make "No" appear. - } - }); builder.show(); } diff --git a/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java index 5368475319..41979ece46 100644 --- a/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java +++ b/Source/Android/src/org/dolphinemu/dolphinemu/settings/PrefsActivity.java @@ -41,7 +41,7 @@ public final class PrefsActivity extends Activity implements ActionBar.TabListen super.onCreate(savedInstanceState); // Set the ViewPager. - setContentView(R.layout.prefs_viewpager); + setContentView(R.layout.viewpager); mViewPager = (ViewPager) findViewById(R.id.pager); // Set the ViewPager adapter.