Merge pull request #113 from NoblesseOblige/master
Updates to address issue items (past and future)
This commit is contained in:
commit
e59372f0d2
|
@ -223,4 +223,12 @@
|
||||||
|
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
|
<Button
|
||||||
|
android:id="@+id/debug_button"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_weight="1"
|
||||||
|
android:ems="8"
|
||||||
|
android:text="@string/menu_debug" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
|
@ -1,7 +1,8 @@
|
||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<ScrollView xmlns:android="http://schemas.android.com/apk/res/android"
|
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent" >
|
android:layout_height="match_parent"
|
||||||
|
android:orientation="vertical" >
|
||||||
|
|
||||||
<TableLayout
|
<TableLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
@ -59,6 +60,13 @@
|
||||||
android:layout_height="wrap_content" />
|
android:layout_height="wrap_content" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
</TableRow>
|
</TableRow>
|
||||||
|
</TableLayout>
|
||||||
|
|
||||||
|
<TableLayout
|
||||||
|
android:id="@+id/input_devices"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:stretchColumns="*" >
|
||||||
|
|
||||||
<TableRow
|
<TableRow
|
||||||
android:layout_marginTop="25dp"
|
android:layout_marginTop="25dp"
|
||||||
|
@ -241,4 +249,4 @@
|
||||||
</TableRow>
|
</TableRow>
|
||||||
</TableLayout>
|
</TableLayout>
|
||||||
|
|
||||||
</ScrollView>
|
</LinearLayout>
|
|
@ -27,6 +27,17 @@
|
||||||
android:text="@string/app_name"
|
android:text="@string/app_name"
|
||||||
android:textAppearance="?android:attr/textAppearanceLarge"
|
android:textAppearance="?android:attr/textAppearanceLarge"
|
||||||
android:textSize="32dp" />
|
android:textSize="32dp" />
|
||||||
|
|
||||||
|
<ImageView
|
||||||
|
android:id="@+id/config"
|
||||||
|
android:layout_width="48dp"
|
||||||
|
android:layout_height="fill_parent"
|
||||||
|
android:layout_marginBottom="2dp"
|
||||||
|
android:layout_marginLeft="2dp"
|
||||||
|
android:layout_marginRight="2dp"
|
||||||
|
android:layout_marginTop="2dp"
|
||||||
|
android:scaleType="fitCenter"
|
||||||
|
android:src="@drawable/config" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/options"
|
android:id="@+id/options"
|
||||||
|
@ -38,9 +49,9 @@
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/open_folder" />
|
android:src="@drawable/open_folder" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/config"
|
android:id="@+id/input"
|
||||||
android:layout_width="48dp"
|
android:layout_width="48dp"
|
||||||
android:layout_height="fill_parent"
|
android:layout_height="fill_parent"
|
||||||
android:layout_marginBottom="2dp"
|
android:layout_marginBottom="2dp"
|
||||||
|
@ -48,7 +59,7 @@
|
||||||
android:layout_marginRight="2dp"
|
android:layout_marginRight="2dp"
|
||||||
android:layout_marginTop="2dp"
|
android:layout_marginTop="2dp"
|
||||||
android:scaleType="fitCenter"
|
android:scaleType="fitCenter"
|
||||||
android:src="@drawable/config" />
|
android:src="@drawable/input" />
|
||||||
|
|
||||||
<ImageView
|
<ImageView
|
||||||
android:id="@+id/about"
|
android:id="@+id/about"
|
||||||
|
|
|
@ -87,4 +87,6 @@
|
||||||
<string name="textOn">ON</string>
|
<string name="textOn">ON</string>
|
||||||
<string name="textOff">OFF</string>
|
<string name="textOff">OFF</string>
|
||||||
|
|
||||||
|
<string name="menu_debug">Save Error Logs</string>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
|
@ -1,7 +1,13 @@
|
||||||
package com.reicast.emulator;
|
package com.reicast.emulator;
|
||||||
|
|
||||||
|
import java.io.BufferedReader;
|
||||||
|
import java.io.BufferedWriter;
|
||||||
import java.io.File;
|
import java.io.File;
|
||||||
import java.io.FileOutputStream;
|
import java.io.FileOutputStream;
|
||||||
|
import java.io.FileWriter;
|
||||||
|
import java.io.IOException;
|
||||||
|
import java.io.InputStream;
|
||||||
|
import java.io.InputStreamReader;
|
||||||
import java.util.Scanner;
|
import java.util.Scanner;
|
||||||
|
|
||||||
import org.apache.commons.lang3.StringUtils;
|
import org.apache.commons.lang3.StringUtils;
|
||||||
|
@ -20,13 +26,13 @@ import android.util.Log;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
import android.widget.SeekBar;
|
import android.widget.SeekBar;
|
||||||
import android.widget.SeekBar.OnSeekBarChangeListener;
|
import android.widget.SeekBar.OnSeekBarChangeListener;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
public class ConfigureFragment extends Fragment {
|
public class ConfigureFragment extends Fragment {
|
||||||
|
|
||||||
Activity parentActivity;
|
Activity parentActivity;
|
||||||
|
@ -46,6 +52,21 @@ public class ConfigureFragment extends Fragment {
|
||||||
private File sdcard = Environment.getExternalStorageDirectory();
|
private File sdcard = Environment.getExternalStorageDirectory();
|
||||||
private String home_directory = sdcard + "/dc";
|
private String home_directory = sdcard + "/dc";
|
||||||
|
|
||||||
|
public static final String build_model = android.os.Build.MODEL;
|
||||||
|
public static final String build_device = android.os.Build.DEVICE;
|
||||||
|
public static final String build_board = android.os.Build.BOARD;
|
||||||
|
public static final int build_sdk = android.os.Build.VERSION.SDK_INT;
|
||||||
|
|
||||||
|
public static final String DN = "Donut";
|
||||||
|
public static final String EC = "Eclair";
|
||||||
|
public static final String FR = "Froyo";
|
||||||
|
public static final String GB = "Gingerbread";
|
||||||
|
public static final String HC = "Honeycomb";
|
||||||
|
public static final String IC = "Ice Cream Sandwich";
|
||||||
|
public static final String JB = "JellyBean";
|
||||||
|
public static final String KK = "KitKat";
|
||||||
|
public static final String NF = "Not Found";
|
||||||
|
|
||||||
// Container Activity must implement this interface
|
// Container Activity must implement this interface
|
||||||
public interface OnClickListener {
|
public interface OnClickListener {
|
||||||
public void onMainBrowseSelected(String path_entry, boolean games);
|
public void onMainBrowseSelected(String path_entry, boolean games);
|
||||||
|
@ -321,6 +342,124 @@ public class ConfigureFragment extends Fragment {
|
||||||
pvr_render.setChecked(false);
|
pvr_render.setChecked(false);
|
||||||
}
|
}
|
||||||
pvr_render.setOnCheckedChangeListener(pvr_rendering);*/
|
pvr_render.setOnCheckedChangeListener(pvr_rendering);*/
|
||||||
|
|
||||||
|
Button debug_button = (Button) getView()
|
||||||
|
.findViewById(R.id.debug_button);
|
||||||
|
debug_button.setOnClickListener(new View.OnClickListener() {
|
||||||
|
public void onClick(View v) {
|
||||||
|
generateErrorLog();
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
public void generateErrorLog() {
|
||||||
|
String currentTime = String.valueOf(System.currentTimeMillis());
|
||||||
|
String logOuput = home_directory + "/" + currentTime + ".txt";
|
||||||
|
Process mLogcatProc = null;
|
||||||
|
BufferedReader reader = null;
|
||||||
|
try {
|
||||||
|
mLogcatProc = Runtime.getRuntime().exec(
|
||||||
|
new String[] { "logcat", "-d", "AndroidRuntime:E *:S" });
|
||||||
|
reader = new BufferedReader(new InputStreamReader(
|
||||||
|
mLogcatProc.getInputStream()));
|
||||||
|
String line;
|
||||||
|
final StringBuilder log = new StringBuilder();
|
||||||
|
String separator = System.getProperty("line.separator");
|
||||||
|
log.append(discoverCPUData());
|
||||||
|
log.append(separator);
|
||||||
|
log.append(separator);
|
||||||
|
log.append("AndroidRuntime Output");
|
||||||
|
log.append(separator);
|
||||||
|
log.append(separator);
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
log.append(line);
|
||||||
|
log.append(separator);
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
mLogcatProc = null;
|
||||||
|
reader = null;
|
||||||
|
int PID = android.os.Process
|
||||||
|
.getUidForName("com.reicast.emulator");
|
||||||
|
mLogcatProc = Runtime.getRuntime().exec(
|
||||||
|
new String[] { "logcat", "-d", "|", "grep " + PID });
|
||||||
|
reader = new BufferedReader(new InputStreamReader(
|
||||||
|
mLogcatProc.getInputStream()));
|
||||||
|
log.append(separator);
|
||||||
|
log.append(separator);
|
||||||
|
log.append("Application ID Output");
|
||||||
|
log.append(separator);
|
||||||
|
log.append(separator);
|
||||||
|
while ((line = reader.readLine()) != null) {
|
||||||
|
log.append(line);
|
||||||
|
log.append(separator);
|
||||||
|
}
|
||||||
|
reader.close();
|
||||||
|
File file = new File(logOuput);
|
||||||
|
BufferedWriter writer = new BufferedWriter(new FileWriter(file));
|
||||||
|
writer.write(log.toString());
|
||||||
|
writer.flush();
|
||||||
|
writer.close();
|
||||||
|
} catch (IOException e) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private String discoverCPUData() {
|
||||||
|
String s = "MODEL: " + Build.MODEL;
|
||||||
|
s += "\r\n";
|
||||||
|
s += "DEVICE: " + build_device;
|
||||||
|
s += "\r\n";
|
||||||
|
s += "BOARD: " + build_board;
|
||||||
|
s += "\r\n";
|
||||||
|
if (String.valueOf(build_sdk) != null) {
|
||||||
|
String build_version = NF;
|
||||||
|
if (build_sdk >= 4 && build_sdk < 7) {
|
||||||
|
build_version = DN;
|
||||||
|
} else if (build_sdk == 7) {
|
||||||
|
build_version = EC;
|
||||||
|
} else if (build_sdk == 8) {
|
||||||
|
build_version = FR;
|
||||||
|
} else if (build_sdk >= 9 && build_sdk < 11) {
|
||||||
|
build_version = GB;
|
||||||
|
} else if (build_sdk >= 11 && build_sdk < 14) {
|
||||||
|
build_version = HC;
|
||||||
|
} else if (build_sdk >= 14 && build_sdk < 16) {
|
||||||
|
build_version = IC;
|
||||||
|
} else if (build_sdk >= 16 && build_sdk < 17) {
|
||||||
|
build_version = JB;
|
||||||
|
} else if (build_sdk >= 17) {
|
||||||
|
build_version = KK;
|
||||||
|
}
|
||||||
|
s += build_version + " (" + build_sdk + ")";
|
||||||
|
} else {
|
||||||
|
String prop_build_version = "ro.build.version.release";
|
||||||
|
String prop_sdk_version = "ro.build.version.sdk";
|
||||||
|
String build_version = readOutput("/system/bin/getprop "
|
||||||
|
+ prop_build_version);
|
||||||
|
String sdk_version = readOutput("/system/bin/getprop "
|
||||||
|
+ prop_sdk_version);
|
||||||
|
s += build_version + " (" + sdk_version + ")";
|
||||||
|
}
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static String readOutput(String command) {
|
||||||
|
try {
|
||||||
|
Process p = Runtime.getRuntime().exec(command);
|
||||||
|
InputStream is = null;
|
||||||
|
if (p.waitFor() == 0) {
|
||||||
|
is = p.getInputStream();
|
||||||
|
} else {
|
||||||
|
is = p.getErrorStream();
|
||||||
|
}
|
||||||
|
BufferedReader br = new BufferedReader(new InputStreamReader(is),
|
||||||
|
2048);
|
||||||
|
String line = br.readLine();
|
||||||
|
br.close();
|
||||||
|
return line;
|
||||||
|
} catch (Exception ex) {
|
||||||
|
return "ERROR: " + ex.getMessage();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private boolean executeAppendConfig(String identifier, String value) {
|
private boolean executeAppendConfig(String identifier, String value) {
|
||||||
|
|
|
@ -218,40 +218,6 @@ public class FileBrowser extends Fragment {
|
||||||
}
|
}
|
||||||
|
|
||||||
private void createListHeader(String header_text, View view, boolean hasBios) {
|
private void createListHeader(String header_text, View view, boolean hasBios) {
|
||||||
LinearLayout list_header = new LinearLayout(parentActivity);
|
|
||||||
LinearLayout.LayoutParams listParams = new LinearLayout.LayoutParams(
|
|
||||||
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
|
||||||
int margin_top = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 10, getResources().getDisplayMetrics());
|
|
||||||
listParams.setMargins(0, margin_top, 0, 0);
|
|
||||||
list_header.setLayoutParams(listParams);
|
|
||||||
|
|
||||||
ImageView list_icon = new ImageView(parentActivity);
|
|
||||||
LinearLayout.LayoutParams imageParams = new LinearLayout.LayoutParams(
|
|
||||||
LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT);
|
|
||||||
int size = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 32, getResources().getDisplayMetrics());
|
|
||||||
imageParams.width = size;
|
|
||||||
imageParams.height = size;
|
|
||||||
int margin_left_right = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 6, getResources().getDisplayMetrics());
|
|
||||||
int margin_top_bottom = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, 2, getResources().getDisplayMetrics());
|
|
||||||
imageParams.setMargins(margin_left_right, margin_top_bottom, margin_left_right, margin_top_bottom);
|
|
||||||
imageParams.gravity=Gravity.CENTER_VERTICAL;
|
|
||||||
list_icon.setLayoutParams(imageParams);
|
|
||||||
list_icon.setScaleType(ScaleType.FIT_CENTER);
|
|
||||||
list_icon.setImageResource(R.drawable.open_folder);
|
|
||||||
list_header.addView(list_icon);
|
|
||||||
|
|
||||||
TextView list_text = new TextView(parentActivity);
|
|
||||||
LinearLayout.LayoutParams textParams = new LinearLayout.LayoutParams(
|
|
||||||
LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT);
|
|
||||||
textParams.gravity=Gravity.CENTER_VERTICAL;
|
|
||||||
textParams.weight=1;
|
|
||||||
list_text.setLayoutParams(textParams);
|
|
||||||
list_text.setTextAppearance(parentActivity,
|
|
||||||
android.R.style.TextAppearance_Large);
|
|
||||||
list_text.setTextSize(TypedValue.COMPLEX_UNIT_DIP, 18);
|
|
||||||
list_text.setText(header_text);
|
|
||||||
list_header.addView(list_text);
|
|
||||||
|
|
||||||
if (hasBios) {
|
if (hasBios) {
|
||||||
final View childview = parentActivity.getLayoutInflater().inflate(
|
final View childview = parentActivity.getLayoutInflater().inflate(
|
||||||
R.layout.bios_list_item, null, false);
|
R.layout.bios_list_item, null, false);
|
||||||
|
@ -292,7 +258,13 @@ public class FileBrowser extends Fragment {
|
||||||
((ViewGroup) view).addView(childview);
|
((ViewGroup) view).addView(childview);
|
||||||
}
|
}
|
||||||
|
|
||||||
((ViewGroup) view).addView(list_header);
|
final View headerView = parentActivity.getLayoutInflater().inflate(
|
||||||
|
R.layout.app_list_item, null, false);
|
||||||
|
((ImageView) headerView.findViewById(R.id.item_icon))
|
||||||
|
.setImageResource(R.drawable.open_folder);
|
||||||
|
((TextView) headerView.findViewById(R.id.item_name))
|
||||||
|
.setText(header_text);
|
||||||
|
((ViewGroup) view).addView(headerView);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,7 +304,7 @@ public class FileBrowser extends Fragment {
|
||||||
childview.setTag(list.get(i));
|
childview.setTag(list.get(i));
|
||||||
|
|
||||||
orig_bg = childview.getBackground();
|
orig_bg = childview.getBackground();
|
||||||
|
|
||||||
final File game = list.get(i);
|
final File game = list.get(i);
|
||||||
|
|
||||||
// vw.findViewById(R.id.childview).setBackgroundColor(0xFFFFFFFF);
|
// vw.findViewById(R.id.childview).setBackgroundColor(0xFFFFFFFF);
|
||||||
|
|
|
@ -181,11 +181,18 @@ public class GL2JNIActivity extends Activity {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||||
|
|
||||||
JNIdc.initControllers(new boolean[] {controllerTwoConnected, controllerThreeConnected, controllerFourConnected});
|
JNIdc.initControllers(new boolean[] {controllerTwoConnected, controllerThreeConnected, controllerFourConnected});
|
||||||
|
|
||||||
int joys[] = InputDevice.getDeviceIds();
|
int joys[] = InputDevice.getDeviceIds();
|
||||||
for (int i = 0; i < joys.length; i++) {
|
for (int i = 0; i < joys.length; i++) {
|
||||||
String descriptor = InputDevice.getDevice(joys[i]).getDescriptor();
|
String descriptor = null;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
descriptor = InputDevice.getDevice(joys[i]).getDescriptor();
|
||||||
|
} else {
|
||||||
|
descriptor = InputDevice.getDevice(joys[i]).getName();
|
||||||
|
}
|
||||||
Log.d("reidc", "InputDevice ID: " + joys[i]);
|
Log.d("reidc", "InputDevice ID: " + joys[i]);
|
||||||
Log.d("reidc", "InputDevice Name: "
|
Log.d("reidc", "InputDevice Name: "
|
||||||
+ InputDevice.getDevice(joys[i]).getName());
|
+ InputDevice.getDevice(joys[i]).getName());
|
||||||
|
@ -279,6 +286,9 @@ public class GL2JNIActivity extends Activity {
|
||||||
OuyaController.BUTTON_R1, key_CONT_START };
|
OuyaController.BUTTON_R1, key_CONT_START };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// When viewing a resource, pass its URI to the native code for opening
|
// When viewing a resource, pass its URI to the native code for opening
|
||||||
|
@ -298,6 +308,8 @@ public class GL2JNIActivity extends Activity {
|
||||||
public boolean onGenericMotionEvent(MotionEvent event) {
|
public boolean onGenericMotionEvent(MotionEvent event) {
|
||||||
// Log.w("INPUT", event.toString() + " " + event.getSource());
|
// Log.w("INPUT", event.toString() + " " + event.getSource());
|
||||||
// Get all the axis for the KeyEvent
|
// Get all the axis for the KeyEvent
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||||
|
|
||||||
Integer playerNum = deviceDescriptor_PlayerNum.get(deviceId_deviceDescriptor.get(event.getDeviceId()));
|
Integer playerNum = deviceDescriptor_PlayerNum.get(deviceId_deviceDescriptor.get(event.getDeviceId()));
|
||||||
|
|
||||||
|
@ -330,7 +342,7 @@ public class GL2JNIActivity extends Activity {
|
||||||
GL2JNIView.jx[playerNum] = (int) (LS_X * 126);
|
GL2JNIView.jx[playerNum] = (int) (LS_X * 126);
|
||||||
GL2JNIView.jy[playerNum] = (int) (LS_Y * 126);
|
GL2JNIView.jy[playerNum] = (int) (LS_Y * 126);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((xbox[playerNum] || nVidia[playerNum]) && ((globalLS_X[playerNum] == previousLS_X[playerNum] && globalLS_Y[playerNum] == previousLS_Y[playerNum])
|
if ((xbox[playerNum] || nVidia[playerNum]) && ((globalLS_X[playerNum] == previousLS_X[playerNum] && globalLS_Y[playerNum] == previousLS_Y[playerNum])
|
||||||
|
@ -340,6 +352,11 @@ public class GL2JNIActivity extends Activity {
|
||||||
return false;
|
return false;
|
||||||
else
|
else
|
||||||
return true;
|
return true;
|
||||||
|
|
||||||
|
} else {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private static final int key_CONT_B = 0x0002;
|
private static final int key_CONT_B = 0x0002;
|
||||||
|
|
|
@ -20,11 +20,11 @@ import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.CompoundButton;
|
import android.widget.CompoundButton;
|
||||||
|
import android.widget.TableLayout;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
import android.widget.CompoundButton.OnCheckedChangeListener;
|
import android.widget.CompoundButton.OnCheckedChangeListener;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
public class InputFragment extends Fragment {
|
public class InputFragment extends Fragment {
|
||||||
|
|
||||||
private Activity parentActivity;
|
private Activity parentActivity;
|
||||||
|
@ -76,70 +76,80 @@ public class InputFragment extends Fragment {
|
||||||
switchTouchVibrationEnabled.setChecked(false);
|
switchTouchVibrationEnabled.setChecked(false);
|
||||||
}
|
}
|
||||||
switchTouchVibrationEnabled.setOnCheckedChangeListener(touch_vibration);
|
switchTouchVibrationEnabled.setOnCheckedChangeListener(touch_vibration);
|
||||||
|
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
||||||
|
|
||||||
Button buttonSelectControllerPlayer1 = (Button) getView()
|
Button buttonSelectControllerPlayer1 = (Button) getView()
|
||||||
.findViewById(R.id.buttonSelectControllerPlayer1);
|
.findViewById(R.id.buttonSelectControllerPlayer1);
|
||||||
buttonSelectControllerPlayer1.setOnClickListener(new View.OnClickListener() {
|
buttonSelectControllerPlayer1.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
selectController(1);
|
selectController(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Button buttonSelectControllerPlayer2 = (Button) getView()
|
Button buttonSelectControllerPlayer2 = (Button) getView()
|
||||||
.findViewById(R.id.buttonSelectControllerPlayer2);
|
.findViewById(R.id.buttonSelectControllerPlayer2);
|
||||||
buttonSelectControllerPlayer2.setOnClickListener(new View.OnClickListener() {
|
buttonSelectControllerPlayer2.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
selectController(2);
|
selectController(2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Button buttonSelectControllerPlayer3 = (Button) getView()
|
Button buttonSelectControllerPlayer3 = (Button) getView()
|
||||||
.findViewById(R.id.buttonSelectControllerPlayer3);
|
.findViewById(R.id.buttonSelectControllerPlayer3);
|
||||||
buttonSelectControllerPlayer3.setOnClickListener(new View.OnClickListener() {
|
buttonSelectControllerPlayer3.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
selectController(3);
|
selectController(3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
Button buttonSelectControllerPlayer4 = (Button) getView()
|
Button buttonSelectControllerPlayer4 = (Button) getView()
|
||||||
.findViewById(R.id.buttonSelectControllerPlayer4);
|
.findViewById(R.id.buttonSelectControllerPlayer4);
|
||||||
buttonSelectControllerPlayer4.setOnClickListener(new View.OnClickListener() {
|
buttonSelectControllerPlayer4.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
selectController(4);
|
selectController(4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button buttonRemoveControllerPlayer1 = (Button) getView()
|
Button buttonRemoveControllerPlayer1 = (Button) getView()
|
||||||
.findViewById(R.id.buttonRemoveControllerPlayer1);
|
.findViewById(R.id.buttonRemoveControllerPlayer1);
|
||||||
buttonRemoveControllerPlayer1.setOnClickListener(new View.OnClickListener() {
|
buttonRemoveControllerPlayer1.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
removeController(1);
|
removeController(1);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button buttonRemoveControllerPlayer2 = (Button) getView()
|
Button buttonRemoveControllerPlayer2 = (Button) getView()
|
||||||
.findViewById(R.id.buttonRemoveControllerPlayer2);
|
.findViewById(R.id.buttonRemoveControllerPlayer2);
|
||||||
buttonRemoveControllerPlayer2.setOnClickListener(new View.OnClickListener() {
|
buttonRemoveControllerPlayer2.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
removeController(2);
|
removeController(2);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button buttonRemoveControllerPlayer3 = (Button) getView()
|
Button buttonRemoveControllerPlayer3 = (Button) getView()
|
||||||
.findViewById(R.id.buttonRemoveControllerPlayer3);
|
.findViewById(R.id.buttonRemoveControllerPlayer3);
|
||||||
buttonRemoveControllerPlayer3.setOnClickListener(new View.OnClickListener() {
|
buttonRemoveControllerPlayer3.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
removeController(3);
|
removeController(3);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
Button buttonRemoveControllerPlayer4 = (Button) getView()
|
Button buttonRemoveControllerPlayer4 = (Button) getView()
|
||||||
.findViewById(R.id.buttonRemoveControllerPlayer4);
|
.findViewById(R.id.buttonRemoveControllerPlayer4);
|
||||||
buttonRemoveControllerPlayer4.setOnClickListener(new View.OnClickListener() {
|
buttonRemoveControllerPlayer4.setOnClickListener(new View.OnClickListener() {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
removeController(4);
|
removeController(4);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
updateControllers();
|
||||||
|
|
||||||
|
} else {
|
||||||
|
|
||||||
|
TableLayout input_devices = (TableLayout) parentActivity.findViewById(R.id.input_devices);
|
||||||
|
input_devices.setVisibility(View.GONE);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
updateVibration();
|
updateVibration();
|
||||||
updateControllers();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateVibration() {
|
private void updateVibration() {
|
||||||
|
@ -157,7 +167,12 @@ public class InputFragment extends Fragment {
|
||||||
|
|
||||||
for (int devideId : InputDevice.getDeviceIds()) {
|
for (int devideId : InputDevice.getDeviceIds()) {
|
||||||
InputDevice dev = InputDevice.getDevice(devideId);
|
InputDevice dev = InputDevice.getDevice(devideId);
|
||||||
String descriptor = dev.getDescriptor();
|
String descriptor = null;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
descriptor = dev.getDescriptor();
|
||||||
|
} else {
|
||||||
|
descriptor = dev.getName();
|
||||||
|
}
|
||||||
|
|
||||||
if (descriptor != null) {
|
if (descriptor != null) {
|
||||||
if (descriptor.equals(deviceDescriptorPlayer1))
|
if (descriptor.equals(deviceDescriptorPlayer1))
|
||||||
|
@ -266,7 +281,14 @@ public class InputFragment extends Fragment {
|
||||||
keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
keyCode == KeyEvent.KEYCODE_VOLUME_UP || keyCode == KeyEvent.KEYCODE_VOLUME_DOWN)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
String descriptor = InputDevice.getDevice(event.getDeviceId()).getDescriptor();
|
String descriptor = null;
|
||||||
|
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) {
|
||||||
|
descriptor = InputDevice.getDevice(event.getDeviceId())
|
||||||
|
.getDescriptor();
|
||||||
|
} else {
|
||||||
|
descriptor = InputDevice.getDevice(event.getDeviceId())
|
||||||
|
.getName();
|
||||||
|
}
|
||||||
|
|
||||||
if (descriptor == null)
|
if (descriptor == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -30,6 +30,7 @@ import android.view.View;
|
||||||
import android.view.View.OnClickListener;
|
import android.view.View.OnClickListener;
|
||||||
import android.view.View.OnTouchListener;
|
import android.view.View.OnTouchListener;
|
||||||
import android.widget.AdapterView;
|
import android.widget.AdapterView;
|
||||||
|
import android.widget.ImageView;
|
||||||
import android.widget.ListView;
|
import android.widget.ListView;
|
||||||
|
|
||||||
public class MainActivity extends FragmentActivity implements
|
public class MainActivity extends FragmentActivity implements
|
||||||
|
@ -154,6 +155,7 @@ public class MainActivity extends FragmentActivity implements
|
||||||
// icons
|
// icons
|
||||||
invalidateOptionsMenu();
|
invalidateOptionsMenu();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("NewApi")
|
@SuppressLint("NewApi")
|
||||||
public void onDrawerOpened(View drawerView) {
|
public void onDrawerOpened(View drawerView) {
|
||||||
getActionBar().setTitle(mDrawerTitle);
|
getActionBar().setTitle(mDrawerTitle);
|
||||||
|
@ -169,6 +171,25 @@ public class MainActivity extends FragmentActivity implements
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
|
findViewById(R.id.config).setOnClickListener(new OnClickListener() {
|
||||||
|
public void onClick(View view) {
|
||||||
|
ConfigureFragment configFrag = (ConfigureFragment) getSupportFragmentManager()
|
||||||
|
.findFragmentByTag("CONFIG_FRAG");
|
||||||
|
if (configFrag != null) {
|
||||||
|
if (configFrag.isVisible()) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
configFrag = new ConfigureFragment();
|
||||||
|
getSupportFragmentManager()
|
||||||
|
.beginTransaction()
|
||||||
|
.replace(R.id.fragment_container, configFrag,
|
||||||
|
"CONFIG_FRAG").addToBackStack(null)
|
||||||
|
.commit();
|
||||||
|
}
|
||||||
|
|
||||||
|
});
|
||||||
|
|
||||||
findViewById(R.id.options).setOnClickListener(
|
findViewById(R.id.options).setOnClickListener(
|
||||||
new OnClickListener() {
|
new OnClickListener() {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
@ -185,45 +206,24 @@ public class MainActivity extends FragmentActivity implements
|
||||||
.replace(R.id.fragment_container,
|
.replace(R.id.fragment_container,
|
||||||
optionsFrag, "OPTIONS_FRAG")
|
optionsFrag, "OPTIONS_FRAG")
|
||||||
.addToBackStack(null).commit();
|
.addToBackStack(null).commit();
|
||||||
/*
|
|
||||||
* AlertDialog.Builder alertDialogBuilder = new
|
|
||||||
* AlertDialog.Builder( MainActivity.this);
|
|
||||||
*
|
|
||||||
* // set title
|
|
||||||
* alertDialogBuilder.setTitle("Configure");
|
|
||||||
*
|
|
||||||
* // set dialog message alertDialogBuilder
|
|
||||||
* .setMessage("No configuration for now :D")
|
|
||||||
* .setCancelable(false)
|
|
||||||
* .setPositiveButton("Oh well",new
|
|
||||||
* DialogInterface.OnClickListener() { public void
|
|
||||||
* onClick(DialogInterface dialog,int id) {
|
|
||||||
* //FileBrowser.this.finish(); } });
|
|
||||||
*
|
|
||||||
* // create alert dialog AlertDialog alertDialog =
|
|
||||||
* alertDialogBuilder.create();
|
|
||||||
*
|
|
||||||
* // show it alertDialog.show();
|
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
findViewById(R.id.config).setOnClickListener(new OnClickListener() {
|
findViewById(R.id.input).setOnClickListener(new OnClickListener() {
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
ConfigureFragment configFrag = (ConfigureFragment) getSupportFragmentManager()
|
InputFragment inputFrag = (InputFragment) getSupportFragmentManager()
|
||||||
.findFragmentByTag("CONFIG_FRAG");
|
.findFragmentByTag("INPUT_FRAG");
|
||||||
if (configFrag != null) {
|
if (inputFrag != null) {
|
||||||
if (configFrag.isVisible()) {
|
if (inputFrag.isVisible()) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
configFrag = new ConfigureFragment();
|
inputFrag = new InputFragment();
|
||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.fragment_container, configFrag,
|
.replace(R.id.fragment_container, inputFrag,
|
||||||
"CONFIG_FRAG").addToBackStack(null)
|
"INPUT_FRAG").addToBackStack(null).commit();
|
||||||
.commit();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
});
|
});
|
||||||
|
@ -295,7 +295,7 @@ public class MainActivity extends FragmentActivity implements
|
||||||
int id) {
|
int id) {
|
||||||
// if this button is clicked, close
|
// if this button is clicked, close
|
||||||
// current activity
|
// current activity
|
||||||
//MainActivity.this.finish();
|
// MainActivity.this.finish();
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
.setNegativeButton("Options",
|
.setNegativeButton("Options",
|
||||||
|
@ -304,22 +304,31 @@ public class MainActivity extends FragmentActivity implements
|
||||||
int id) {
|
int id) {
|
||||||
FileBrowser firstFragment = new FileBrowser();
|
FileBrowser firstFragment = new FileBrowser();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
//args.putBoolean("ImgBrowse", false);
|
// args.putBoolean("ImgBrowse", false);
|
||||||
// specify ImgBrowse option. true = images, false = folders only
|
// specify ImgBrowse option. true = images,
|
||||||
args.putString("browse_entry", sdcard.toString());
|
// false = folders only
|
||||||
// specify a path for selecting folder options
|
args.putString("browse_entry",
|
||||||
|
sdcard.toString());
|
||||||
|
// specify a path for selecting folder
|
||||||
|
// options
|
||||||
args.putBoolean("games_entry", false);
|
args.putBoolean("games_entry", false);
|
||||||
// selecting a BIOS folder, so this is not games
|
// selecting a BIOS folder, so this is not
|
||||||
|
// games
|
||||||
|
|
||||||
firstFragment.setArguments(args);
|
firstFragment.setArguments(args);
|
||||||
// In case this activity was started with special instructions from
|
// In case this activity was started with
|
||||||
// an Intent, pass the Intent's extras to the fragment as arguments
|
// special instructions from
|
||||||
|
// an Intent, pass the Intent's extras to
|
||||||
|
// the fragment as arguments
|
||||||
// firstFragment.setArguments(getIntent().getExtras());
|
// firstFragment.setArguments(getIntent().getExtras());
|
||||||
|
|
||||||
// Add the fragment to the 'fragment_container' FrameLayout
|
// Add the fragment to the
|
||||||
|
// 'fragment_container' FrameLayout
|
||||||
getSupportFragmentManager()
|
getSupportFragmentManager()
|
||||||
.beginTransaction()
|
.beginTransaction()
|
||||||
.replace(R.id.fragment_container, firstFragment, "MAIN_BROWSER")
|
.replace(R.id.fragment_container,
|
||||||
|
firstFragment,
|
||||||
|
"MAIN_BROWSER")
|
||||||
.addToBackStack(null).commit();
|
.addToBackStack(null).commit();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
@ -329,10 +338,9 @@ public class MainActivity extends FragmentActivity implements
|
||||||
|
|
||||||
// show it
|
// show it
|
||||||
alertDialog.show();
|
alertDialog.show();
|
||||||
}
|
} else {
|
||||||
else {
|
|
||||||
Intent inte = new Intent(Intent.ACTION_VIEW, uri, getBaseContext(),
|
Intent inte = new Intent(Intent.ACTION_VIEW, uri, getBaseContext(),
|
||||||
GL2JNIActivity.class);
|
GL2JNIActivity.class);
|
||||||
startActivity(inte);
|
startActivity(inte);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,15 +12,12 @@ import android.preference.PreferenceManager;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
import android.text.Editable;
|
import android.text.Editable;
|
||||||
import android.text.TextWatcher;
|
import android.text.TextWatcher;
|
||||||
import android.util.Log;
|
|
||||||
import android.view.InputDevice;
|
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.ViewGroup;
|
import android.view.ViewGroup;
|
||||||
import android.widget.Button;
|
import android.widget.Button;
|
||||||
import android.widget.EditText;
|
import android.widget.EditText;
|
||||||
|
|
||||||
@TargetApi(Build.VERSION_CODES.JELLY_BEAN)
|
|
||||||
public class OptionsFragment extends Fragment {
|
public class OptionsFragment extends Fragment {
|
||||||
|
|
||||||
Activity parentActivity;
|
Activity parentActivity;
|
||||||
|
@ -51,16 +48,6 @@ public class OptionsFragment extends Fragment {
|
||||||
throw new ClassCastException(activity.toString()
|
throw new ClassCastException(activity.toString()
|
||||||
+ " must implement OnClickListener");
|
+ " must implement OnClickListener");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD) {
|
|
||||||
int joys[] = InputDevice.getDeviceIds();
|
|
||||||
for (int i = 0; i < joys.length; i++) {
|
|
||||||
Log.d("reidc", "InputDevice ID: " + joys[i]);
|
|
||||||
Log.d("reidc",
|
|
||||||
"InputDevice Name: "
|
|
||||||
+ InputDevice.getDevice(joys[i]).getName());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue