mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-04 11:56:48 +01:00
[Android] Allow the user to select multiple browse paths.
This commit is contained in:
parent
12d791a628
commit
b2d3dc8a68
@ -6,8 +6,6 @@ import java.io.IOException;
|
|||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
|
||||||
import net.simonvt.menudrawer.MenuDrawer;
|
|
||||||
|
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
@ -28,7 +28,7 @@ import android.widget.Toast;
|
|||||||
|
|
||||||
public class GameListView extends ListActivity {
|
public class GameListView extends ListActivity {
|
||||||
private GameListAdapter adapter;
|
private GameListAdapter adapter;
|
||||||
private static File currentDir = null;
|
private static List<File> currentDir;
|
||||||
private MenuDrawer mDrawer;
|
private MenuDrawer mDrawer;
|
||||||
|
|
||||||
private SideMenuAdapter mAdapter;
|
private SideMenuAdapter mAdapter;
|
||||||
@ -37,13 +37,19 @@ public class GameListView extends ListActivity {
|
|||||||
public static native String GetConfig(String Key, String Value, String Default);
|
public static native String GetConfig(String Key, String Value, String Default);
|
||||||
public static native void SetConfig(String Key, String Value, String Default);
|
public static native void SetConfig(String Key, String Value, String Default);
|
||||||
|
|
||||||
private void Fill(File f)
|
private void Fill()
|
||||||
{
|
{
|
||||||
File[]dirs = f.listFiles();
|
|
||||||
this.setTitle("Game List");
|
|
||||||
List<GameListItem>dir = new ArrayList<GameListItem>();
|
|
||||||
List<GameListItem>fls = new ArrayList<GameListItem>();
|
|
||||||
|
|
||||||
|
|
||||||
|
this.setTitle("Game List");
|
||||||
|
List<GameListItem>fls = new ArrayList<GameListItem>();
|
||||||
|
String Directories = GetConfig("General", "GCMPathes", "0");
|
||||||
|
int intDirectories = Integer.parseInt(Directories);
|
||||||
|
for (int a = 0; a < intDirectories; ++a)
|
||||||
|
{
|
||||||
|
String BrowseDir = GetConfig("General", "GCMPaths" + Integer.toString(a), "");
|
||||||
|
File currentDir = new File(BrowseDir);
|
||||||
|
File[]dirs = currentDir.listFiles();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
for(File ff: dirs)
|
for(File ff: dirs)
|
||||||
@ -62,12 +68,10 @@ public class GameListView extends ListActivity {
|
|||||||
catch(Exception e)
|
catch(Exception e)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
}
|
||||||
Collections.sort(dir);
|
|
||||||
Collections.sort(fls);
|
Collections.sort(fls);
|
||||||
dir.addAll(fls);
|
|
||||||
|
|
||||||
adapter = new GameListAdapter(this,R.layout.main,dir);
|
adapter = new GameListAdapter(this,R.layout.main, fls);
|
||||||
this.setListAdapter(adapter);
|
this.setListAdapter(adapter);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -103,11 +107,13 @@ public class GameListView extends ListActivity {
|
|||||||
{
|
{
|
||||||
String FileName = data.getStringExtra("Select");
|
String FileName = data.getStringExtra("Select");
|
||||||
Toast.makeText(this, "Folder Selected: " + FileName, Toast.LENGTH_SHORT).show();
|
Toast.makeText(this, "Folder Selected: " + FileName, Toast.LENGTH_SHORT).show();
|
||||||
SetConfig("General", "GCMPathes", "1");
|
String Directories = GetConfig("General", "GCMPathes", "0");
|
||||||
SetConfig("General", "GCMPaths0", FileName);
|
int intDirectories = Integer.parseInt(Directories);
|
||||||
|
Directories = Integer.toString(intDirectories + 1);
|
||||||
|
SetConfig("General", "GCMPathes", Directories);
|
||||||
|
SetConfig("General", "GCMPaths" + Integer.toString(intDirectories), FileName);
|
||||||
|
|
||||||
currentDir = new File(FileName);
|
Fill();
|
||||||
Fill(currentDir);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -119,10 +125,8 @@ public class GameListView extends ListActivity {
|
|||||||
|
|
||||||
mDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);
|
mDrawer = MenuDrawer.attach(this, MenuDrawer.MENU_DRAG_CONTENT);
|
||||||
|
|
||||||
String BrowseDir = GetConfig("General", "GCMPaths0", "");
|
|
||||||
if(currentDir == null)
|
Fill();
|
||||||
currentDir = new File(BrowseDir);
|
|
||||||
Fill(currentDir);
|
|
||||||
|
|
||||||
List<SideMenuItem>dir = new ArrayList<SideMenuItem>();
|
List<SideMenuItem>dir = new ArrayList<SideMenuItem>();
|
||||||
dir.add(new SideMenuItem("Browse Folder", 0));
|
dir.add(new SideMenuItem("Browse Folder", 0));
|
||||||
|
Loading…
x
Reference in New Issue
Block a user