mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-07-24 14:49:42 -06:00
Merge branch 'master' into android-new-control-input-overlay
Conflicts: Source/Android/res/values-ja/strings.xml Source/Android/res/values/strings.xml Source/Android/src/org/dolphinemu/dolphinemu/AboutFragment.java Source/Android/src/org/dolphinemu/dolphinemu/emulation/EmulationActivity.java Source/Android/src/org/dolphinemu/dolphinemu/folderbrowser/FolderBrowser.java Source/Android/src/org/dolphinemu/dolphinemu/gamelist/GameListActivity.java Source/Android/src/org/dolphinemu/dolphinemu/settings/video/VideoSettingsFragment.java
This commit is contained in:
@ -8,8 +8,12 @@
|
||||
|
||||
<!-- Save State Slots -->
|
||||
<item
|
||||
android:id="@+id/saveStateRoot"
|
||||
android:id="@+id/takeScreenshot"
|
||||
android:showAsAction="ifRoom"
|
||||
android:title="@string/overlay_screenshot"/>
|
||||
<item
|
||||
android:id="@+id/saveStateRoot"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/overlay_savestate">
|
||||
<menu>
|
||||
<item android:id="@+id/saveSlot1"
|
||||
@ -32,7 +36,7 @@
|
||||
<!-- Load State Slots -->
|
||||
<item
|
||||
android:id="@+id/loadStateRoot"
|
||||
android:showAsAction="ifRoom"
|
||||
android:showAsAction="never"
|
||||
android:title="@string/overlay_loadstate">
|
||||
<menu>
|
||||
<item android:id="@+id/loadSlot1"
|
||||
|
@ -11,6 +11,7 @@
|
||||
<!-- About Fragment -->
|
||||
<string name="build_revision">ビルドのバージョン</string>
|
||||
<string name="supports_gles3">サポートのOpenGL ES 3</string>
|
||||
<string name="supports_neon">サポートのNEON</string>
|
||||
|
||||
<!-- Folder Browser -->
|
||||
<string name="current_dir">現在のディレクトリ: %1$s</string>
|
||||
@ -25,12 +26,17 @@
|
||||
<string name="settings">設定</string>
|
||||
<string name="about">について</string>
|
||||
|
||||
<!-- Game List Activity - Device Compatibility AlertDialog -->
|
||||
<string name="device_compat_warning">デバイスの互換性の警告</string>
|
||||
<string name="device_compat_warning_msg">この電話は、NEON拡張をサポートしていません。 おそらくDolphinを実行することはできません。\nあなたはとにかくそれを実行してみますか?</string>
|
||||
|
||||
<!-- Game List Fragment -->
|
||||
<string name="file_clicked">クリックされたファイル: %1$s</string>
|
||||
|
||||
<!-- Emulation Window Overlay -->
|
||||
<string name="enable_input_overlay">入力オーバーレイを有効</string>
|
||||
<string name="disable_input_overlay">入力オーバーレイを無効</string>
|
||||
<string name="overlay_screenshot">スクリーンショットを撮る</string>
|
||||
<string name="overlay_savestate">ステートセーブ</string>
|
||||
<string name="overlay_loadstate">ステートロード</string>
|
||||
<string name="overlay_exit_emulation">終了</string>
|
||||
|
@ -11,6 +11,7 @@
|
||||
<!-- About Fragment -->
|
||||
<string name="build_revision">Build Revision</string>
|
||||
<string name="supports_gles3">Supports OpenGL ES 3</string>
|
||||
<string name="supports_neon">Supports NEON</string>
|
||||
|
||||
<!-- Folder Browser -->
|
||||
<string name="current_dir">Current Dir: %1$s</string>
|
||||
@ -25,12 +26,17 @@
|
||||
<string name="settings">Settings</string>
|
||||
<string name="about">About</string>
|
||||
|
||||
<!-- Game List Activity - Device Compatibility AlertDialog -->
|
||||
<string name="device_compat_warning">Device Compatibility Warning</string>
|
||||
<string name="device_compat_warning_msg">Your phone doesn\'t support NEON which makes it incapable of running Dolphin Mobile?\nDo you want to try anyway?</string>
|
||||
|
||||
<!-- Game List Fragment -->
|
||||
<string name="file_clicked">File clicked: %1$s</string>
|
||||
|
||||
<!-- Emulation Overlay -->
|
||||
<string name="enable_input_overlay">Enable Input Overlay</string>
|
||||
<string name="disable_input_overlay">Disable Input Overlay</string>
|
||||
<string name="overlay_screenshot">Take Screenshot</string>
|
||||
<string name="overlay_savestate">Save State</string>
|
||||
<string name="overlay_loadstate">Load State</string>
|
||||
<string name="overlay_exit_emulation">Exit</string>
|
||||
|
@ -29,21 +29,21 @@ public final class AboutFragment extends ListFragment
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
ListView mMainList = (ListView) rootView.findViewById(R.id.gamelist);
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
|
||||
String yes = getString(R.string.yes);
|
||||
String no = getString(R.string.no);
|
||||
final String yes = getString(R.string.yes);
|
||||
final String no = getString(R.string.no);
|
||||
|
||||
List<AboutFragmentItem> Input = new ArrayList<AboutFragmentItem>();
|
||||
Input.add(new AboutFragmentItem(getString(R.string.build_revision), NativeLibrary.GetVersionString()));
|
||||
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);
|
||||
mMainList.setAdapter(adapter);
|
||||
mMainList.setEnabled(false); // Makes the list view non-clickable.
|
||||
rootView.setAdapter(adapter);
|
||||
rootView.setEnabled(false); // Makes the list view non-clickable.
|
||||
|
||||
return mMainList;
|
||||
return rootView;
|
||||
}
|
||||
|
||||
// Represents an item in the AboutFragment.
|
||||
@ -94,18 +94,17 @@ public final class AboutFragment extends ListFragment
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
View v = convertView;
|
||||
if (v == null)
|
||||
if (convertView == null)
|
||||
{
|
||||
LayoutInflater vi = (LayoutInflater) ctx.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
v = vi.inflate(id, parent, false);
|
||||
LayoutInflater vi = LayoutInflater.from(ctx);
|
||||
convertView = vi.inflate(id, parent, false);
|
||||
}
|
||||
|
||||
final AboutFragmentItem item = items.get(position);
|
||||
if (item != null)
|
||||
{
|
||||
TextView title = (TextView) v.findViewById(R.id.AboutItemTitle);
|
||||
TextView subtitle = (TextView) v.findViewById(R.id.AboutItemSubTitle);
|
||||
TextView title = (TextView) convertView.findViewById(R.id.AboutItemTitle);
|
||||
TextView subtitle = (TextView) convertView.findViewById(R.id.AboutItemSubTitle);
|
||||
|
||||
if (title != null)
|
||||
title.setText(item.getTitle());
|
||||
@ -114,7 +113,7 @@ public final class AboutFragment extends ListFragment
|
||||
subtitle.setText(item.getSubTitle());
|
||||
}
|
||||
|
||||
return v;
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -86,4 +86,9 @@ public final class DolphinEmulator extends Activity
|
||||
UserPreferences.LoadIniToPrefs(this);
|
||||
}
|
||||
}
|
||||
protected void onRestart()
|
||||
{
|
||||
super.onRestart();
|
||||
finish(); // If we are ever returning to this activity then we are exiting.
|
||||
}
|
||||
}
|
@ -152,6 +152,19 @@ public final class NativeLibrary
|
||||
*/
|
||||
public static native String GetVersionString();
|
||||
|
||||
/**
|
||||
* Returns if the phone supports NEON or not
|
||||
*
|
||||
* @return true if it supports NEON, false otherwise.
|
||||
*/
|
||||
public static native boolean SupportsNEON();
|
||||
|
||||
/**
|
||||
* Saves a screen capture of the game
|
||||
*
|
||||
*/
|
||||
public static native void SaveScreenShot();
|
||||
|
||||
/**
|
||||
* Saves a game state to the slot number.
|
||||
*
|
||||
|
@ -64,12 +64,14 @@ public final class EmulationActivity extends Activity
|
||||
//
|
||||
// Due to a bug in Adreno, it renders the screen rotated 90 degrees when using OpenGL
|
||||
// Flip the width and height when on Adreno to work around this.
|
||||
// This bug is fixed in Qualcomm driver v53
|
||||
// Mali isn't affected by this bug.
|
||||
sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
|
||||
if (sharedPrefs.getString("gpuPref", "Software Rendering").equals("OGL")
|
||||
&& VideoSettingsFragment.SupportsGLES3()
|
||||
&& VideoSettingsFragment.m_GLVendor != null
|
||||
&& VideoSettingsFragment.m_GLVendor.equals("Qualcomm"))
|
||||
&& VideoSettingsFragment.m_GLVendor.equals("Qualcomm")
|
||||
&& VideoSettingsFragment.m_QualcommVersion < 53.0f)
|
||||
NativeLibrary.SetDimensions((int)screenHeight, (int)screenWidth);
|
||||
else
|
||||
NativeLibrary.SetDimensions((int)screenWidth, (int)screenHeight);
|
||||
@ -204,6 +206,11 @@ public final class EmulationActivity extends Activity
|
||||
return true;
|
||||
}
|
||||
|
||||
// Screenshot capturing
|
||||
case R.id.takeScreenshot:
|
||||
NativeLibrary.SaveScreenShot();
|
||||
return true;
|
||||
|
||||
// Save state slots
|
||||
case R.id.saveSlot1:
|
||||
NativeLibrary.SaveState(0);
|
||||
|
@ -37,16 +37,17 @@ import org.dolphinemu.dolphinemu.gamelist.GameListActivity;
|
||||
public final class FolderBrowser extends ListFragment
|
||||
{
|
||||
private FolderBrowserAdapter adapter;
|
||||
private ListView mFolderBrowserList;
|
||||
private ListView rootView;
|
||||
private static File currentDir = null;
|
||||
|
||||
// Populates the FolderView with the given currDir's contents.
|
||||
private void Fill(File currDir)
|
||||
{
|
||||
// Change the activity title to reflect the current directory the FolderBrowser is in.
|
||||
// Clear the adapter of previous items.
|
||||
adapter.clear();
|
||||
|
||||
// Set the activity title to the current directory the FolderBrowser is in.
|
||||
getActivity().setTitle(String.format(getString(R.string.current_dir), currDir.getName()));
|
||||
|
||||
|
||||
File[] dirs = currDir.listFiles();
|
||||
List<FolderBrowserItem> dir = new ArrayList<FolderBrowserItem>();
|
||||
List<FolderBrowserItem> fls = new ArrayList<FolderBrowserItem>();
|
||||
@ -96,9 +97,9 @@ public final class FolderBrowser extends ListFragment
|
||||
if (!currDir.getPath().equalsIgnoreCase("/"))
|
||||
dir.add(0, new FolderBrowserItem("..", getString(R.string.parent_directory), currDir.getParent()));
|
||||
|
||||
adapter = new FolderBrowserAdapter(getActivity(), R.layout.gamelist_folderbrowser_list, dir);
|
||||
mFolderBrowserList = (ListView) rootView.findViewById(R.id.gamelist);
|
||||
mFolderBrowserList.setAdapter(adapter);
|
||||
// Add the items to the adapter and notify the adapter users of its new contents.
|
||||
adapter.addAll(dir);
|
||||
adapter.notifyDataSetChanged();
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -122,10 +123,12 @@ public final class FolderBrowser extends ListFragment
|
||||
if(currentDir == null)
|
||||
currentDir = new File(Environment.getExternalStorageDirectory().getPath());
|
||||
|
||||
rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
adapter = new FolderBrowserAdapter(getActivity(), R.layout.gamelist_folderbrowser_list_item);
|
||||
rootView.setAdapter(adapter);
|
||||
|
||||
Fill(currentDir);
|
||||
return mFolderBrowserList;
|
||||
return rootView;
|
||||
}
|
||||
|
||||
private void FolderSelected()
|
||||
|
@ -6,15 +6,12 @@
|
||||
|
||||
package org.dolphinemu.dolphinemu.folderbrowser;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
@ -27,79 +24,89 @@ import org.dolphinemu.dolphinemu.R;
|
||||
*/
|
||||
public final class FolderBrowserAdapter extends ArrayAdapter<FolderBrowserItem>
|
||||
{
|
||||
// ViewHolder which is used to hold onto
|
||||
// items within a listview. This is done
|
||||
// so that findViewById is not needed to
|
||||
// be excessively called over and over.
|
||||
private static final class ViewHolder
|
||||
{
|
||||
TextView title;
|
||||
TextView subtitle;
|
||||
ImageView icon;
|
||||
}
|
||||
|
||||
private final Context context;
|
||||
private final int id;
|
||||
private final List<FolderBrowserItem> items;
|
||||
private ViewHolder viewHolder;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context The current {@link Context}.
|
||||
* @param resourceId The resource ID for a layout file containing a layout to use when instantiating views.
|
||||
* @param objects The objects to represent in the {@link ListView}.
|
||||
*/
|
||||
public FolderBrowserAdapter(Context context, int resourceId, List<FolderBrowserItem> objects)
|
||||
public FolderBrowserAdapter(Context context, int resourceId)
|
||||
{
|
||||
super(context, resourceId, objects);
|
||||
super(context, resourceId);
|
||||
|
||||
this.context = context;
|
||||
this.id = resourceId;
|
||||
this.items = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public FolderBrowserItem getItem(int i)
|
||||
{
|
||||
return items.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
View v = convertView;
|
||||
if (v == null)
|
||||
if (convertView == null)
|
||||
{
|
||||
LayoutInflater vi = LayoutInflater.from(context);
|
||||
v = vi.inflate(id, parent, false);
|
||||
convertView = vi.inflate(id, parent, false);
|
||||
|
||||
// Initialize the ViewHolder and store it.
|
||||
viewHolder = new ViewHolder();
|
||||
viewHolder.title = (TextView) convertView.findViewById(R.id.ListItemTitle);
|
||||
viewHolder.subtitle = (TextView) convertView.findViewById(R.id.ListItemSubTitle);
|
||||
viewHolder.icon = (ImageView) convertView.findViewById(R.id.ListItemIcon);
|
||||
convertView.setTag(viewHolder);
|
||||
}
|
||||
else // Can recover the holder.
|
||||
{
|
||||
viewHolder = (ViewHolder) convertView.getTag();
|
||||
}
|
||||
|
||||
final FolderBrowserItem item = items.get(position);
|
||||
final FolderBrowserItem item = getItem(position);
|
||||
if (item != null)
|
||||
{
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.ListItemIcon);
|
||||
TextView title = (TextView) v.findViewById(R.id.ListItemTitle);
|
||||
TextView subtitle = (TextView) v.findViewById(R.id.ListItemSubTitle);
|
||||
|
||||
if(title != null)
|
||||
if (viewHolder.title != null)
|
||||
{
|
||||
title.setText(item.getName());
|
||||
viewHolder.title.setText(item.getName());
|
||||
}
|
||||
|
||||
if(subtitle != null)
|
||||
if (viewHolder.subtitle != null)
|
||||
{
|
||||
// Remove the subtitle for all folders, except for the parent directory folder.
|
||||
if (item.isDirectory() && !item.getSubtitle().equals(context.getString(R.string.parent_directory)))
|
||||
{
|
||||
subtitle.setVisibility(View.GONE);
|
||||
viewHolder.subtitle.setVisibility(View.GONE);
|
||||
}
|
||||
else
|
||||
{
|
||||
subtitle.setText(item.getSubtitle());
|
||||
viewHolder.subtitle.setVisibility(View.VISIBLE);
|
||||
viewHolder.subtitle.setText(item.getSubtitle());
|
||||
}
|
||||
}
|
||||
|
||||
if (icon != null)
|
||||
if (viewHolder.icon != null)
|
||||
{
|
||||
if (item.isDirectory())
|
||||
{
|
||||
icon.setImageResource(R.drawable.ic_menu_folder);
|
||||
viewHolder.icon.setImageResource(R.drawable.ic_menu_folder);
|
||||
}
|
||||
else
|
||||
{
|
||||
icon.setImageResource(R.drawable.ic_menu_file);
|
||||
viewHolder.icon.setImageResource(R.drawable.ic_menu_file);
|
||||
}
|
||||
}
|
||||
}
|
||||
return v;
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
|
@ -9,10 +9,11 @@ package org.dolphinemu.dolphinemu.gamelist;
|
||||
import android.app.Activity;
|
||||
import android.app.AlertDialog;
|
||||
import android.app.Fragment;
|
||||
import android.app.FragmentManager;
|
||||
import android.app.FragmentTransaction;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.res.Configuration;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.ActionBarDrawerToggle;
|
||||
import android.support.v4.widget.DrawerLayout;
|
||||
@ -41,7 +42,6 @@ public final class GameListActivity extends Activity
|
||||
implements GameListFragment.OnGameListZeroListener
|
||||
{
|
||||
private int mCurFragmentNum = 0;
|
||||
private Fragment mCurFragment;
|
||||
|
||||
private ActionBarDrawerToggle mDrawerToggle;
|
||||
private DrawerLayout mDrawerLayout;
|
||||
@ -102,10 +102,36 @@ public final class GameListActivity extends Activity
|
||||
};
|
||||
mDrawerLayout.setDrawerListener(mDrawerToggle);
|
||||
|
||||
// Display the game list fragment.
|
||||
mCurFragment = new GameListFragment();
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
||||
// Display the game list fragment on activity creation,
|
||||
// but only if no previous states have been saved.
|
||||
if (savedInstanceState == null)
|
||||
{
|
||||
final GameListFragment gameList = new GameListFragment();
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.content_frame, gameList);
|
||||
ft.commit();
|
||||
}
|
||||
|
||||
|
||||
// Create an alert telling them that their phone sucks
|
||||
if (Build.CPU_ABI.contains("arm") && !NativeLibrary.SupportsNEON())
|
||||
{
|
||||
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.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which)
|
||||
{
|
||||
finish();
|
||||
}
|
||||
});
|
||||
builder.show();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@ -129,9 +155,10 @@ public final class GameListActivity extends Activity
|
||||
setTitle(R.string.app_name);
|
||||
|
||||
mCurFragmentNum = 0;
|
||||
mCurFragment = new GameListFragment();
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
||||
final GameListFragment gameList = new GameListFragment();
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.content_frame, gameList);
|
||||
ft.commit();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
break;
|
||||
@ -139,9 +166,11 @@ public final class GameListActivity extends Activity
|
||||
case 1: // Folder Browser
|
||||
{
|
||||
mCurFragmentNum = 1;
|
||||
mCurFragment = new FolderBrowser();
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
||||
final FolderBrowser folderBrowser = new FolderBrowser();
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.content_frame, folderBrowser);
|
||||
ft.addToBackStack(null);
|
||||
ft.commit();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
break;
|
||||
@ -156,9 +185,11 @@ public final class GameListActivity extends Activity
|
||||
case 3: // About
|
||||
{
|
||||
mCurFragmentNum = 3;
|
||||
mCurFragment = new AboutFragment();
|
||||
FragmentManager fragmentManager = getFragmentManager();
|
||||
fragmentManager.beginTransaction().replace(R.id.content_frame, mCurFragment).commit();
|
||||
final AboutFragment aboutFragment = new AboutFragment();
|
||||
FragmentTransaction ft = getFragmentManager().beginTransaction();
|
||||
ft.replace(R.id.content_frame, aboutFragment);
|
||||
ft.addToBackStack(null);
|
||||
ft.commit();
|
||||
invalidateOptionsMenu();
|
||||
}
|
||||
break;
|
||||
@ -245,7 +276,7 @@ public final class GameListActivity extends Activity
|
||||
NativeLibrary.SetConfig("Dolphin.ini", "General", "GCMPathes", "0");
|
||||
|
||||
// Now finally, clear the game list.
|
||||
((GameListFragment) mCurFragment).clearGameList();
|
||||
((GameListFragment) getFragmentManager().findFragmentById(R.id.content_frame)).clearGameList();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(R.string.no, new DialogInterface.OnClickListener() {
|
||||
@ -260,7 +291,23 @@ public final class GameListActivity extends Activity
|
||||
|
||||
return super.onOptionsItemSelected(item);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState)
|
||||
{
|
||||
super.onSaveInstanceState(outState);
|
||||
|
||||
outState.putInt("currentFragmentNum", mCurFragmentNum);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onRestoreInstanceState(Bundle savedInstanceState)
|
||||
{
|
||||
super.onRestoreInstanceState(savedInstanceState);
|
||||
|
||||
mCurFragmentNum = savedInstanceState.getInt("currentFragmentNum");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBackPressed()
|
||||
{
|
||||
|
@ -12,11 +12,8 @@ import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import org.dolphinemu.dolphinemu.R;
|
||||
|
||||
/**
|
||||
@ -28,46 +25,36 @@ public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
||||
{
|
||||
private final Context context;
|
||||
private final int id;
|
||||
private final List<GameListItem>items;
|
||||
|
||||
/**
|
||||
* Constructor
|
||||
*
|
||||
* @param context The current {@link Context}.
|
||||
* @param resourceId The resource ID for a layout file containing a layout to use when instantiating views.
|
||||
* @param objects The objects to represent in the {@link ListView}.
|
||||
*/
|
||||
public GameListAdapter(Context context, int resourceId, List<GameListItem> objects)
|
||||
public GameListAdapter(Context context, int resourceId)
|
||||
{
|
||||
super(context, resourceId, objects);
|
||||
super(context, resourceId);
|
||||
|
||||
this.context = context;
|
||||
this.id = resourceId;
|
||||
this.items = objects;
|
||||
}
|
||||
|
||||
@Override
|
||||
public GameListItem getItem(int i)
|
||||
{
|
||||
return items.get(i);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
View v = convertView;
|
||||
if (v == null)
|
||||
if (convertView == null)
|
||||
{
|
||||
LayoutInflater vi = LayoutInflater.from(context);
|
||||
v = vi.inflate(id, parent, false);
|
||||
convertView = vi.inflate(id, parent, false);
|
||||
}
|
||||
|
||||
final GameListItem item = items.get(position);
|
||||
final GameListItem item = getItem(position);
|
||||
if (item != null)
|
||||
{
|
||||
TextView title = (TextView) v.findViewById(R.id.ListItemTitle);
|
||||
TextView subtitle = (TextView) v.findViewById(R.id.ListItemSubTitle);
|
||||
ImageView icon = (ImageView) v.findViewById(R.id.ListItemIcon);
|
||||
TextView title = (TextView) convertView.findViewById(R.id.ListItemTitle);
|
||||
TextView subtitle = (TextView) convertView.findViewById(R.id.ListItemSubTitle);
|
||||
ImageView icon = (ImageView) convertView.findViewById(R.id.ListItemIcon);
|
||||
|
||||
if (title != null)
|
||||
title.setText(item.getName());
|
||||
@ -83,7 +70,7 @@ public final class GameListAdapter extends ArrayAdapter<GameListItem>
|
||||
}
|
||||
}
|
||||
|
||||
return v;
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -35,7 +35,6 @@ import org.dolphinemu.dolphinemu.emulation.EmulationActivity;
|
||||
public final class GameListFragment extends ListFragment
|
||||
{
|
||||
private GameListAdapter mGameAdapter;
|
||||
private static GameListActivity mMe;
|
||||
private OnGameListZeroListener mCallback;
|
||||
|
||||
/**
|
||||
@ -84,7 +83,7 @@ public final class GameListFragment extends ListFragment
|
||||
if (!entry.isHidden() && !entry.isDirectory())
|
||||
{
|
||||
if (exts.contains(entryName.toLowerCase().substring(entryName.lastIndexOf('.'))))
|
||||
fls.add(new GameListItem(mMe, entryName, String.format(getString(R.string.file_size), entry.length()), entry.getAbsolutePath()));
|
||||
fls.add(new GameListItem(getActivity(), entryName, String.format(getString(R.string.file_size), entry.length()), entry.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -94,8 +93,9 @@ public final class GameListFragment extends ListFragment
|
||||
}
|
||||
Collections.sort(fls);
|
||||
|
||||
mGameAdapter = new GameListAdapter(mMe, R.layout.gamelist_folderbrowser_list, fls);
|
||||
setListAdapter(mGameAdapter);
|
||||
// Add all the items to the adapter
|
||||
mGameAdapter.addAll(fls);
|
||||
mGameAdapter.notifyDataSetChanged();
|
||||
|
||||
if (fls.isEmpty())
|
||||
{
|
||||
@ -106,12 +106,13 @@ public final class GameListFragment extends ListFragment
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
|
||||
{
|
||||
View rootView = inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
ListView mMainList = (ListView) rootView.findViewById(R.id.gamelist);
|
||||
ListView rootView = (ListView) inflater.inflate(R.layout.gamelist_listview, container, false);
|
||||
mGameAdapter = new GameListAdapter(getActivity(), R.layout.gamelist_folderbrowser_list_item);
|
||||
rootView.setAdapter(mGameAdapter);
|
||||
|
||||
Fill();
|
||||
|
||||
return mMainList;
|
||||
return rootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -120,12 +121,12 @@ public final class GameListFragment extends ListFragment
|
||||
GameListItem item = mGameAdapter.getItem(position);
|
||||
|
||||
// Show a toast indicating which game was clicked.
|
||||
Toast.makeText(mMe, String.format(getString(R.string.file_clicked), item.getPath()), Toast.LENGTH_SHORT).show();
|
||||
Toast.makeText(getActivity(), String.format(getString(R.string.file_clicked), item.getPath()), Toast.LENGTH_SHORT).show();
|
||||
|
||||
// Start the emulation activity and send the path of the clicked ROM to it.
|
||||
Intent intent = new Intent(mMe, EmulationActivity.class);
|
||||
Intent intent = new Intent(getActivity(), EmulationActivity.class);
|
||||
intent.putExtra("SelectedGame", item.getPath());
|
||||
mMe.startActivity(intent);
|
||||
startActivity(intent);
|
||||
}
|
||||
|
||||
@Override
|
||||
@ -138,7 +139,6 @@ public final class GameListFragment extends ListFragment
|
||||
try
|
||||
{
|
||||
mCallback = (OnGameListZeroListener) activity;
|
||||
mMe = (GameListActivity) activity;
|
||||
}
|
||||
catch (ClassCastException e)
|
||||
{
|
||||
|
@ -27,6 +27,7 @@ public final class VideoSettingsFragment extends PreferenceFragment
|
||||
public static String m_GLVendor;
|
||||
public static String m_GLRenderer;
|
||||
public static String m_GLExtensions;
|
||||
public static float m_QualcommVersion;
|
||||
|
||||
/**
|
||||
* Class which provides a means to retrieve various
|
||||
@ -163,7 +164,6 @@ public final class VideoSettingsFragment extends PreferenceFragment
|
||||
{
|
||||
int mVStart = m_GLVersion.indexOf("V@") + 2;
|
||||
int mVEnd = 0;
|
||||
float mVersion;
|
||||
|
||||
for (int a = mVStart; a < m_GLVersion.length(); ++a)
|
||||
{
|
||||
@ -174,20 +174,12 @@ public final class VideoSettingsFragment extends PreferenceFragment
|
||||
}
|
||||
}
|
||||
|
||||
mVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd));
|
||||
m_QualcommVersion = Float.parseFloat(m_GLVersion.substring(mVStart, mVEnd));
|
||||
|
||||
if (mVersion >= 14.0f)
|
||||
if (m_QualcommVersion >= 14.0f)
|
||||
mSupportsGLES3 = true;
|
||||
}
|
||||
}
|
||||
if (!mSupportsGLES3 &&
|
||||
m_GLVendor != null && m_GLVendor.equals("NVIDIA Corporation") &&
|
||||
m_GLRenderer != null && m_GLRenderer.equals("NVIDIA Tegra") &&
|
||||
m_GLExtensions != null && m_GLExtensions.contains("GL_OES_depth24"))
|
||||
{
|
||||
// Is a Tegra 4 since it supports 24bit depth
|
||||
mSupportsGLES3 = true;
|
||||
}
|
||||
return mSupportsGLES3;
|
||||
}
|
||||
|
||||
|
@ -54,23 +54,22 @@ public final class SideMenuAdapter extends ArrayAdapter<SideMenuItem>
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent)
|
||||
{
|
||||
View v = convertView;
|
||||
if (v == null)
|
||||
if (convertView == null)
|
||||
{
|
||||
LayoutInflater vi = LayoutInflater.from(context);
|
||||
v = vi.inflate(id, null);
|
||||
convertView = vi.inflate(id, null);
|
||||
}
|
||||
|
||||
final SideMenuItem item = items.get(position);
|
||||
if (item != null)
|
||||
{
|
||||
TextView title = (TextView) v.findViewById(R.id.SideMenuTitle);
|
||||
TextView title = (TextView) convertView.findViewById(R.id.SideMenuTitle);
|
||||
|
||||
if (title != null)
|
||||
title.setText(item.getName());
|
||||
}
|
||||
|
||||
return v;
|
||||
return convertView;
|
||||
}
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user