From a33eb1dc77134e1a1e3712f3c6873bdc99987328 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 05:42:23 -0500 Subject: [PATCH 1/7] Notify about data folder being implied, Despite the summary --- shell/android/res/values/strings.xml | 1 + .../src/com/reicast/emulator/config/OptionsFragment.java | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml index ce14a1565..215743c28 100644 --- a/shell/android/res/values/strings.xml +++ b/shell/android/res/values/strings.xml @@ -11,6 +11,7 @@ BIOS Missing. The Dreamcast BIOS is required for this emulator to work. Place the BIOS file in %1$s/data/dc_boot.bin Flash Missing. The Dreamcast Flash is required for this emulator to work. Place the Flash file in %1$s/data/dc_flash.bin You have to provide the BIOS + The data folder is assumed BOOT BIOS SELECT CURRENT FOLDER diff --git a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java index 5b9f0a141..35f2d9ff9 100644 --- a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java +++ b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java @@ -15,6 +15,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.Button; import android.widget.EditText; +import android.widget.Toast; import com.reicast.emulator.R; @@ -86,6 +87,12 @@ public class OptionsFragment extends Fragment { public void afterTextChanged(Editable s) { if (editBrowse.getText() != null) { home_directory = editBrowse.getText().toString(); + if (home_directory.endsWith("/data")) { + home_directory.replace("/data", ""); + Toast.makeText(parentActivity, + parentActivity.getText(R.string.data_folder), + Toast.LENGTH_SHORT).show(); + } mPrefs.edit().putString("home_directory", home_directory) .commit(); } From 4c034740eacb17321bc83a848938c791d24549d0 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 22:48:36 -0500 Subject: [PATCH 2/7] Reference strings over hardcoded text, More documentation --- README.md | 10 ++++++++-- shell/android/jni/Application.mk | 4 ++-- shell/android/res/values/strings.xml | 2 ++ .../android/src/com/reicast/emulator/FileBrowser.java | 4 ++-- .../src/com/reicast/emulator/GL2JNIActivity.java | 1 - .../android/src/com/reicast/emulator/GL2JNINative.java | 1 - .../com/reicast/emulator/config/EditVJoyActivity.java | 4 ---- .../src/com/reicast/emulator/config/InputFragment.java | 3 +-- .../com/reicast/emulator/config/OptionsFragment.java | 3 +-- shell/android/xperia/jni/Application.mk | 2 +- 10 files changed, 17 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 588100694..ec9b22658 100644 --- a/README.md +++ b/README.md @@ -19,9 +19,15 @@ Let's try to keep everything under a single project :) To build for android -------------------- Tools required: -* Latest Android SDK and NDK -* Android 4.4 (API 19) or newer (http://developer.android.com/sdk/installing/adding-packages.html) +* Latest Android SDK + - http://developer.android.com/sdk/index.html +* NDK r8b or newer + - https://developer.android.com/tools/sdk/ndk/index.html + - If using r9c+, it is recommended you uncomment the "NDK_TOOLCHAIN_VERSION := 4.8" in shell/android/jni/Application.mk and shell/android/xperia/jni/Application.mk +* Android 4.4 (API 19) + - http://developer.android.com/sdk/installing/adding-packages.html * Ant + - http://ant.apache.org/ From project root directory: ``` diff --git a/shell/android/jni/Application.mk b/shell/android/jni/Application.mk index 8d449d9be..5ab713430 100644 --- a/shell/android/jni/Application.mk +++ b/shell/android/jni/Application.mk @@ -1,5 +1,5 @@ APP_STL := stlport_static #APP_ABI := armeabi-v7a x86 APP_ABI := armeabi-v7a -APP_PLATFORM := android-18 -NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file +APP_PLATFORM := android-19 +#NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml index 215743c28..0b2832182 100644 --- a/shell/android/res/values/strings.xml +++ b/shell/android/res/values/strings.xml @@ -6,6 +6,8 @@ Default System Path Storage Path (location of .gdi, .chd or .cdi images) Default Game Storage + Please configure a home directory + Please configure a games directory Boot Dreamcast Bios BIOS Missing. The Dreamcast BIOS is required for this emulator to work. Place the BIOS file in %1$s/data/dc_boot.bin diff --git a/shell/android/src/com/reicast/emulator/FileBrowser.java b/shell/android/src/com/reicast/emulator/FileBrowser.java index 7eb7336b2..08af1323c 100644 --- a/shell/android/src/com/reicast/emulator/FileBrowser.java +++ b/shell/android/src/com/reicast/emulator/FileBrowser.java @@ -148,7 +148,7 @@ public class FileBrowser extends Fragment { File home = new File(home_directory); if (!home.exists() || !home.isDirectory()) { - Toast.makeText(getActivity(), "Please configure a home directory", + Toast.makeText(getActivity(), R.string.config_home, Toast.LENGTH_LONG).show(); } @@ -217,7 +217,7 @@ public class FileBrowser extends Fragment { createListItem(list, games.get(i)); } } else { - Toast.makeText(parentActivity, "Please configure a games directory", + Toast.makeText(parentActivity, R.string.config_game, Toast.LENGTH_LONG).show(); } list.invalidate(); diff --git a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java index c8d4feb96..64b9b9395 100644 --- a/shell/android/src/com/reicast/emulator/GL2JNIActivity.java +++ b/shell/android/src/com/reicast/emulator/GL2JNIActivity.java @@ -23,7 +23,6 @@ import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.widget.LinearLayout; import android.widget.PopupWindow; -import android.widget.Toast; import com.reicast.emulator.config.Config; import com.reicast.emulator.emu.GL2JNIView; diff --git a/shell/android/src/com/reicast/emulator/GL2JNINative.java b/shell/android/src/com/reicast/emulator/GL2JNINative.java index 342edbb62..fc4750536 100644 --- a/shell/android/src/com/reicast/emulator/GL2JNINative.java +++ b/shell/android/src/com/reicast/emulator/GL2JNINative.java @@ -23,7 +23,6 @@ import android.view.ViewGroup.LayoutParams; import android.view.Window; import android.widget.LinearLayout; import android.widget.PopupWindow; -import android.widget.Toast; import com.reicast.emulator.config.Config; import com.reicast.emulator.emu.GL2JNIView; diff --git a/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java b/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java index b27fe0902..87ca455e4 100644 --- a/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java +++ b/shell/android/src/com/reicast/emulator/config/EditVJoyActivity.java @@ -18,7 +18,6 @@ import android.widget.ImageButton; import android.widget.ImageView.ScaleType; import android.widget.LinearLayout; import android.widget.PopupWindow; -import android.widget.Toast; import com.reicast.emulator.MainActivity; import com.reicast.emulator.R; @@ -70,9 +69,6 @@ public class EditVJoyActivity extends Activity { vjoy_d_cached = VJoy.readCustomVjoyValues(getApplicationContext()); JNIdc.show_osd(); - - Toast.makeText(getApplicationContext(), - "Press the back button for a menu", Toast.LENGTH_SHORT).show(); } @Override diff --git a/shell/android/src/com/reicast/emulator/config/InputFragment.java b/shell/android/src/com/reicast/emulator/config/InputFragment.java index 89526ac54..3b91eccdb 100644 --- a/shell/android/src/com/reicast/emulator/config/InputFragment.java +++ b/shell/android/src/com/reicast/emulator/config/InputFragment.java @@ -416,8 +416,7 @@ public class InputFragment extends Fragment { || descriptor.equals(deviceDescriptorPlayer2) || descriptor.equals(deviceDescriptorPlayer3) || descriptor.equals(deviceDescriptorPlayer4)) { - Toast.makeText(parentActivity, - getString(R.string.controller_already_in_use), + Toast.makeText(parentActivity, R.string.controller_already_in_use, Toast.LENGTH_SHORT).show(); return true; } diff --git a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java index 35f2d9ff9..0b1d752fa 100644 --- a/shell/android/src/com/reicast/emulator/config/OptionsFragment.java +++ b/shell/android/src/com/reicast/emulator/config/OptionsFragment.java @@ -89,8 +89,7 @@ public class OptionsFragment extends Fragment { home_directory = editBrowse.getText().toString(); if (home_directory.endsWith("/data")) { home_directory.replace("/data", ""); - Toast.makeText(parentActivity, - parentActivity.getText(R.string.data_folder), + Toast.makeText(parentActivity, R.string.data_folder, Toast.LENGTH_SHORT).show(); } mPrefs.edit().putString("home_directory", home_directory) diff --git a/shell/android/xperia/jni/Application.mk b/shell/android/xperia/jni/Application.mk index 7f414647d..db4dd562f 100644 --- a/shell/android/xperia/jni/Application.mk +++ b/shell/android/xperia/jni/Application.mk @@ -1,4 +1,4 @@ #APP_ABI := armeabi-v7a x86 APP_ABI := armeabi-v7a APP_PLATFORM := android-9 -NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file +#NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file From 2f902ed5e2d83a27d7be5af22d2e58d2458c7637 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 23:24:08 -0500 Subject: [PATCH 3/7] Notify users of an unsupported kernel, Pending version ID --- shell/android/res/values/donottranslate.xml | 2 + shell/android/res/values/strings.xml | 1 + .../com/reicast/emulator/MainActivity.java | 148 +++++++++--------- 3 files changed, 80 insertions(+), 71 deletions(-) diff --git a/shell/android/res/values/donottranslate.xml b/shell/android/res/values/donottranslate.xml index 1af369859..217d3e95f 100644 --- a/shell/android/res/values/donottranslate.xml +++ b/shell/android/res/values/donottranslate.xml @@ -7,6 +7,8 @@ https://github.com/reicast/reicast-emulator/issues/ http://twisted.dyndns.tv:3194/ReicastBot/report/submit.php + + 16 24 diff --git a/shell/android/res/values/strings.xml b/shell/android/res/values/strings.xml index 0b2832182..72cb6e40f 100644 --- a/shell/android/res/values/strings.xml +++ b/shell/android/res/values/strings.xml @@ -8,6 +8,7 @@ Default Game Storage Please configure a home directory Please configure a games directory + Unsupported Kernel Version! Boot Dreamcast Bios BIOS Missing. The Dreamcast BIOS is required for this emulator to work. Place the BIOS file in %1$s/data/dc_boot.bin diff --git a/shell/android/src/com/reicast/emulator/MainActivity.java b/shell/android/src/com/reicast/emulator/MainActivity.java index 6064680be..bbf997b19 100644 --- a/shell/android/src/com/reicast/emulator/MainActivity.java +++ b/shell/android/src/com/reicast/emulator/MainActivity.java @@ -27,6 +27,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.View.OnTouchListener; import android.widget.TextView; +import android.widget.Toast; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu; import com.jeremyfeinstein.slidingmenu.lib.SlidingMenu.OnOpenListener; @@ -347,79 +348,84 @@ public class MainActivity extends SlidingFragmentActivity implements } public void onGameSelected(Uri uri) { - String msg = null; - if (!isBiosExisting()) - msg = getString(R.string.missing_bios, home_directory); - else if (!isFlashExisting()) - msg = getString(R.string.missing_flash, home_directory); - - if (msg != null) { - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( - this); - - // set title - alertDialogBuilder.setTitle("You have to provide the BIOS"); - - // set dialog message - alertDialogBuilder - .setMessage(msg) - .setCancelable(false) - .setPositiveButton("Dismiss", - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int id) { - // if this button is clicked, close - // current activity - // MainActivity.this.finish(); - } - }) - .setNegativeButton("Options", - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int id) { - FileBrowser firstFragment = new FileBrowser(); - Bundle args = new Bundle(); - // args.putBoolean("ImgBrowse", false); - // specify ImgBrowse option. true = images, - // false = folders only - args.putString("browse_entry", - sdcard.toString()); - // specify a path for selecting folder - // options - args.putBoolean("games_entry", false); - // selecting a BIOS folder, so this is not - // games - - firstFragment.setArguments(args); - // In case this activity was started with - // special instructions from - // an Intent, pass the Intent's extras to - // the fragment as arguments - // firstFragment.setArguments(getIntent().getExtras()); - - // Add the fragment to the - // 'fragment_container' FrameLayout - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.fragment_container, - firstFragment, - "MAIN_BROWSER") - .addToBackStack(null).commit(); - } - }); - - // create alert dialog - AlertDialog alertDialog = alertDialogBuilder.create(); - - // show it - alertDialog.show(); + if (GenerateLogs.readOutput("uname -a").equals(getString(R.string.error_kernel))) { + Toast.makeText(MainActivity.this, R.string.unsupported, + Toast.LENGTH_SHORT).show(); } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && !Config.nonative) { - startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), - GL2JNINative.class)); + String msg = null; + if (!isBiosExisting()) + msg = getString(R.string.missing_bios, home_directory); + else if (!isFlashExisting()) + msg = getString(R.string.missing_flash, home_directory); + + if (msg != null) { + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( + this); + + // set title + alertDialogBuilder.setTitle("You have to provide the BIOS"); + + // set dialog message + alertDialogBuilder + .setMessage(msg) + .setCancelable(false) + .setPositiveButton("Dismiss", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int id) { + // if this button is clicked, close + // current activity + // MainActivity.this.finish(); + } + }) + .setNegativeButton("Options", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int id) { + FileBrowser firstFragment = new FileBrowser(); + Bundle args = new Bundle(); + // args.putBoolean("ImgBrowse", false); + // specify ImgBrowse option. true = images, + // false = folders only + args.putString("browse_entry", + sdcard.toString()); + // specify a path for selecting folder + // options + args.putBoolean("games_entry", false); + // selecting a BIOS folder, so this is not + // games + + firstFragment.setArguments(args); + // In case this activity was started with + // special instructions from + // an Intent, pass the Intent's extras to + // the fragment as arguments + // firstFragment.setArguments(getIntent().getExtras()); + + // Add the fragment to the + // 'fragment_container' FrameLayout + getSupportFragmentManager() + .beginTransaction() + .replace(R.id.fragment_container, + firstFragment, + "MAIN_BROWSER") + .addToBackStack(null).commit(); + } + }); + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + // show it + alertDialog.show(); } else { - startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), - GL2JNIActivity.class)); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && !Config.nonative) { + startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), + GL2JNINative.class)); + } else { + startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), + GL2JNIActivity.class)); + } } } } From 843d667740978b04008d6eb4369db4521206bf36 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 23:36:37 -0500 Subject: [PATCH 4/7] Clean up the Moga interface to begin diagnosing breakage --- .../reicast/emulator/periph/MOGAInput.java | 71 ++++++++++++------- 1 file changed, 46 insertions(+), 25 deletions(-) diff --git a/shell/android/src/com/reicast/emulator/periph/MOGAInput.java b/shell/android/src/com/reicast/emulator/periph/MOGAInput.java index 7d067c4de..ecd9659f5 100644 --- a/shell/android/src/com/reicast/emulator/periph/MOGAInput.java +++ b/shell/android/src/com/reicast/emulator/periph/MOGAInput.java @@ -3,8 +3,11 @@ package com.reicast.emulator.periph; /******************************************************************************/ +import java.util.Arrays; + import android.app.Activity; import android.content.SharedPreferences; +import android.os.Build; import android.os.Handler; import android.preference.PreferenceManager; import android.widget.Toast; @@ -137,46 +140,64 @@ public class MOGAInput // Handled by the primary controller interface } - public void onStateEvent(StateEvent event) - { - Integer playerNum = pad.deviceDescriptor_PlayerNum.get(pad.deviceId_deviceDescriptor.get(event.getControllerId())); + private void getCompatibilityMap(int playerNum, String id) { + pad.name[playerNum] = prefs.getInt("controller" + id, -1); + if (pad.name[playerNum] != -1) { + pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs); + } + } - if (playerNum == null) - return; + private void initJoyStickLayout(int playerNum) { + pad.globalLS_X[playerNum] = pad.previousLS_X[playerNum] = 0.0f; + pad.globalLS_Y[playerNum] = pad.previousLS_Y[playerNum] = 0.0f; + } - if(playerNum == 0) - JNIdc.hide_osd(); - + private void notifyMogaConnected(final String notify, int playerNum) { String id = pad.portId[playerNum]; pad.custom[playerNum] = prefs.getBoolean("modified_key_layout" + id, false); + pad.compat[playerNum] = prefs.getBoolean("controller_compat" + id, false); + pad.joystick[playerNum] = prefs.getBoolean("separate_joystick" + id, false); + pad.isActiveMoga[playerNum] = true; + if (pad.compat[playerNum]) { + getCompatibilityMap(playerNum, id); + } else if (pad.custom[playerNum]) { + pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs); + } else { + pad.map[playerNum] = pad.getMogaController(); + } + initJoyStickLayout(playerNum); + handler.post(new Runnable() { + public void run() { + Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show(); + } + }); + } + + public void onStateEvent(StateEvent event) + { + Integer playerNum = Arrays.asList(pad.name).indexOf(event.getControllerId()); + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && playerNum == -1) { + playerNum = pad.deviceDescriptor_PlayerNum + .get(pad.deviceId_deviceDescriptor.get(event.getControllerId())); + } else { + playerNum = -1; + } + + if (playerNum == null || playerNum == -1) { + return; + } if (event.getState() == StateEvent.STATE_CONNECTION && event.getAction() == ACTION_CONNECTED) { int mControllerVersion = mController.getState(Controller.STATE_CURRENT_PRODUCT_VERSION); if (mControllerVersion == Controller.ACTION_VERSION_MOGAPRO) { - pad.isActiveMoga[playerNum] = true; pad.isMogaPro[playerNum] = true; - if (pad.custom[playerNum]) { - pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs); - } else { - pad.map[playerNum] = pad.getMogaController(); - } notify = act.getApplicationContext().getString(R.string.moga_pro_connect); } else if (mControllerVersion == Controller.ACTION_VERSION_MOGA) { - pad.isActiveMoga[playerNum] = true; pad.isMogaPro[playerNum] = false; - if (pad.custom[playerNum]) { - pad.map[playerNum] = pad.setModifiedKeys(id, playerNum, prefs); - } else { - pad.map[playerNum] = pad.getMogaController(); - } notify = act.getApplicationContext().getString(R.string.moga_connect); } if (notify != null && !notify.equals(null)) { - handler.post(new Runnable() { - public void run() { - Toast.makeText(act.getApplicationContext(), notify, Toast.LENGTH_SHORT).show(); - } - }); + notifyMogaConnected(notify, playerNum); } } } From ee88660820e8f49a3b757942c972b7541eaf196f Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 23:40:06 -0500 Subject: [PATCH 5/7] Add the controller interface platform to the readme as well --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index ec9b22658..a2d1b6712 100644 --- a/README.md +++ b/README.md @@ -24,7 +24,7 @@ Tools required: * NDK r8b or newer - https://developer.android.com/tools/sdk/ndk/index.html - If using r9c+, it is recommended you uncomment the "NDK_TOOLCHAIN_VERSION := 4.8" in shell/android/jni/Application.mk and shell/android/xperia/jni/Application.mk -* Android 4.4 (API 19) +* Android 4.4 (API 19) & Android 2.3.1 (API 9) - http://developer.android.com/sdk/installing/adding-packages.html * Ant - http://ant.apache.org/ From 8047074982a01cf860b6f118201328bd07189f3e Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 23:44:31 -0500 Subject: [PATCH 6/7] Let them reboot if they ignore the warning. At least we tried --- .../com/reicast/emulator/MainActivity.java | 142 +++++++++--------- 1 file changed, 70 insertions(+), 72 deletions(-) diff --git a/shell/android/src/com/reicast/emulator/MainActivity.java b/shell/android/src/com/reicast/emulator/MainActivity.java index bbf997b19..6a71452e9 100644 --- a/shell/android/src/com/reicast/emulator/MainActivity.java +++ b/shell/android/src/com/reicast/emulator/MainActivity.java @@ -4,7 +4,6 @@ import java.io.File; import java.lang.Thread.UncaughtExceptionHandler; import java.util.List; -import tv.ouya.console.api.OuyaFacade; import android.annotation.SuppressLint; import android.app.AlertDialog; import android.content.DialogInterface; @@ -351,81 +350,80 @@ public class MainActivity extends SlidingFragmentActivity implements if (GenerateLogs.readOutput("uname -a").equals(getString(R.string.error_kernel))) { Toast.makeText(MainActivity.this, R.string.unsupported, Toast.LENGTH_SHORT).show(); - } else { - String msg = null; - if (!isBiosExisting()) - msg = getString(R.string.missing_bios, home_directory); - else if (!isFlashExisting()) - msg = getString(R.string.missing_flash, home_directory); + } + String msg = null; + if (!isBiosExisting()) + msg = getString(R.string.missing_bios, home_directory); + else if (!isFlashExisting()) + msg = getString(R.string.missing_flash, home_directory); - if (msg != null) { - AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( - this); + if (msg != null) { + AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder( + this); - // set title - alertDialogBuilder.setTitle("You have to provide the BIOS"); + // set title + alertDialogBuilder.setTitle("You have to provide the BIOS"); - // set dialog message - alertDialogBuilder - .setMessage(msg) - .setCancelable(false) - .setPositiveButton("Dismiss", - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int id) { - // if this button is clicked, close - // current activity - // MainActivity.this.finish(); - } - }) - .setNegativeButton("Options", - new DialogInterface.OnClickListener() { - public void onClick(DialogInterface dialog, - int id) { - FileBrowser firstFragment = new FileBrowser(); - Bundle args = new Bundle(); - // args.putBoolean("ImgBrowse", false); - // specify ImgBrowse option. true = images, - // false = folders only - args.putString("browse_entry", - sdcard.toString()); - // specify a path for selecting folder - // options - args.putBoolean("games_entry", false); - // selecting a BIOS folder, so this is not - // games - - firstFragment.setArguments(args); - // In case this activity was started with - // special instructions from - // an Intent, pass the Intent's extras to - // the fragment as arguments - // firstFragment.setArguments(getIntent().getExtras()); - - // Add the fragment to the - // 'fragment_container' FrameLayout - getSupportFragmentManager() - .beginTransaction() - .replace(R.id.fragment_container, - firstFragment, - "MAIN_BROWSER") - .addToBackStack(null).commit(); - } - }); - - // create alert dialog - AlertDialog alertDialog = alertDialogBuilder.create(); - - // show it - alertDialog.show(); - } else { - if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && !Config.nonative) { - startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), - GL2JNINative.class)); - } else { - startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), - GL2JNIActivity.class)); + // set dialog message + alertDialogBuilder + .setMessage(msg) + .setCancelable(false) + .setPositiveButton("Dismiss", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int id) { + // if this button is clicked, close + // current activity + // MainActivity.this.finish(); } + }) + .setNegativeButton("Options", + new DialogInterface.OnClickListener() { + public void onClick(DialogInterface dialog, + int id) { + FileBrowser firstFragment = new FileBrowser(); + Bundle args = new Bundle(); + // args.putBoolean("ImgBrowse", false); + // specify ImgBrowse option. true = images, + // false = folders only + args.putString("browse_entry", + sdcard.toString()); + // specify a path for selecting folder + // options + args.putBoolean("games_entry", false); + // selecting a BIOS folder, so this is not + // games + + firstFragment.setArguments(args); + // In case this activity was started with + // special instructions from + // an Intent, pass the Intent's extras to + // the fragment as arguments + // firstFragment.setArguments(getIntent().getExtras()); + + // Add the fragment to the + // 'fragment_container' FrameLayout + getSupportFragmentManager() + .beginTransaction() + .replace(R.id.fragment_container, + firstFragment, + "MAIN_BROWSER") + .addToBackStack(null).commit(); + } + }); + + // create alert dialog + AlertDialog alertDialog = alertDialogBuilder.create(); + + // show it + alertDialog.show(); + } else { + if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.GINGERBREAD && !Config.nonative) { + startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), + GL2JNINative.class)); + } else { + startActivity(new Intent(Intent.ACTION_VIEW, uri, getBaseContext(), + GL2JNIActivity.class)); } } } From d6369f9d04d2e01a306edc2054bae46e887a8399 Mon Sep 17 00:00:00 2001 From: TwistedUmbrella Date: Sun, 2 Mar 2014 23:54:02 -0500 Subject: [PATCH 7/7] Reverse the notation about commenting the NDK_VERSION --- README.md | 2 +- shell/android/jni/Application.mk | 2 +- shell/android/xperia/jni/Application.mk | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index a2d1b6712..6ea9d7afc 100644 --- a/README.md +++ b/README.md @@ -23,7 +23,7 @@ Tools required: - http://developer.android.com/sdk/index.html * NDK r8b or newer - https://developer.android.com/tools/sdk/ndk/index.html - - If using r9c+, it is recommended you uncomment the "NDK_TOOLCHAIN_VERSION := 4.8" in shell/android/jni/Application.mk and shell/android/xperia/jni/Application.mk + - If are not using r9c+, comment the "NDK_TOOLCHAIN_VERSION := 4.8" in shell/android/jni/Application.mk and shell/android/xperia/jni/Application.mk * Android 4.4 (API 19) & Android 2.3.1 (API 9) - http://developer.android.com/sdk/installing/adding-packages.html * Ant diff --git a/shell/android/jni/Application.mk b/shell/android/jni/Application.mk index 5ab713430..4d14fad8c 100644 --- a/shell/android/jni/Application.mk +++ b/shell/android/jni/Application.mk @@ -2,4 +2,4 @@ APP_STL := stlport_static #APP_ABI := armeabi-v7a x86 APP_ABI := armeabi-v7a APP_PLATFORM := android-19 -#NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file +NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file diff --git a/shell/android/xperia/jni/Application.mk b/shell/android/xperia/jni/Application.mk index db4dd562f..7f414647d 100644 --- a/shell/android/xperia/jni/Application.mk +++ b/shell/android/xperia/jni/Application.mk @@ -1,4 +1,4 @@ #APP_ABI := armeabi-v7a x86 APP_ABI := armeabi-v7a APP_PLATFORM := android-9 -#NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file +NDK_TOOLCHAIN_VERSION := 4.8 \ No newline at end of file