mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
[Android] Beginning of setting menu, doesn't do anything yet.
This commit is contained in:
Generated
-1
@@ -2,7 +2,6 @@
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="" />
|
||||
<mapping directory="$PROJECT_DIR$/../.." vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
||||
Generated
+285
-132
File diff suppressed because it is too large
Load Diff
@@ -31,12 +31,18 @@
|
||||
android:theme="@android:style/Theme"
|
||||
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
|
||||
</activity>
|
||||
<activity
|
||||
<activity
|
||||
android:name="org.dolphinemu.dolphinemu.FolderBrowser"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme"
|
||||
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
|
||||
</activity>
|
||||
<activity
|
||||
android:name="org.dolphinemu.dolphinemu.SettingBrowser"
|
||||
android:label="@string/app_name"
|
||||
android:theme="@android:style/Theme"
|
||||
android:configChanges="orientation|locale|keyboard|keyboardHidden|navigation|fontScale|uiMode" >
|
||||
</activity>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -1,38 +1,26 @@
|
||||
package org.dolphinemu.dolphinemu;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.view.MenuItem;
|
||||
import android.view.View;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.ListView;
|
||||
import android.widget.Toast;
|
||||
import net.simonvt.menudrawer.MenuDrawer;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import net.simonvt.menudrawer.MenuDrawer;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.app.ListActivity;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Environment;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.Gravity;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.MenuItem;
|
||||
import android.view.Surface;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.AdapterView;
|
||||
import android.widget.BaseAdapter;
|
||||
import android.widget.ListView;
|
||||
import android.widget.TextView;
|
||||
import android.widget.Toast;
|
||||
|
||||
public class GameListView extends ListActivity {
|
||||
private GameListAdapter adapter;
|
||||
private static List<File> currentDir;
|
||||
private MenuDrawer mDrawer;
|
||||
|
||||
private SideMenuAdapter mAdapter;
|
||||
private ListView mList;
|
||||
private static GameListView me;
|
||||
public static native String GetConfig(String Key, String Value, String Default);
|
||||
public static native void SetConfig(String Key, String Value, String Default);
|
||||
@@ -66,7 +54,7 @@ public class GameListView extends ListActivity {
|
||||
fls.add(new GameListItem(getApplicationContext(), ff.getName(),"File Size: "+ff.length(),ff.getAbsolutePath()));
|
||||
}
|
||||
}
|
||||
catch(Exception e)
|
||||
catch(Exception ignored)
|
||||
{
|
||||
}
|
||||
}
|
||||
@@ -78,13 +66,10 @@ public class GameListView extends ListActivity {
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
// TODO Auto-generated method stub
|
||||
super.onListItemClick(l, v, position, id);
|
||||
GameListItem o = adapter.getItem(position);
|
||||
if(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")){
|
||||
}
|
||||
else
|
||||
{
|
||||
if(!(o.getData().equalsIgnoreCase("folder")||o.getData().equalsIgnoreCase("parent directory")))
|
||||
{
|
||||
onFileClick(o.getPath());
|
||||
}
|
||||
}
|
||||
@@ -131,8 +116,9 @@ public class GameListView extends ListActivity {
|
||||
|
||||
List<SideMenuItem>dir = new ArrayList<SideMenuItem>();
|
||||
dir.add(new SideMenuItem("Browse Folder", 0));
|
||||
dir.add(new SideMenuItem("Settings", 1));
|
||||
|
||||
mList = new ListView(this);
|
||||
ListView mList = new ListView(this);
|
||||
mAdapter = new SideMenuAdapter(this,R.layout.sidemenu,dir);
|
||||
mList.setAdapter(mAdapter);
|
||||
mList.setOnItemClickListener(mItemClickListener);
|
||||
@@ -150,6 +136,11 @@ public class GameListView extends ListActivity {
|
||||
Intent ListIntent = new Intent(me, FolderBrowser.class);
|
||||
startActivityForResult(ListIntent, 1);
|
||||
break;
|
||||
case 1:
|
||||
Toast.makeText(me, "Loading up settings", Toast.LENGTH_SHORT).show();
|
||||
Intent SettingIntent = new Intent(me, SettingBrowser.class);
|
||||
startActivityForResult(SettingIntent, 1);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,56 @@
|
||||
package org.dolphinemu.dolphinemu;
|
||||
|
||||
import android.app.ListActivity;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
import android.widget.ListView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2
|
||||
* Refer to the license.txt file included.
|
||||
*/
|
||||
|
||||
public class SettingBrowser extends ListActivity {
|
||||
private SettingMenuAdapter adapter;
|
||||
private void Fill()
|
||||
{
|
||||
this.setTitle("Settings");
|
||||
List<SettingMenuItem> dir = new ArrayList<SettingMenuItem>();
|
||||
|
||||
dir.add(new SettingMenuItem("Setting 1", "SubTitle 1", 0));
|
||||
Collections.sort(dir);
|
||||
|
||||
adapter = new SettingMenuAdapter(this,R.layout.folderbrowser,dir);
|
||||
this.setListAdapter(adapter);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onListItemClick(ListView l, View v, int position, long id) {
|
||||
super.onListItemClick(l, v, position, id);
|
||||
SettingMenuItem o = adapter.getItem(position);
|
||||
switch (o.getID())
|
||||
{
|
||||
default:
|
||||
// Do nothing yet
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
super.onCreate(savedInstanceState);
|
||||
|
||||
Fill();
|
||||
}
|
||||
@Override
|
||||
public void onBackPressed() {
|
||||
this.finish();
|
||||
super.onBackPressed();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,60 @@
|
||||
package org.dolphinemu.dolphinemu;
|
||||
|
||||
import android.content.Context;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2
|
||||
* Refer to the license.txt file included.
|
||||
*/
|
||||
|
||||
public class SettingMenuAdapter extends ArrayAdapter<SettingMenuItem>{
|
||||
|
||||
private Context c;
|
||||
private int id;
|
||||
private List<SettingMenuItem>items;
|
||||
|
||||
public SettingMenuAdapter(Context context, int textViewResourceId,
|
||||
List<SettingMenuItem> objects) {
|
||||
super(context, textViewResourceId, objects);
|
||||
c = context;
|
||||
id = textViewResourceId;
|
||||
items = objects;
|
||||
}
|
||||
public SettingMenuItem getItem(int i)
|
||||
{
|
||||
return items.get(i);
|
||||
}
|
||||
@Override
|
||||
public View getView(int position, View convertView, ViewGroup parent) {
|
||||
View v = convertView;
|
||||
if (v == null) {
|
||||
LayoutInflater vi = (LayoutInflater)c.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
|
||||
v = vi.inflate(id, null);
|
||||
if (v == null)
|
||||
return null; // This should never be hit, but have it to clear a warning
|
||||
}
|
||||
final SettingMenuItem o = items.get(position);
|
||||
if (o != null) {
|
||||
TextView t1 = (TextView) v.findViewById(R.id.TextView01);
|
||||
TextView t2 = (TextView) v.findViewById(R.id.TextView02);
|
||||
|
||||
if (t1 != null)
|
||||
t1.setText(o.getName());
|
||||
if (t2 != null)
|
||||
t2.setText(o.getSubtitle());
|
||||
}
|
||||
return v;
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.dolphinemu.dolphinemu;
|
||||
|
||||
public class SettingMenuItem implements Comparable<SettingMenuItem>{
|
||||
private String name;
|
||||
private String subtitle;
|
||||
private int m_id;
|
||||
|
||||
public SettingMenuItem(String n,String d, int id)
|
||||
{
|
||||
name = n;
|
||||
subtitle = d;
|
||||
m_id = id;
|
||||
}
|
||||
|
||||
public String getName()
|
||||
{
|
||||
return name;
|
||||
}
|
||||
|
||||
public String getSubtitle()
|
||||
{
|
||||
return subtitle;
|
||||
}
|
||||
public int getID()
|
||||
{
|
||||
return m_id;
|
||||
}
|
||||
|
||||
public int compareTo(SettingMenuItem o)
|
||||
{
|
||||
if(this.name != null)
|
||||
return this.name.toLowerCase().compareTo(o.getName().toLowerCase());
|
||||
else
|
||||
throw new IllegalArgumentException();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,11 @@
|
||||
package org.dolphinemu.dolphinemu;
|
||||
|
||||
/**
|
||||
* Copyright 2013 Dolphin Emulator Project
|
||||
* Licensed under GPLv2
|
||||
* Refer to the license.txt file included.
|
||||
*/
|
||||
|
||||
public class SideMenuItem implements Comparable<SideMenuItem>{
|
||||
private String m_name;
|
||||
private int m_id;
|
||||
|
||||
Reference in New Issue
Block a user