mirror of
https://github.com/libretro/RetroArch.git
synced 2024-11-29 11:10:27 +00:00
(Android Phoenix) Separate java classfile for FileWrapper
(Android) Bind menu button to RGUI for 360 pad
This commit is contained in:
parent
d4064b20a3
commit
5a2a89a8db
@ -722,6 +722,7 @@ static void android_input_set_keybinds(void *data, unsigned device,
|
||||
sizeof(g_settings.input.device_names[port]));
|
||||
|
||||
g_settings.input.dpad_emulation[port] = ANALOG_DPAD_DUALANALOG;
|
||||
keycode_lut[AKEYCODE_BUTTON_MODE] |= ((RARCH_MENU_TOGGLE + 1) << shift);
|
||||
keycode_lut[AKEYCODE_BACK] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
||||
keycode_lut[AKEYCODE_BUTTON_SELECT] |= ((RETRO_DEVICE_ID_JOYPAD_SELECT+1) << shift);
|
||||
keycode_lut[AKEYCODE_BUTTON_START] |= ((RETRO_DEVICE_ID_JOYPAD_START+1) << shift);
|
||||
|
@ -29,6 +29,7 @@
|
||||
<activity android:name=".browser.PopupMenuAbstract"></activity>
|
||||
<activity android:name=".browser.ReportIME"></activity>
|
||||
<activity android:name=".browser.HelpActivity"></activity>
|
||||
<activity android:name=".browser.FileWrapper"></activity>
|
||||
<activity android:name=".browser.DirectoryActivity"></activity>
|
||||
<activity android:name=".browser.ROMActivity"></activity>
|
||||
|
||||
|
@ -12,75 +12,7 @@ import android.os.*;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.widget.*;
|
||||
import android.view.*;
|
||||
import android.graphics.drawable.*;
|
||||
|
||||
class FileWrapper implements IconAdapterItem {
|
||||
public final File file;
|
||||
public final boolean parentItem;
|
||||
public final boolean dirSelectItem;
|
||||
|
||||
protected final boolean enabled;
|
||||
|
||||
public static final int DIRSELECT = 0;
|
||||
public static final int PARENT = 1;
|
||||
public static final int FILE = 2;
|
||||
|
||||
protected final int typeIndex;
|
||||
|
||||
public FileWrapper(File aFile, int type, boolean aIsEnabled) {
|
||||
file = aFile;
|
||||
|
||||
parentItem = type == PARENT;
|
||||
dirSelectItem = type == DIRSELECT;
|
||||
typeIndex = type == FILE ? (FILE + (file.isDirectory() ? 0 : 1)) : type;
|
||||
|
||||
enabled = parentItem || dirSelectItem || aIsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
if (dirSelectItem)
|
||||
return "[[Use this directory]]";
|
||||
else if (parentItem)
|
||||
return "[Parent Directory]";
|
||||
else
|
||||
return file.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconResourceId() {
|
||||
if (!parentItem && !dirSelectItem) {
|
||||
return file.isFile() ? R.drawable.ic_file : R.drawable.ic_dir;
|
||||
} else {
|
||||
return R.drawable.ic_dir;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getIconDrawable() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int compareTo(FileWrapper aOther) {
|
||||
if (aOther != null) {
|
||||
// Who says ternary is hard to follow
|
||||
if (isEnabled() == aOther.isEnabled()) {
|
||||
return (typeIndex == aOther.typeIndex) ? file
|
||||
.compareTo(aOther.file)
|
||||
: ((typeIndex < aOther.typeIndex) ? -1 : 1);
|
||||
} else {
|
||||
return isEnabled() ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
public class DirectoryActivity extends Activity implements
|
||||
AdapterView.OnItemClickListener {
|
||||
|
75
android/phoenix/src/org/retroarch/browser/FileWrapper.java
Normal file
75
android/phoenix/src/org/retroarch/browser/FileWrapper.java
Normal file
@ -0,0 +1,75 @@
|
||||
package org.retroarch.browser;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
import org.retroarch.R;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
class FileWrapper implements IconAdapterItem {
|
||||
public final File file;
|
||||
public final boolean parentItem;
|
||||
public final boolean dirSelectItem;
|
||||
|
||||
protected final boolean enabled;
|
||||
|
||||
public static final int DIRSELECT = 0;
|
||||
public static final int PARENT = 1;
|
||||
public static final int FILE = 2;
|
||||
|
||||
protected final int typeIndex;
|
||||
|
||||
public FileWrapper(File aFile, int type, boolean aIsEnabled) {
|
||||
file = aFile;
|
||||
|
||||
parentItem = type == PARENT;
|
||||
dirSelectItem = type == DIRSELECT;
|
||||
typeIndex = type == FILE ? (FILE + (file.isDirectory() ? 0 : 1)) : type;
|
||||
|
||||
enabled = parentItem || dirSelectItem || aIsEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return enabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getText() {
|
||||
if (dirSelectItem)
|
||||
return "[[Use this directory]]";
|
||||
else if (parentItem)
|
||||
return "[Parent Directory]";
|
||||
else
|
||||
return file.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getIconResourceId() {
|
||||
if (!parentItem && !dirSelectItem) {
|
||||
return file.isFile() ? R.drawable.ic_file : R.drawable.ic_dir;
|
||||
} else {
|
||||
return R.drawable.ic_dir;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Drawable getIconDrawable() {
|
||||
return null;
|
||||
}
|
||||
|
||||
public int compareTo(FileWrapper aOther) {
|
||||
if (aOther != null) {
|
||||
// Who says ternary is hard to follow
|
||||
if (isEnabled() == aOther.isEnabled()) {
|
||||
return (typeIndex == aOther.typeIndex) ? file
|
||||
.compareTo(aOther.file)
|
||||
: ((typeIndex < aOther.typeIndex) ? -1 : 1);
|
||||
} else {
|
||||
return isEnabled() ? -1 : 1;
|
||||
}
|
||||
}
|
||||
|
||||
return -1;
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue
Block a user