diff --git a/reicast/android/src/com/reicast/emulator/FileBrowser.java b/reicast/android/src/com/reicast/emulator/FileBrowser.java index 27c930869..c78ef5384 100644 --- a/reicast/android/src/com/reicast/emulator/FileBrowser.java +++ b/reicast/android/src/com/reicast/emulator/FileBrowser.java @@ -37,10 +37,39 @@ public class FileBrowser extends Fragment { Vibrator vib; Drawable orig_bg; Activity parentActivity; - + boolean ImgBrowse; + OnItemSelectedListener mCallback; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); + + Bundle b = getArguments(); + if(b!=null) + ImgBrowse = b.getBoolean("ImgBrowse", true); + + } + + + + // Container Activity must implement this interface + public interface OnItemSelectedListener { + public void onGameSelected(Uri uri); + public void onFolderSelected(Uri uri); + } + + @Override + public void onAttach(Activity activity) { + super.onAttach(activity); + + // This makes sure that the container activity has implemented + // the callback interface. If not, it throws an exception + try { + mCallback = (OnItemSelectedListener) activity; + } catch (ClassCastException e) { + throw new ClassCastException(activity.toString() + + " must implement OnItemSelectedListener"); + } } @Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) @@ -206,7 +235,9 @@ public class FileBrowser extends Fragment { } } - void navigate(File root_sd) + + + void navigate(final File root_sd) { LinearLayout v = (LinearLayout)parentActivity.findViewById(R.id.game_list); v.removeAllViews(); @@ -233,14 +264,22 @@ public class FileBrowser extends Fragment { for (int i=0;i