(Android) Remove a bunch of dead code in Android Java menu - this

should just be a (very dumb) launcher from now on
This commit is contained in:
twinaphex 2015-07-03 19:27:16 +02:00
parent a47ff23546
commit 8dfc9241c6
26 changed files with 27 additions and 2166 deletions

View File

@ -4,17 +4,6 @@
android:layout_width="match_parent"
android:layout_height="match_parent" >
<TextView
android:id="@+id/key_bind_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginLeft="20dp"
android:layout_marginTop="20dp"
android:text="@string/key_bind_title"
android:textAppearance="?android:attr/textAppearanceLarge" />
<EditText
android:id="@+id/key_bind_value"
android:layout_width="wrap_content"
@ -27,33 +16,4 @@
<requestFocus />
</EditText>
<ListView
android:id="@+id/key_bind_list"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_above="@+id/key_bind_clear"
android:layout_alignParentLeft="true"
android:layout_below="@+id/key_bind_value"
android:entries="@array/key_bind_values"
android:fastScrollEnabled="true" >
</ListView>
<Button
android:id="@+id/key_bind_clear"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:layout_toLeftOf="@+id/key_bind_detect"
android:text="@string/key_bind_clear" />
<Button
android:id="@+id/key_bind_detect"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_below="@+id/key_bind_list"
android:layout_marginRight="72dp"
android:text="@string/key_bind_detect" />
</RelativeLayout>
</RelativeLayout>

View File

@ -1,4 +0,0 @@
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/go_to_wiki_ctx_item"
android:title="@string/downloadable_cores_ctx_goto_wiki"/>
</menu>

View File

@ -3,9 +3,6 @@
<string name="app_name">RetroArch</string>
<string name="input_method">Eingabemethode</string>
<string name="file_type_icon">Dateityp-Icon</string>
<string name="key_bind_title">Bitte zu verwendenden Knopf auswählen</string>
<string name="key_bind_clear">Belegung aufheben</string>
<string name="key_bind_detect">Erkennen</string>
<string name="optimal_settings_device">Optimale Geräteeinstellungen</string>
<string name="extracting_assets_please_wait_">Entpacke Assets, bitte warten …</string>
@ -15,7 +12,6 @@
<string name="load_core">Core auswählen</string>
<string name="load_content">Lade Content</string>
<string name="load_content_auto">Lade Content (Core erkennen)</string>
<string name="load_content_history">Lade Content (Verlauf)</string>
<string name="settings">Einstellungen</string>
<string name="about">Über</string>
<string name="quit_retroarch">RetroArch beenden</string>
@ -23,33 +19,6 @@
<!-- Core Selection Class -->
<string name="select_libretro_core">Wähle einen Libretro-Core aus</string>
<!-- Core Manager -->
<string name="installed_cores">Installierte Cores</string>
<string name="uninstall_core">Core deinstallieren</string>
<string name="uninstall_core_message">Willst du wirklich %1$s deinstallieren?</string>
<string name="uninstall_failure">Deinstallation von Core %1$s fehlgeschlagen.</string>
<string name="uninstall_success">Core %1$s erfolgreich deinstalliert.</string>
<string name="downloadable_cores">Herunterladbare Cores</string>
<!-- Core Manager Info Fragment -->
<string name="core_info_displayNameTitle">Anzeige-Name</string>
<string name="core_info_internalNameTitle">Interner Name</string>
<string name="core_info_systemNameTitle">Beschreibung</string>
<string name="core_info_author">Autor(en)</string>
<string name="core_info_licenseTitle">Core-Lizenz</string>
<string name="core_info_manufacturer">Hersteller</string>
<string name="core_info_permissions">Berechtigungen</string>
<!-- Core Downloader Fragment -->
<string name="download_core_confirm_title">Bestätigen</string>
<string name="download_core_confirm_msg">Bist du sicher, dass du %1$s herunterladen willst?</string>
<string name="downloading_msg">Lade %1$s herunter…</string>
<string name="download_core_list_error">Fehler beim Empfanger der Core-Liste.</string>
<!-- Core Downloader - Downloadable Cores Context Menu -->
<string name="downloadable_cores_ctx_title">Aktionen</string>
<string name="downloadable_cores_ctx_goto_wiki">Wiki-Seite des Cores besuchen</string>
<!-- Display Refresh Rate Test Class -->
<string name="refresh_rate_calibration">Bildwiederholrate kalibrieren</string>
<string name="touch_screen_with_fingers">Berühre den Bildschirm mit deinen Fingern für genauere Messungen.</string>
@ -190,8 +159,6 @@
<!-- General Settings -->
<string name="general_options">Allgemein</string>
<string name="core_management">Core-Verwaltung</string>
<string name="manage_cores">Verwalte Cores</string>
<string name="config_style">Konfigurationsart</string>
<string name="global_config">Globale Konfiguration</string>
<string name="global_config_desc">Verwende globale Einstellungen für alle Cores. Lasse dies ausgeschaltet, wenn du Cores einzeln konfigurieren willst.</string>

View File

@ -26,26 +26,6 @@
<item>160</item>
</string-array>
<string-array name="aspect_ratios" translatable="false">
<item>@string/fullscreen</item>
<item>@string/automatic</item>
<item>@string/square_pixel</item>
<item>4:3</item>
<item>16:9</item>
<item>16:10</item>
<item>8:7</item>
</string-array>
<string-array name="aspect_values" translatable="false">
<item>full</item>
<item>auto</item>
<item>square</item>
<item>1.33333</item>
<item>1.77777</item>
<item>1.60000</item>
<item>1.14286</item>
</string-array>
<string-array name="icade_profiles" translatable="false">
<item>Red Samurai</item>
<item>iPega PG-9017</item>
@ -63,218 +43,4 @@
<item>4</item>
<item >5</item>
</string-array>
<string-array name="key_bind_values" translatable="false">
<item>UNBOUND</item>
<item>SOFT LEFT</item>
<item>SOFT RIGHT</item>
<item>HOME</item>
<item>BACK</item>
<item>CALL</item>
<item>ENDCALL</item>
<item>0</item>
<item>1</item>
<item>2</item>
<item>3</item>
<item>4</item>
<item>5</item>
<item>6</item>
<item>7</item>
<item>8</item>
<item>9</item>
<item>STAR</item>
<item>POUND</item>
<item>DPAD UP</item>
<item>DPAD DOWN</item>
<item>DPAD LEFT</item>
<item>DPAD RIGHT</item>
<item>DPAD CENTER</item>
<item>VOLUME UP</item>
<item>VOLUME DOWN</item>
<item>POWER</item>
<item>CAMERA</item>
<item>CLEAR</item>
<item>A</item>
<item>B</item>
<item>C</item>
<item>D</item>
<item>E</item>
<item>F</item>
<item>G</item>
<item>H</item>
<item>I</item>
<item>J</item>
<item>K</item>
<item>L</item>
<item>M</item>
<item>N</item>
<item>O</item>
<item>P</item>
<item>Q</item>
<item>R</item>
<item>S</item>
<item>T</item>
<item>U</item>
<item>V</item>
<item>W</item>
<item>X</item>
<item>Y</item>
<item>Z</item>
<item>COMMA</item>
<item>PERIOD</item>
<item>ALT LEFT</item>
<item>ALT RIGHT</item>
<item>SHIFT LEFT</item>
<item>SHIFT RIGHT</item>
<item>TAB</item>
<item>SPACE</item>
<item>SYM</item>
<item>EXPLORER</item>
<item>ENVELOPE</item>
<item>ENTER</item>
<item>DEL</item>
<item>GRAVE</item>
<item>MINUS</item>
<item>EQUALS</item>
<item>LEFT BRACKET</item>
<item>RIGHT BRACKET</item>
<item>BACKSLASH</item>
<item>SEMICOLON</item>
<item>APOSTROPHE</item>
<item>SLASH</item>
<item>AT</item>
<item>NUM</item>
<item>HEADSETHOOK</item>
<item>FOCUS</item>
<item>PLUS</item>
<item>MENU</item>
<item>NOTIFICATION</item>
<item>SEARCH</item>
<item>MEDIA PLAY PAUSE=</item>
<item>MEDIA STOP</item>
<item>MEDIA NEXT</item>
<item>MEDIA PREVIOUS</item>
<item>MEDIA REWIND</item>
<item>MEDIA FAST FORWARD</item>
<item>MUTE</item>
<item>PAGE UP</item>
<item>PAGE DOWN</item>
<item>PICTSYMBOLS</item>
<item>SWITCH CHARSET</item>
<item>BUTTON A</item>
<item>BUTTON B</item>
<item>BUTTON C</item>
<item>BUTTON X</item>
<item>BUTTON Y</item>
<item>BUTTON Z</item>
<item>BUTTON L1</item>
<item>BUTTON R1</item>
<item>BUTTON L2</item>
<item>BUTTON R2</item>
<item>BUTTON THUMBL</item>
<item>BUTTON THUMBR</item>
<item>BUTTON START</item>
<item>BUTTON SELECT</item>
<item>BUTTON MODE</item>
<item>ESCAPE</item>
<item>FORWARD DEL</item>
<item>CTRL LEFT</item>
<item>CTRL RIGHT</item>
<item>CAPS LOCK</item>
<item>SCROLL LOCK</item>
<item>META LEFT</item>
<item>META RIGHT</item>
<item>FUNCTION</item>
<item>SYSRQ</item>
<item>BREAK</item>
<item>MOVE HOME</item>
<item>MOVE END</item>
<item>INSERT</item>
<item>FORWARD</item>
<item>MEDIA PLAY</item>
<item>MEDIA PAUSE</item>
<item>MEDIA CLOSE</item>
<item>MEDIA EJECT</item>
<item>MEDIA RECORD</item>
<item>F1</item>
<item>F2</item>
<item>F3</item>
<item>F4</item>
<item>F5</item>
<item>F6</item>
<item>F7</item>
<item>F8</item>
<item>F9</item>
<item>F10</item>
<item>F11</item>
<item>F12</item>
<item>NUM LOCK</item>
<item>NUMPAD 0</item>
<item>NUMPAD 1</item>
<item>NUMPAD 2</item>
<item>NUMPAD 3</item>
<item>NUMPAD 4</item>
<item>NUMPAD 5</item>
<item>NUMPAD 6</item>
<item>NUMPAD 7</item>
<item>NUMPAD 8</item>
<item>NUMPAD 9</item>
<item>NUMPAD DIVIDE</item>
<item>NUMPAD MULTIPLY</item>
<item>NUMPAD SUBTRACT</item>
<item>NUMPAD ADD</item>
<item>NUMPAD DOT</item>
<item>NUMPAD COMMA</item>
<item>NUMPAD ENTER</item>
<item>NUMPAD EQUALS</item>
<item>NUMPAD LEFT PAREN</item>
<item>NUMPAD RIGHT PAREN</item>
<item>VOLUME MUTE</item>
<item>INFO</item>
<item>CHANNEL UP</item>
<item>CHANNEL DOWN</item>
<item>ZOOM IN</item>
<item>ZOOM OUT</item>
<item>TV</item>
<item>WINDOW</item>
<item>GUIDE</item>
<item>DVR</item>
<item>BOOKMARK</item>
<item>CAPTIONS</item>
<item>SETTINGS</item>
<item>TV POWER</item>
<item>TV INPUT</item>
<item>STB POWER</item>
<item>STB INPUT</item>
<item>AVR POWER</item>
<item>AVR INPUT</item>
<item>PROG RED</item>
<item>PROG GREEN</item>
<item>PROG YELLOW</item>
<item>PROG BLUE</item>
<item>APP SWITCH</item>
<item>BUTTON 1</item>
<item>BUTTON 2</item>
<item>BUTTON 3</item>
<item>BUTTON 4</item>
<item>BUTTON 5</item>
<item>BUTTON 6</item>
<item>BUTTON 7</item>
<item>BUTTON 8</item>
<item>BUTTON 9</item>
<item>BUTTON 10</item>
<item>BUTTON 11</item>
<item>BUTTON 12</item>
<item>BUTTON 13</item>
<item>BUTTON 14</item>
<item>BUTTON 15</item>
<item>BUTTON 16</item>
<item>LANGUAGE SWITCH</item>
<item>MANNER MODE</item>
<item>3D MODE</item>
<item>CONTACTS</item>
<item>CALENDAR</item>
<item>MUSIC</item>
<item>CALCULATOR</item>
</string-array>
</resources>

View File

@ -3,9 +3,6 @@
<string name="app_name">RetroArch</string>
<string name="input_method">Input Method</string>
<string name="file_type_icon">File type icon</string>
<string name="key_bind_title">Select the button to use</string>
<string name="key_bind_clear">Unbind</string>
<string name="key_bind_detect">Detect</string>
<string name="optimal_settings_device">Optimal device settings</string>
<string name="extracting_assets_please_wait_">Extracting assets, please wait …</string>
@ -15,7 +12,6 @@
<string name="load_core">Core Selection</string>
<string name="load_content">Load Content</string>
<string name="load_content_auto">Load Content (Detect Core)</string>
<string name="load_content_history">Load Content (History)</string>
<string name="settings">Settings</string>
<string name="about">About</string>
<string name="quit_retroarch">Quit RetroArch</string>
@ -23,33 +19,6 @@
<!-- Core Selection Class -->
<string name="select_libretro_core">Select a libretro core</string>
<!-- Core Manager -->
<string name="installed_cores">Installed Cores</string>
<string name="uninstall_core">Uninstall Core</string>
<string name="uninstall_core_message">Would you like to uninstall %1$s?</string>
<string name="uninstall_failure">Failed to uninstall core: %1$s.</string>
<string name="uninstall_success">Successfully uninstalled core: %1$s.</string>
<string name="downloadable_cores">Downloadable Cores</string>
<!-- Core Manager Info Fragment -->
<string name="core_info_displayNameTitle">Display Name</string>
<string name="core_info_internalNameTitle">Internal Name</string>
<string name="core_info_systemNameTitle">Description</string>
<string name="core_info_author">Author(s)</string>
<string name="core_info_licenseTitle">Core License</string>
<string name="core_info_manufacturer">Manufacturer</string>
<string name="core_info_permissions">Permissions</string>
<!-- Core Downloader Fragment -->
<string name="download_core_confirm_title">Confirm</string>
<string name="download_core_confirm_msg">Are you sure you want to download %1$s?</string>
<string name="downloading_msg">Downloading %1$s…</string>
<string name="download_core_list_error">Error retrieving list of cores.</string>
<!-- Core Downloader - Downloadable Cores Context Menu -->
<string name="downloadable_cores_ctx_title">Actions</string>
<string name="downloadable_cores_ctx_goto_wiki">Go to core wiki page</string>
<!-- Display Refresh Rate Test Class -->
<string name="refresh_rate_calibration">Refresh rate calibration</string>
<string name="touch_screen_with_fingers">Touch the screen with your fingers for more accurate measurements.</string>
@ -190,8 +159,6 @@
<!-- General Settings -->
<string name="general_options">General</string>
<string name="core_management">Core Management</string>
<string name="manage_cores">Manage Cores</string>
<string name="config_style">Configuration style</string>
<string name="global_config">Global configuration</string>
<string name="global_config_desc">Enable global settings for all cores. Leave disabled if you want per-core settings.</string>

View File

@ -23,19 +23,4 @@
android:summary="@string/auto_save_state_desc"
android:title="@string/auto_save_state" />
</PreferenceCategory>
<!-- Rewinding -->
<PreferenceCategory android:title="@string/rewinding" >
<CheckBoxPreference
android:defaultValue="false"
android:key="rewind_enable"
android:summary="@string/rewinding_desc"
android:title="@string/enable" />
<EditTextPreference
android:dependency="rewind_enable"
android:key="rewind_granularity"
android:numeric="integer"
android:summary="@string/rewind_granularity_desc"
android:title="@string/rewind_granularity"/>
</PreferenceCategory>
</PreferenceScreen>
</PreferenceScreen>

View File

@ -40,218 +40,6 @@
android:dependency="input_overlay_enable" />
</PreferenceCategory>
<!-- Custom Bindings -->
<PreferenceCategory android:title="@string/custom_binds">
<PreferenceScreen
android:title="@string/player_1_custom_binds"
android:dependency="input_autodetect_enable" >
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_up_btn"
android:title="@string/up_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_down_btn"
android:title="@string/down_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_left_btn"
android:title="@string/left_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_right_btn"
android:title="@string/right_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_a_btn"
android:title="@string/a_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_b_btn"
android:title="@string/b_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_x_btn"
android:title="@string/x_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_y_btn"
android:title="@string/y_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_start_btn"
android:title="@string/start_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_select_btn"
android:title="@string/select_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_l_btn"
android:title="@string/l1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_r_btn"
android:title="@string/r1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_l2_btn"
android:title="@string/l2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_r2_btn"
android:title="@string/r2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_l3_btn"
android:title="@string/l3_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player1_r3_btn"
android:title="@string/r3_button" />
</PreferenceScreen>
<PreferenceScreen
android:title="@string/player_2_custom_binds"
android:dependency="input_autodetect_enable" >
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_up_btn"
android:title="@string/up_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_down_btn"
android:title="@string/down_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_left_btn"
android:title="@string/left_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_right_btn"
android:title="@string/right_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_a_btn"
android:title="@string/a_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_b_btn"
android:title="@string/b_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_x_btn"
android:title="@string/x_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_y_btn"
android:title="@string/y_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_start_btn"
android:title="@string/start_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_select_btn"
android:title="@string/select_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_l_btn"
android:title="@string/l1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_r_btn"
android:title="@string/r1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_l2_btn"
android:title="@string/l2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_r2_btn"
android:title="@string/r2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_l3_btn"
android:title="@string/l3_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player2_r3_btn"
android:title="@string/r3_button" />
</PreferenceScreen>
<PreferenceScreen
android:title="@string/player_3_custom_binds"
android:dependency="input_autodetect_enable" >
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_up_btn"
android:title="@string/up_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_down_btn"
android:title="@string/down_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_left_btn"
android:title="@string/left_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_right_btn"
android:title="@string/right_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_a_btn"
android:title="@string/a_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_b_btn"
android:title="@string/b_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_x_btn"
android:title="@string/x_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_y_btn"
android:title="@string/y_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_start_btn"
android:title="@string/start_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_select_btn"
android:title="@string/select_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_l_btn"
android:title="@string/l1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_r_btn"
android:title="@string/r1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_l2_btn"
android:title="@string/l2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_r2_btn"
android:title="@string/r2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_l3_btn"
android:title="@string/l3_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player3_r3_btn"
android:title="@string/r3_button" />
</PreferenceScreen>
<PreferenceScreen
android:title="@string/player_4_custom_binds"
android:dependency="input_autodetect_enable" >
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_up_btn"
android:title="@string/up_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_down_btn"
android:title="@string/down_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_left_btn"
android:title="@string/left_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_right_btn"
android:title="@string/right_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_a_btn"
android:title="@string/a_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_b_btn"
android:title="@string/b_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_x_btn"
android:title="@string/x_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_y_btn"
android:title="@string/y_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_start_btn"
android:title="@string/start_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_select_btn"
android:title="@string/select_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_l_btn"
android:title="@string/l1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_r_btn"
android:title="@string/r1_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_l2_btn"
android:title="@string/l2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_r2_btn"
android:title="@string/r2_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_l3_btn"
android:title="@string/l3_button" />
<com.retroarch.browser.preferences.util.KeyBindPreference
android:key="input_player4_r3_btn"
android:title="@string/r3_button" />
</PreferenceScreen>
</PreferenceCategory>
<!-- Diagnostics -->
<PreferenceCategory android:title="@string/diagnostics" >
<Preference

View File

@ -22,19 +22,6 @@
android:key="loadContentAutoPref"
android:title="@string/load_content_auto"/>
<!-- Load Content (History) -->
<Preference
android:key="loadContentHistoryPref"
android:title="@string/load_content_history"/>
<!-- Manage Cores -->
<Preference
android:title="@string/manage_cores">
<intent
android:targetClass="com.retroarch.browser.coremanager.CoreManagerActivity"
android:targetPackage="com.retroarch"/>
</Preference>
<!-- Settings -->
<Preference android:title="@string/settings">
<intent

View File

@ -3,28 +3,11 @@
<!-- General -->
<PreferenceCategory android:title="@string/general" >
<ListPreference
android:entries="@array/aspect_ratios"
android:entryValues="@array/aspect_values"
android:defaultValue="auto"
android:key="video_aspect_ratio"
android:summary="@string/aspect_ratio_desc"
android:title="@string/aspect_ratio" />
<CheckBoxPreference
android:defaultValue="true"
android:key="video_vsync"
android:summary="@string/vsync_desc"
android:title="@string/vsync" />
<CheckBoxPreference
android:defaultValue="true"
android:key="video_allow_rotate"
android:summary="@string/auto_rotate_desc"
android:title="@string/auto_rotate" />
<CheckBoxPreference
android:defaultValue="false"
android:key="video_scale_integer"
android:summary="@string/scale_integer_desc"
android:title="@string/scale_integer" />
</PreferenceCategory>
<!-- Synchronization -->
@ -51,12 +34,4 @@
android:summary="@string/set_os_reported_refresh_rate_desc"
android:title="@string/set_os_reported_refresh_rate" />
</PreferenceCategory>
<!-- Fonts -->
<PreferenceCategory android:title="@string/fonts">
<CheckBoxPreference android:title="@string/onscreen_fonts"
android:summary="@string/onscreen_fonts_desc"
android:key="video_font_enable"
android:defaultValue="true"/>
</PreferenceCategory>
</PreferenceScreen>

View File

@ -1,139 +0,0 @@
package com.retroarch.browser;
import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import com.retroarch.R;
import com.retroarch.browser.mainmenu.MainMenuActivity;
import com.retroarch.browser.mainmenu.MainMenuFragment;
import com.retroarch.browser.preferences.util.UserPreferences;
import com.retroarch.browser.retroactivity.RetroActivityFuture;
import com.retroarch.browser.retroactivity.RetroActivityPast;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemClickListener;
import android.widget.ListView;
import android.widget.Toast;
/**
* Represents the {@link ListFragment} responsible
* for displaying the list of previously played games.
*/
public final class HistorySelection extends DialogFragment
{
private FragmentActivity ctx;
private IconAdapter<HistoryWrapper> adapter;
public Intent getRetroActivity()
{
if ((Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB))
{
return new Intent(ctx, RetroActivityFuture.class);
}
return new Intent(ctx, RetroActivityPast.class);
}
/**
* Creates a statically instantiated instance of HistorySelection.
*
* @return a statically instantiated instance of HistorySelection.
*/
public static HistorySelection newInstance()
{
return new HistorySelection();
}
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Cache the context
this.ctx = getActivity();
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
ListView rootView = (ListView) inflater.inflate(R.layout.line_list, container, false);
rootView.setOnItemClickListener(onItemClickListener);
// Set the title for this dialog.
getDialog().setTitle(R.string.load_content_history);
// Setup the list adapter
adapter = new IconAdapter<HistoryWrapper>(ctx, R.layout.line_list_item);
// Populate the adapter
File history = new File(ctx.getApplicationInfo().dataDir, "content_history.rpl");
try
{
BufferedReader br = new BufferedReader(new InputStreamReader(
new FileInputStream(history)));
for (;;)
{
String game = br.readLine();
String core = br.readLine();
String name = br.readLine();
if (game == null || core == null || name == null)
break;
adapter.add(new HistoryWrapper(game, core, name));
}
br.close();
}
catch (IOException ignored)
{
}
// Set the adapter
rootView.setAdapter(adapter);
return rootView;
}
private final OnItemClickListener onItemClickListener = new OnItemClickListener()
{
@Override
public void onItemClick(AdapterView<?> listView, View view, int position, long id)
{
final HistoryWrapper item = adapter.getItem(position);
final String gamePath = item.getGamePath();
final String corePath = item.getCorePath();
// Set the core the selected game uses.
((MainMenuActivity)getActivity()).setModule(corePath, item.getCoreName());
// Update the config accordingly.
UserPreferences.updateConfigFile(ctx);
// Launch the game.
String current_ime = Settings.Secure.getString(ctx.getContentResolver(),
Settings.Secure.DEFAULT_INPUT_METHOD);
Toast.makeText(ctx, String.format(getString(R.string.loading_gamepath), gamePath), Toast.LENGTH_SHORT).show();
Intent retro = getRetroActivity();
MainMenuFragment.startRetroActivity(retro,
gamePath,
corePath,
UserPreferences.getDefaultConfigPath(ctx),
current_ime,
getActivity().getApplicationInfo().dataDir);
startActivity(retro);
dismiss();
}
};
}

View File

@ -1,89 +0,0 @@
package com.retroarch.browser;
import java.io.File;
import android.graphics.drawable.Drawable;
/**
* Wraps a previously played game along with its core
* for placement within the previously played history.
*/
public final class HistoryWrapper implements IconAdapterItem {
private String gamePath;
private String gamePathShort;
private String corePath;
private String coreName;
/**
* Constructor
*
* @param gamePath Path to the previously played game.
* @param corePath Path to the core the previously played game uses.
* @param coreName The actual name of the core.
*/
public HistoryWrapper(String gamePath, String corePath, String coreName) {
this.gamePath = gamePath;
this.corePath = corePath;
this.coreName = coreName;
File file = new File(gamePath);
gamePathShort = file.getName();
try {
gamePathShort = gamePathShort.substring(0, gamePathShort.lastIndexOf('.'));
} catch (IndexOutOfBoundsException e) {
}
}
/**
* Gets the path to the previously played game.
*
* @return the path to the previously played game.
*/
public String getGamePath() {
return gamePath;
}
/**
* Gets the path to the core that the previously played game uses.
*
* @return the path to the core that the previously played game uses.
*/
public String getCorePath() {
return corePath;
}
/**
* Gets the name of the core used with the previously played game.
*
* @return the name of the core used with the previously played game.
*/
public String getCoreName() {
return coreName;
}
@Override
public boolean isEnabled() {
return true;
}
@Override
public String getText() {
return gamePathShort;
}
@Override
public String getSubText() {
return coreName;
}
@Override
public int getIconResourceId() {
return 0;
}
@Override
public Drawable getIconDrawable() {
return null;
}
}

View File

@ -1,139 +0,0 @@
package com.retroarch.browser.coremanager;
import java.util.List;
import com.retroarch.R;
import com.retroarch.browser.coremanager.fragments.DownloadableCoresFragment;
import com.retroarch.browser.coremanager.fragments.InstalledCoresFragment;
import com.retroarch.browser.coremanager.fragments.InstalledCoresManagerFragment;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.ActionBarActivity;
/**
* Activity which provides the base for viewing installed cores,
* as well as the ability to download other cores.
*/
public final class CoreManagerActivity extends ActionBarActivity implements DownloadableCoresFragment.OnCoreDownloadedListener
{
@Override
public void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
// Set the ViewPager
setContentView(R.layout.coremanager_viewpager);
final ViewPager viewPager = (ViewPager) findViewById(R.id.coreviewer_viewPager);
viewPager.setAdapter(new ViewPagerAdapter(getSupportFragmentManager()));
}
@Override
public void onBackPressed()
{
if (!returnBackStackImmediate(getSupportFragmentManager()))
{
super.onBackPressed();
}
}
// HACK: Propagate back button press to child fragments.
// This might not work properly when you have multiple fragments
// adding multiple children to the backstack. (in our case, only
// one child fragments adds fragments to the backstack, so we're fine with this).
//
// Congrats to Google for having a bugged backstack that doesn't account for
// nested fragments. A heavy applause to them for the immense stupidity if this is
// actually intended behavior. This is why overriding the handling of back presses
// should be present in Fragments.
//
// Taken from: http://android.joao.jp/2013/09/back-stack-with-nested-fragments-back.html
// If you ever read this, thank you very much for making the workaround.
//
private boolean returnBackStackImmediate(FragmentManager fm)
{
List<Fragment> fragments = fm.getFragments();
if (fragments != null && fragments.size() > 0)
{
for (Fragment fragment : fragments)
{
if (fragment.getChildFragmentManager().getBackStackEntryCount() > 0)
{
if (fragment.getChildFragmentManager().popBackStackImmediate())
{
return true;
}
else
{
return returnBackStackImmediate(fragment.getChildFragmentManager());
}
}
}
}
return false;
}
// Callback function used to update the installed cores list
@Override
public void onCoreDownloaded()
{
InstalledCoresManagerFragment icmf = (InstalledCoresManagerFragment) getSupportFragmentManager().findFragmentByTag("android:switcher:" + R.id.coreviewer_viewPager + ":" + 0);
if (icmf != null)
{
InstalledCoresFragment icf = (InstalledCoresFragment) icmf.getChildFragmentManager().findFragmentByTag("InstalledCoresList");
if (icf != null)
icf.updateInstalledCoresList();
}
}
// Adapter for the core manager ViewPager.
private final class ViewPagerAdapter extends FragmentPagerAdapter
{
private final String[] pageTitles = {
getString(R.string.installed_cores),
getString(R.string.downloadable_cores)
};
/**
* Constructor
*
* @param fm The {@link FragmentManager} for this adapter.
*/
public ViewPagerAdapter(FragmentManager fm)
{
super(fm);
}
@Override
public Fragment getItem(int position)
{
switch (position)
{
case 0:
return new InstalledCoresManagerFragment();
case 1:
return new DownloadableCoresFragment();
default: // Should never happen.
return null;
}
}
@Override
public int getCount()
{
return 2;
}
@Override
public CharSequence getPageTitle(int position)
{
return pageTitles[position];
}
}
}

View File

@ -1,57 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
/**
* Represents a core that can be downloaded.
*/
final class DownloadableCore
{
private final String coreName;
private final String coreURL;
private final String shortURL;
/**
* Constructor
*
* @param coreName Name of the core.
* @param coreURL URL to this core.
*/
public DownloadableCore(String coreName, String coreURL)
{
this.coreName = coreName;
this.coreURL = coreURL;
this.shortURL = coreURL.substring(coreURL.lastIndexOf('/') + 1);
}
/**
* Gets the name of this core.
*
* @return The name of this core.
*/
public String getCoreName()
{
return coreName;
}
/**
* Gets the URL to download this core.
*
* @return The URL to download this core.
*/
public String getCoreURL()
{
return coreURL;
}
/**
* Gets the short URL name of this core.
* <p>
* e.g. Consider the url: www.somesite/somecore.zip.
* This would return "somecore.zip"
*
* @return the short URL name of this core.
*/
public String getShortURLName()
{
return shortURL;
}
}

View File

@ -1,54 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.TextView;
/**
* {@link ArrayAdapter} that handles the display of downloadable cores.
*/
final class DownloadableCoresAdapter extends ArrayAdapter<DownloadableCore>
{
private final int layoutId;
/**
* Constructor
*
* @param context The current {@link Context}.
* @param layoutID The resource ID for a layout file containing a layout to use when instantiating views
*/
public DownloadableCoresAdapter(Context context, int layoutId)
{
super(context, layoutId);
this.layoutId = layoutId;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
if (convertView == null)
{
final LayoutInflater li = LayoutInflater.from(getContext());
convertView = li.inflate(layoutId, parent, false);
}
final DownloadableCore core = getItem(position);
if (core != null)
{
TextView title = (TextView) convertView.findViewById(android.R.id.text1);
TextView subtitle = (TextView) convertView.findViewById(android.R.id.text2);
if (title != null)
title.setText(core.getCoreName());
if (subtitle != null)
subtitle.setText(core.getCoreURL());
}
return convertView;
}
}

View File

@ -1,449 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
import java.io.BufferedInputStream;
import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.FileWriter;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStream;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.ArrayList;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import org.jsoup.Connection;
import org.jsoup.Jsoup;
import org.jsoup.nodes.Element;
import org.jsoup.select.Elements;
import android.app.AlertDialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView.AdapterContextMenuInfo;
import android.widget.ListView;
import android.widget.Toast;
import com.retroarch.R;
/**
* {@link ListFragment} that is responsible for showing
* cores that are able to be downloaded or are not installed.
*/
public final class DownloadableCoresFragment extends ListFragment
{
// List of TODOs.
// - Eventually make the core downloader capable of directory-based browsing from the base URL.
// - Allow for 'repository'-like core downloading.
// - Clean this up a little better. It can likely be way more organized.
// - Don't re-download the info files on orientation changes.
// - Use a loading wheel when core retrieval is being done. User may think something went wrong otherwise.
// - Check the info directory for an info file before downloading it. Can save bandwidth this way (and list load times would be faster).
// - Should probably display a dialog or a toast message when the Internet connection process fails.
/**
* Dictates what actions will occur when a core download completes.
* <p>
* Acts like a callback so that communication between fragments is possible.
*/
public interface OnCoreDownloadedListener
{
/** The action that will occur when a core is successfully downloaded. */
void onCoreDownloaded();
}
private static final String BUILDBOT_BASE_URL = "http://buildbot.libretro.com";
private static final String BUILDBOT_CORE_URL_ARM = BUILDBOT_BASE_URL + "/nightly/android/latest/armeabi-v7a/";
private static final String BUILDBOT_CORE_URL_X86 = BUILDBOT_BASE_URL + "/nightly/android/latest/x86/";
private static final String BUILDBOT_INFO_URL = BUILDBOT_BASE_URL + "/assets/info/";
private OnCoreDownloadedListener coreDownloadedListener = null;
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
super.onCreateView(inflater, container, savedInstanceState);
final ListView coreList = (ListView) inflater.inflate(R.layout.coremanager_listview, container, false);
registerForContextMenu(coreList);
final DownloadableCoresAdapter adapter = new DownloadableCoresAdapter(getActivity(), android.R.layout.simple_list_item_2);
adapter.setNotifyOnChange(true);
coreList.setAdapter(adapter);
coreDownloadedListener = (OnCoreDownloadedListener) getActivity();
new PopulateCoresListOperation(adapter).execute();
return coreList;
}
@Override
public void onListItemClick(final ListView lv, final View v, final int position, final long id)
{
super.onListItemClick(lv, v, position, id);
final DownloadableCore core = (DownloadableCore) lv.getItemAtPosition(position);
// Prompt the user for confirmation on downloading the core.
AlertDialog.Builder notification = new AlertDialog.Builder(getActivity());
notification.setMessage(String.format(getString(R.string.download_core_confirm_msg), core.getCoreName()));
notification.setTitle(R.string.download_core_confirm_title);
notification.setNegativeButton(R.string.no, null);
notification.setPositiveButton(R.string.yes, new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which)
{
// Begin downloading the core.
new DownloadCoreOperation(getActivity(), core.getCoreName()).execute(core.getCoreURL(), core.getShortURLName());
}
});
notification.show();
}
@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo)
{
super.onCreateContextMenu(menu, v, menuInfo);
menu.setHeaderTitle(R.string.downloadable_cores_ctx_title);
MenuInflater inflater = getActivity().getMenuInflater();
inflater.inflate(R.menu.downloadable_cores_context_menu, menu);
}
@Override
public boolean onContextItemSelected(MenuItem item)
{
final AdapterContextMenuInfo info = (AdapterContextMenuInfo)item.getMenuInfo();
switch (item.getItemId())
{
case R.id.go_to_wiki_ctx_item:
{
String coreUrlPart = ((DownloadableCore)getListView().getItemAtPosition(info.position)).getCoreName().replace(" ", "_");
Intent browserIntent = new Intent(Intent.ACTION_VIEW, Uri.parse("http://wiki.libretro.com/index.php?title=" + coreUrlPart));
startActivity(browserIntent);
return true;
}
default:
return super.onContextItemSelected(item);
}
}
// Async event responsible for populating the Downloadable Cores list.
private static final class PopulateCoresListOperation extends AsyncTask<Void, Void, ArrayList<DownloadableCore>>
{
// Acts as an object reference to an adapter in a list view.
private DownloadableCoresAdapter adapter;
/**
* Constructor
*
* @param adapter The adapter to asynchronously update.
*/
public PopulateCoresListOperation(DownloadableCoresAdapter adapter)
{
this.adapter = adapter;
}
@Override
protected ArrayList<DownloadableCore> doInBackground(Void... params)
{
try
{
final Connection core_connection = Build.CPU_ABI.startsWith("arm") ? Jsoup.connect(BUILDBOT_CORE_URL_ARM)
: Jsoup.connect(BUILDBOT_CORE_URL_X86);
final Elements coreElements = core_connection.get().body().getElementsByClass("fb-n").select("a");
final ArrayList<DownloadableCore> downloadableCores = new ArrayList<DownloadableCore>();
// NOTE: Start from 1 to skip the ".." (parent directory element)
// Set this to zero if directory-based browsing becomes a thing.
for (int i = 1; i < coreElements.size(); i++)
{
Element coreElement = coreElements.get(i);
final String coreURL = BUILDBOT_BASE_URL + coreElement.attr("href");
final String coreName = coreURL.substring(coreURL.lastIndexOf("/") + 1);
final String infoURL = BUILDBOT_INFO_URL + coreName.replace(".so.zip", ".info");
downloadableCores.add(new DownloadableCore(getCoreName(infoURL), coreURL));
}
return downloadableCores;
}
catch (IOException e)
{
Log.e("PopulateCoresListOperation", e.toString());
// Make a dummy entry to notify an error.
return new ArrayList<DownloadableCore>();
}
}
@Override
protected void onPostExecute(ArrayList<DownloadableCore> result)
{
super.onPostExecute(result);
if (result.isEmpty())
{
Toast.makeText(adapter.getContext(), R.string.download_core_list_error, Toast.LENGTH_SHORT).show();
}
else
{
for (int i = 0; i < result.size(); i++)
{
adapter.add(result.get(i));
}
}
}
// Literally downloads the info file, writes it, and parses it for the corename key/value pair.
// AKA an argument for having a manifest file on the server.
//
// This makes list loading take way longer than it should.
//
// One way this can be improved is by checking the info directory for
// existing info files that match the core. Eliminating the download retrieval.
private String getCoreName(String urlPath)
{
String name = "";
try
{
final URL url = new URL(urlPath);
final BufferedReader br = new BufferedReader(new InputStreamReader(url.openStream()));
final StringBuilder sb = new StringBuilder();
String str = "";
while ((str = br.readLine()) != null)
sb.append(str + "\n");
br.close();
// Write the info file.
File outputPath = new File(adapter.getContext().getApplicationInfo().dataDir + "/info/", urlPath.substring(urlPath.lastIndexOf('/') + 1));
BufferedWriter bw = new BufferedWriter(new FileWriter(outputPath));
bw.append(sb);
bw.close();
// Now read the core name
String[] lines = sb.toString().split("\n");
for (int i = 0; i < lines.length; i++)
{
if (lines[i].contains("corename"))
{
// Gross
name = lines[i].split("=")[1].trim().replace("\"", "");
break;
}
}
}
catch (FileNotFoundException fnfe)
{
// Can't find the info file. Name it the same thing as the package.
final int start = urlPath.lastIndexOf('/') + 1;
final int end = urlPath.lastIndexOf('.');
if (end == -1)
name = urlPath.substring(start);
else
name = urlPath.substring(start, end);
}
catch (IOException ioe)
{
name = "Report this: " + ioe.getMessage();
}
return name;
}
}
// Executed when the user confirms a core download.
private final class DownloadCoreOperation extends AsyncTask<String, Integer, Void>
{
private final ProgressDialog dlg;
private final Context ctx;
private final String coreName;
/**
* Constructor
*
* @param ctx The current {@link Context}.
* @param coreName The name of the core being downloaded.
*/
public DownloadCoreOperation(Context ctx, String coreName)
{
this.dlg = new ProgressDialog(ctx);
this.ctx = ctx;
this.coreName = coreName;
}
@Override
protected void onPreExecute()
{
super.onPreExecute();
dlg.setMessage(String.format(ctx.getString(R.string.downloading_msg), coreName));
dlg.setCancelable(false);
dlg.setCanceledOnTouchOutside(false);
dlg.setIndeterminate(false);
dlg.setMax(100);
dlg.setProgressStyle(ProgressDialog.STYLE_HORIZONTAL);
dlg.show();
}
@Override
protected Void doInBackground(String... params)
{
InputStream input = null;
OutputStream output = null;
HttpURLConnection connection = null;
try
{
URL url = new URL(params[0]);
connection = (HttpURLConnection) url.openConnection();
connection.connect();
if (connection.getResponseCode() != HttpURLConnection.HTTP_OK)
{
Log.i("DownloadCoreOperation", "HTTP response code not OK. Response code: " + connection.getResponseCode());
return null;
}
// Set up the streams
final int fileLen = connection.getContentLength();
final File zipPath = new File(ctx.getApplicationInfo().dataDir + "/cores/", params[1]);
input = new BufferedInputStream(connection.getInputStream(), 8192);
output = new FileOutputStream(zipPath);
// Download and write to storage.
long totalDownloaded = 0;
byte[] buffer = new byte[4096];
int countBytes = 0;
while ((countBytes = input.read(buffer)) != -1)
{
totalDownloaded += countBytes;
if (fileLen > 0)
publishProgress((int) (totalDownloaded * 100 / fileLen));
output.write(buffer, 0, countBytes);
}
unzipCore(zipPath);
}
catch (IOException ignored)
{
// Can't really do anything to recover.
}
finally
{
try
{
if (output != null)
output.close();
if (input != null)
input.close();
}
catch (IOException ignored)
{
}
if (connection != null)
connection.disconnect();
}
return null;
}
@Override
protected void onProgressUpdate(Integer... progress)
{
super.onProgressUpdate(progress);
dlg.setProgress(progress[0]);
}
@Override
protected void onPostExecute(Void result)
{
super.onPostExecute(result);
if (dlg.isShowing())
dlg.dismiss();
// Invoke callback to update the installed cores list.
coreDownloadedListener.onCoreDownloaded();
}
}
// Java 6 ladies and gentlemen.
private static void unzipCore(File zipFile)
{
ZipInputStream zis = null;
try
{
zis = new ZipInputStream(new FileInputStream(zipFile));
ZipEntry entry = zis.getNextEntry();
while (entry != null)
{
File file = new File(zipFile.getParent(), entry.getName());
FileOutputStream fos = new FileOutputStream(file);
int len = 0;
byte[] buffer = new byte[4096];
while ((len = zis.read(buffer)) != -1)
{
fos.write(buffer, 0, len);
}
fos.close();
entry = zis.getNextEntry();
}
}
catch (IOException ignored)
{
// Can't do anything.
}
finally
{
try
{
if (zis != null)
{
zis.closeEntry();
zis.close();
}
}
catch (IOException ignored)
{
// Can't do anything
}
zipFile.delete();
}
}
}

View File

@ -1,121 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
import java.io.File;
import com.retroarch.R;
import com.retroarch.browser.ModuleWrapper;
import android.content.Context;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
/**
* Fragment that displays information about a selected core.
*/
public final class InstalledCoreInfoFragment extends ListFragment
{
/**
* Creates a new instance of a InstalledCoreInfoFragment.
*
* @param core The wrapped core to represent.
*
* @return a new instance of a InstalledCoreInfoFragment.
*/
public static InstalledCoreInfoFragment newInstance(ModuleWrapper core)
{
InstalledCoreInfoFragment cif = new InstalledCoreInfoFragment();
// Set the core path as an argument.
// This will allow us to re-retrieve information if the Fragment
// is destroyed upon state changes
Bundle args = new Bundle();
args.putString("core_path", core.getUnderlyingFile().getPath());
cif.setArguments(args);
return cif;
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
// Inflate the view.
ListView infoView = (ListView) inflater.inflate(R.layout.coremanager_listview, container, false);
// Get the appropriate info providers.
final Bundle args = getArguments();
final ModuleWrapper core = new ModuleWrapper(getActivity(), new File(args.getString("core_path")));
// Initialize the core info.
CoreInfoAdapter adapter = new CoreInfoAdapter(getActivity(), android.R.layout.simple_list_item_2);
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_displayNameTitle), core.getDisplayName()));
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_internalNameTitle), core.getInternalName()));
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_systemNameTitle), core.getEmulatedSystemName()));
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_manufacturer), core.getManufacturer()));
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_author), core.getAuthors()));
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_licenseTitle), core.getCoreLicense()));
adapter.add(new InstalledCoreInfoItem(getString(R.string.core_info_permissions), core.getPermissions()));
// Set the list adapter.
infoView.setAdapter(adapter);
return infoView;
}
/**
* Adapter backing this InstalledCoreInfoFragment
*/
private final class CoreInfoAdapter extends ArrayAdapter<InstalledCoreInfoItem>
{
private final Context context;
private final int resourceId;
/**
* Constructor
*
* @param context The current {@link Context}.
* @param resourceId The resource ID for a layout file containing a layout to use when instantiating views.
*/
public CoreInfoAdapter(Context context, int resourceId)
{
super(context, resourceId);
this.context = context;
this.resourceId = resourceId;
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
if (convertView == null)
{
LayoutInflater vi = LayoutInflater.from(context);
convertView = vi.inflate(resourceId, parent, false);
}
final InstalledCoreInfoItem item = getItem(position);
if (item != null)
{
final TextView title = (TextView) convertView.findViewById(android.R.id.text1);
final TextView subtitle = (TextView) convertView.findViewById(android.R.id.text2);
if (title != null)
{
title.setText(item.getTitle());
}
if (subtitle != null)
{
subtitle.setText(item.getSubtitle());
}
}
return convertView;
}
}
}

View File

@ -1,60 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
import java.util.List;
import android.text.TextUtils;
/**
* Represents a single list item within the InstalledCoreInfoFragment.
*/
public final class InstalledCoreInfoItem
{
private final String title;
private final String subtitle;
/**
* Constructor
*
* @param title Title of the item within the core info list.
* @param subtitle Subtitle of the item within the core info list.
*/
public InstalledCoreInfoItem(String title, String subtitle)
{
this.title = title;
this.subtitle = subtitle;
}
/**
* Constructor.
* <p>
* Allows for creating a subtitle out of multiple strings.
*
* @param title Title of the item within the core info list.
* @param subtitle List of strings to add to the subtitle section of this item.
*/
public InstalledCoreInfoItem(String title, List<String> subtitle)
{
this.title = title;
this.subtitle = TextUtils.join(", ", subtitle);
}
/**
* Gets the title of this InstalledCoreInfoItem.
*
* @return the title of this InstalledCoreInfoItem.
*/
public String getTitle()
{
return title;
}
/**
* Gets the subtitle of this InstalledCoreInfoItem.
*
* @return the subtitle of this InstalledCoreInfoItem.
*/
public String getSubtitle()
{
return subtitle;
}
}

View File

@ -1,248 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
import java.io.File;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import com.retroarch.R;
import com.retroarch.browser.ModuleWrapper;
import com.retroarch.browser.preferences.util.UserPreferences;
import android.app.AlertDialog;
import android.content.Context;
import android.content.DialogInterface;
import android.content.DialogInterface.OnClickListener;
import android.os.Bundle;
import android.support.v4.app.ListFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.AdapterView;
import android.widget.AdapterView.OnItemLongClickListener;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;
/**
* {@link ListFragment} that displays all of the currently installed cores
* <p>
* In terms of layout, this is the fragment that is placed on the
* left side of the screen within the core manager
*/
public final class InstalledCoresFragment extends ListFragment
{
// Callback for the interface.
private OnCoreItemClickedListener callback;
// Adapter backing this ListFragment.
private InstalledCoresAdapter adapter;
/**
* Interface that a parent fragment must implement
* in order to display the core info view.
*/
interface OnCoreItemClickedListener
{
/**
* The action to perform when a core is selected within the list view.
*
* @param position The position of the item in the list.
* @param core A reference to the actual {@link ModuleWrapper}
* represented by that list item.
*/
void onCoreItemClicked(int position, ModuleWrapper core);
}
@Override
public void onActivityCreated(Bundle savedInstanceState)
{
super.onActivityCreated(savedInstanceState);
adapter = new InstalledCoresAdapter(getActivity(), android.R.layout.simple_list_item_2, getInstalledCoresList());
setListAdapter(adapter);
// Get the callback. (implemented within InstalledCoresManagerFragment).
callback = (OnCoreItemClickedListener) getParentFragment();
}
@Override
public void onViewCreated(View view, Bundle savedInstanceState)
{
super.onViewCreated(view, savedInstanceState);
getListView().setOnItemLongClickListener(itemLongClickListener);
}
@Override
public void onListItemClick(ListView l, View v, int position, long id)
{
callback.onCoreItemClicked(position, adapter.getItem(position));
// Set the item as checked so it highlights in the two-fragment view.
getListView().setItemChecked(position, true);
}
/**
* Refreshes the list of installed cores.
*/
public void updateInstalledCoresList()
{
adapter.clear();
for (int i = 0; i < getInstalledCoresList().size(); i++)
{
adapter.add(getInstalledCoresList().get(i));
}
adapter.notifyDataSetChanged();
}
private List<ModuleWrapper> getInstalledCoresList()
{
// The list of items that will be added to the adapter backing this ListFragment.
final List<ModuleWrapper> items = new ArrayList<ModuleWrapper>();
// Check if the device supports NEON.
final String cpuInfo = UserPreferences.readCPUInfo();
final boolean supportsNeon = cpuInfo.contains("neon");
// Populate the list
final File[] libs = new File(getActivity().getApplicationInfo().dataDir, "/cores").listFiles();
if (libs != null)
{
for (File lib : libs)
{
String libName = lib.getName();
// Never append a NEON lib if we don't have NEON.
if (libName.contains("neon") && !supportsNeon)
continue;
// If we have a NEON version with NEON capable CPU,
// never append a non-NEON version.
if (supportsNeon && !libName.contains("neon"))
{
boolean hasNeonVersion = false;
for (File lib_ : libs)
{
String otherName = lib_.getName();
String baseName = libName.replace(".so", "");
if (otherName.contains("neon") && otherName.startsWith(baseName))
{
hasNeonVersion = true;
break;
}
}
if (hasNeonVersion)
continue;
}
// Add it to the list.
items.add(new ModuleWrapper(getActivity(), lib));
}
}
// Sort the list alphabetically
Collections.sort(items);
return items;
}
// This will be the handler for long clicks on individual list items in this ListFragment.
private final OnItemLongClickListener itemLongClickListener = new OnItemLongClickListener()
{
@Override
public boolean onItemLongClick(AdapterView<?> parent, View view, int position, long id)
{
// Begin building the AlertDialog
final ModuleWrapper item = adapter.getItem(position);
final AlertDialog.Builder alert = new AlertDialog.Builder(getActivity());
alert.setTitle(R.string.uninstall_core);
alert.setMessage(String.format(getString(R.string.uninstall_core_message), item.getText()));
alert.setNegativeButton(R.string.no, null);
alert.setPositiveButton(R.string.yes, new OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
// Attempt to uninstall the core item.
if (item.getUnderlyingFile().delete())
{
Toast.makeText(getActivity(), String.format(getString(R.string.uninstall_success), item.getText()), Toast.LENGTH_LONG).show();
adapter.remove(item);
adapter.notifyDataSetChanged();
}
else // Failed to uninstall.
{
Toast.makeText(getActivity(), String.format(getString(R.string.uninstall_failure), item.getText()), Toast.LENGTH_LONG).show();
}
}
});
alert.show();
return true;
}
};
/**
* The {@link ArrayAdapter} that backs this InstalledCoresFragment.
*/
private final class InstalledCoresAdapter extends ArrayAdapter<ModuleWrapper>
{
private final Context context;
private final int resourceId;
private final List<ModuleWrapper> 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 items The list of items to represent in this adapter.
*/
public InstalledCoresAdapter(Context context, int resourceId, List<ModuleWrapper> items)
{
super(context, resourceId, items);
this.context = context;
this.resourceId = resourceId;
this.items = items;
}
@Override
public ModuleWrapper getItem(int i)
{
return items.get(i);
}
@Override
public View getView(int position, View convertView, ViewGroup parent)
{
if (convertView == null)
{
LayoutInflater vi = LayoutInflater.from(context);
convertView = vi.inflate(resourceId, parent, false);
}
final ModuleWrapper item = items.get(position);
if (item != null)
{
TextView title = (TextView) convertView.findViewById(android.R.id.text1);
TextView subtitle = (TextView) convertView.findViewById(android.R.id.text2);
if (title != null)
{
title.setText(item.getText());
}
if (subtitle != null)
{
subtitle.setText(item.getSubText());
}
}
return convertView;
}
}
}

View File

@ -1,53 +0,0 @@
package com.retroarch.browser.coremanager.fragments;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentTransaction;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import com.retroarch.R;
import com.retroarch.browser.ModuleWrapper;
/**
* Underlying {@link Fragment} that manages layout functionality
* for the two fragments that rest inside of this one.
*/
public class InstalledCoresManagerFragment extends Fragment implements InstalledCoresFragment.OnCoreItemClickedListener
{
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
{
View v = inflater.inflate(R.layout.coremanager_installed_cores_base, container, false);
final Fragment installedCores = new InstalledCoresFragment();
final FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.replace(R.id.installed_cores_fragment_container1, installedCores, "InstalledCoresList");
ft.commit();
return v;
}
@Override
public void onCoreItemClicked(int position, ModuleWrapper core)
{
// If this view does not exist, it means the screen
// is not considered 'large' and thus, we use the single fragment layout.
if (getView().findViewById(R.id.installed_cores_fragment_container2) == null)
{
InstalledCoreInfoFragment cif = InstalledCoreInfoFragment.newInstance(core);
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.replace(R.id.installed_cores_fragment_container1, cif);
ft.addToBackStack(null);
ft.commit();
}
else // Large screen
{
InstalledCoreInfoFragment cif = InstalledCoreInfoFragment.newInstance(core);
FragmentTransaction ft = getChildFragmentManager().beginTransaction();
ft.replace(R.id.installed_cores_fragment_container2, cif);
ft.commit();
}
}
}

View File

@ -25,7 +25,6 @@ import android.widget.Toast;
import com.retroarch.R;
import com.retroarch.browser.CoreSelection;
import com.retroarch.browser.HistorySelection;
import com.retroarch.browser.NativeInterface;
import com.retroarch.browser.dirfragment.DetectCoreDirectoryFragment;
import com.retroarch.browser.dirfragment.DirectoryFragment;
@ -68,7 +67,6 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
findPreference("loadCorePref").setOnPreferenceClickListener(this);
findPreference("loadContentAutoPref").setOnPreferenceClickListener(this);
findPreference("loadContentPref").setOnPreferenceClickListener(this);
findPreference("loadContentHistoryPref").setOnPreferenceClickListener(this);
findPreference("quitRetroArch").setOnPreferenceClickListener(this);
// Extract assets.
@ -259,11 +257,6 @@ public final class MainMenuFragment extends PreferenceListFragment implements On
contentBrowser.show(getFragmentManager(), "contentBrowser");
}
// Load Content (History) Preference
else if (prefKey.equals("loadContentHistoryPref"))
{
HistorySelection.newInstance().show(getFragmentManager(), "history_selection");
}
// Quit RetroArch preference
else if (prefKey.equals("quitRetroArch"))
{

View File

@ -1,139 +0,0 @@
package com.retroarch.browser.preferences.util;
import android.content.Context;
import android.preference.DialogPreference;
import android.util.AttributeSet;
import android.util.Log;
import android.view.KeyEvent;
import android.view.LayoutInflater;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ListView;
import com.retroarch.R;
final class KeyBindEditText extends EditText
{
private KeyBindPreference pref;
public KeyBindEditText(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setBoundPreference(KeyBindPreference pref)
{
this.pref = pref;
}
@Override
public boolean onKeyPreIme(int keyCode, KeyEvent event)
{
return pref.onKey(null, event.getKeyCode(), event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
return pref.onKey(null, event.getKeyCode(), event);
}
}
final class KeyBindPreference extends DialogPreference implements View.OnKeyListener, AdapterView.OnItemClickListener, LayoutInflater.Factory {
private int key_bind_code;
private boolean grabKeyCode = false;
private KeyBindEditText keyText;
private String[] key_labels;
private final int DEFAULT_KEYCODE = 0;
private final Context context;
public KeyBindPreference(Context context, AttributeSet attrs) {
super(context, attrs);
this.context = context;
this.key_labels = getContext().getResources().getStringArray(R.array.key_bind_values);
}
private void setKey(int keyCode, boolean force)
{
if (grabKeyCode || force)
{
grabKeyCode = false;
key_bind_code = keyCode;
keyText.setText(String.format(context.getString(R.string.current_binding), key_labels[key_bind_code]));
}
}
@Override
protected View onCreateDialogView()
{
LayoutInflater inflater = LayoutInflater.from(context).cloneInContext(getContext());
inflater.setFactory(this);
View view = inflater.inflate(R.layout.key_bind_dialog, null);
keyText = (KeyBindEditText) view.findViewById(R.id.key_bind_value);
keyText.setBoundPreference(this);
view.setOnKeyListener(this);
((ListView) view.findViewById(R.id.key_bind_list)).setOnItemClickListener(this);
((Button) view.findViewById(R.id.key_bind_clear)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
setKey(0, true);
}
});
((Button) view.findViewById(R.id.key_bind_detect)).setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
grabKeyCode = true;
keyText.setText(R.string.press_key_to_use);
keyText.requestFocus();
}
});
InputMethodManager imm = (InputMethodManager) getContext().getSystemService(Context.INPUT_METHOD_SERVICE);
imm.hideSoftInputFromWindow(keyText.getWindowToken(), 0);
setKey(getPersistedInt(DEFAULT_KEYCODE), true);
return view;
}
@Override
protected void onDialogClosed(boolean positiveResult) {
super.onDialogClosed(positiveResult);
if (positiveResult) {
persistInt(key_bind_code);
notifyChanged();
}
}
@Override
public boolean onKey(View v, int keyCode, KeyEvent event) {
if (grabKeyCode && event.getAction() == KeyEvent.ACTION_DOWN && keyCode != 0 && keyCode < key_labels.length)
{
setKey(keyCode, false);
return true;
}
return false;
}
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
setKey((int)id, true);
}
@Override
public CharSequence getSummary() {
int code = getPersistedInt(DEFAULT_KEYCODE);
if (code >= key_labels.length)
return "";
else
return key_labels[code];
}
@Override
public View onCreateView(String name, Context context, AttributeSet attrs) {
Log.i("RetroArch", "view name: " + name);
if (name.equals("EditText"))
return new KeyBindEditText(context, attrs);
else
return null;
}
}

View File

@ -630,6 +630,7 @@ static void config_set_defaults(void)
settings->network.buildbot_auto_extract_archive = true;
settings->input.overlay_enable = true;
settings->input.overlay_enable_autopreferred = true;
settings->input.overlay_opacity = 0.7f;
settings->input.overlay_scale = 1.0f;
settings->input.autodetect_enable = input_autodetect_enable;
@ -1544,6 +1545,7 @@ static bool config_load_file(const char *path, bool set_defaults)
config_get_path(conf, "input_overlay", settings->input.overlay, sizeof(settings->input.overlay));
CONFIG_GET_BOOL_BASE(conf, settings, input.overlay_enable, "input_overlay_enable");
CONFIG_GET_BOOL_BASE(conf, settings, input.overlay_enable_autopreferred, "input_overlay_enable_autopreferred");
CONFIG_GET_FLOAT_BASE(conf, settings, input.overlay_opacity, "input_overlay_opacity");
CONFIG_GET_FLOAT_BASE(conf, settings, input.overlay_scale, "input_overlay_scale");
@ -2548,6 +2550,7 @@ bool config_save_file(const char *path)
*global->overlay_dir ? global->overlay_dir : "default");
config_set_path(conf, "input_overlay", settings->input.overlay);
config_set_bool(conf, "input_overlay_enable", settings->input.overlay_enable);
config_set_bool(conf, "input_overlay_enable_autopreferred", settings->input.overlay_enable_autopreferred);
config_set_float(conf, "input_overlay_opacity",
settings->input.overlay_opacity);
config_set_float(conf, "input_overlay_scale",

View File

@ -229,6 +229,7 @@ typedef struct settings
unsigned turbo_duty_cycle;
bool overlay_enable;
bool overlay_enable_autopreferred;
char overlay[PATH_MAX_LENGTH];
float overlay_opacity;
float overlay_scale;

View File

@ -26,6 +26,8 @@ static const char *menu_hash_to_str_us_label(uint32_t hash)
{
switch (hash)
{
case MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED:
return "overlay_autoload_preferred";
case MENU_LABEL_INFORMATION_LIST:
return "information_list";
case MENU_LABEL_USE_BUILTIN_PLAYER:
@ -594,6 +596,8 @@ const char *menu_hash_to_str_us(uint32_t hash)
switch (hash)
{
case MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED:
return "Auto-load preferred overlay";
case MENU_LABEL_VALUE_INFORMATION_LIST:
return "Information";
case MENU_LABEL_VALUE_USE_BUILTIN_PLAYER:

View File

@ -952,6 +952,9 @@ extern "C" {
#define MENU_LABEL_USE_BUILTIN_IMAGE_VIEWER 0x5203b5bbU
#define MENU_LABEL_VALUE_USE_BUILTIN_IMAGE_VIEWER 0x1ab45d3eU
#define MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED 0xc9298cbdU
#define MENU_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED 0x0e27e33fU
const char *menu_hash_to_str_de(uint32_t hash);
int menu_hash_get_help_de(uint32_t hash, char *s, size_t len);

View File

@ -4485,6 +4485,20 @@ static bool setting_append_list_overlay_options(
general_read_handler);
(*list)[list_info->index - 1].change_handler = overlay_enable_toggle_change_handler;
CONFIG_BOOL(
settings->input.overlay_enable,
menu_hash_to_str(MENU_LABEL_OVERLAY_AUTOLOAD_PREFERRED),
menu_hash_to_str(MENU_LABEL_VALUE_OVERLAY_AUTOLOAD_PREFERRED),
true,
menu_hash_to_str(MENU_VALUE_OFF),
menu_hash_to_str(MENU_VALUE_ON),
group_info.name,
subgroup_info.name,
parent_group,
general_write_handler,
general_read_handler);
(*list)[list_info->index - 1].change_handler = overlay_enable_toggle_change_handler;
CONFIG_BOOL(
settings->osk.enable,
menu_hash_to_str(MENU_LABEL_INPUT_OSK_OVERLAY_ENABLE),