From 114cf4e926e0114a2c12ba701bc3b27ad34d1aa2 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sun, 17 Nov 2013 02:37:33 -0500 Subject: [PATCH 1/5] [Android] Initial huge underlying UI update: - The UI is now mostly Fragment-centric (finally!) - The Load Core, Load Game, Load Game (History) are now DialogFragments. - The directory activities are killed off and consolidated into one fragment named DirectoryFragment. DirectoryFragment is now a self-contained instantiable DirectoryFragment that can be instantiated anywhere by doing roughly the following. DirectorFragment dFrag = DirectoryFragment.newInstance(/* Resource ID for a string title here*/); dFrag.show(getFragmentManager(), "tag"); There are also other methods that were modified within the DirectoryFragment, such as addAllowedExt and disAllowedExt being changed to support a variable amount of arguments. This way, multiple calls of the same function aren't necessary in the case of adding multiple extensions, as well as supporting the case where only one extension is added. DirectoryFragment also has a new interface added to it called OnDirectoryFragmentClosedListener. Say you have a DirectoryFragment instance, but want to use the selected item's path for something *after* the dialog has closed, with this interface, it is now possible. Just implement this interface within an Activity or Fragment, and then set the DirectoryFragment to use the listener through setOnDirectoryFragmentClosedListener() method. Now what happens if this isn't set, wouldn't it be pointless to even use a DirectoryFragment in this case? Not necessarily. What if you only wanted to save the selected item into the applications SharedPreferences? This is a situation where it would be unnecessary to need that interface. So, to make a DirectoryFragment.java for the sole purpose of saving a selected directory/file path to the SharedPreferences, you would do this: DirectoryFragment dFrag = DirectoryFragment.newInstance(/* Resource ID to a string title here*/); dFrag.setPathSettingKey("key to store value in SharedPreferences at"); dFrag.show(getFragmentManager(), "tag"); Outside of these major changes, large portions of the code outside of this were simplified. --- android/phoenix/AndroidManifest.xml | 16 +- .../res/layout/mainmenu_activity_layout.xml | 12 + .../res/layout/preference_list_fragment.xml | 77 ++++ android/phoenix/res/values/dimens.xml | 29 ++ android/phoenix/res/values/strings.xml | 15 +- android/phoenix/res/xml/input_preferences.xml | 8 +- android/phoenix/res/xml/main_menu.xml | 34 +- android/phoenix/res/xml/path_preferences.xml | 42 +- android/phoenix/res/xml/video_preferences.xml | 8 +- .../com/retroarch/browser/CoreSelection.java | 82 ++-- .../retroarch/browser/HistorySelection.java | 105 +++-- .../retroarch/browser/MainMenuActivity.java | 409 ----------------- .../com/retroarch/browser/RetroActivity.java | 18 +- .../com/retroarch/browser/RetroTVMode.java | 37 +- .../diractivities/DirectoryActivity.java | 271 ------------ .../diractivities/OverlayActivity.java | 24 - .../browser/diractivities/ROMActivity.java | 30 -- .../browser/diractivities/ROMDirActivity.java | 17 - .../browser/diractivities/SRMDirActivity.java | 17 - .../browser/diractivities/ShaderActivity.java | 23 - .../diractivities/StateDirActivity.java | 17 - .../diractivities/SystemDirActivity.java | 19 - .../dirfragment/DirectoryFragment.java | 371 ++++++++++++++++ .../browser/mainmenu/MainMenuActivity.java | 74 ++++ .../browser/mainmenu/MainMenuFragment.java | 416 ++++++++++++++++++ .../{fragments => }/PreferenceActivity.java | 7 +- .../fragments/InputPreferenceFragment.java | 79 ++-- .../fragments/PathPreferenceFragment.java | 52 ++- .../fragments/VideoPreferenceFragment.java | 56 ++- .../util/PreferenceListFragment.java | 303 ++++++------- .../util/PreferenceManagerCompat.java | 275 ++++++++++++ 31 files changed, 1727 insertions(+), 1216 deletions(-) create mode 100644 android/phoenix/res/layout/mainmenu_activity_layout.xml create mode 100644 android/phoenix/res/layout/preference_list_fragment.xml create mode 100644 android/phoenix/res/values/dimens.xml delete mode 100644 android/phoenix/src/com/retroarch/browser/MainMenuActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/DirectoryActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/OverlayActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/ROMActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/ROMDirActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/SRMDirActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/ShaderActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/StateDirActivity.java delete mode 100644 android/phoenix/src/com/retroarch/browser/diractivities/SystemDirActivity.java create mode 100644 android/phoenix/src/com/retroarch/browser/dirfragment/DirectoryFragment.java create mode 100644 android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuActivity.java create mode 100644 android/phoenix/src/com/retroarch/browser/mainmenu/MainMenuFragment.java rename android/phoenix/src/com/retroarch/browser/preferences/{fragments => }/PreferenceActivity.java (91%) create mode 100644 android/phoenix/src/com/retroarch/browser/preferences/fragments/util/PreferenceManagerCompat.java diff --git a/android/phoenix/AndroidManifest.xml b/android/phoenix/AndroidManifest.xml index 43bce6dae3..e927b08cf7 100644 --- a/android/phoenix/AndroidManifest.xml +++ b/android/phoenix/AndroidManifest.xml @@ -6,7 +6,7 @@ + android:targetSdkVersion="19" /> @@ -15,10 +15,8 @@ android:icon="@drawable/ic_launcher" android:label="@string/app_name" android:hasCode="true"> - - - + @@ -28,15 +26,7 @@ - - - - - - - - - + diff --git a/android/phoenix/res/layout/mainmenu_activity_layout.xml b/android/phoenix/res/layout/mainmenu_activity_layout.xml new file mode 100644 index 0000000000..e5c7370437 --- /dev/null +++ b/android/phoenix/res/layout/mainmenu_activity_layout.xml @@ -0,0 +1,12 @@ + + + + + + diff --git a/android/phoenix/res/layout/preference_list_fragment.xml b/android/phoenix/res/layout/preference_list_fragment.xml new file mode 100644 index 0000000000..009a61483a --- /dev/null +++ b/android/phoenix/res/layout/preference_list_fragment.xml @@ -0,0 +1,77 @@ + + + + + + + + + + + +