Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
[Android] Beginning of setting menu, doesn't do anything yet.
- Loading branch information
1 parent
10018cf
commit 252edb9
Showing
8 changed files
with
437 additions
and
129 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
56 changes: 56 additions & 0 deletions
56
Source/Android/src/org/dolphinemu/dolphinemu/SettingBrowser.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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(); | ||
| } | ||
| } |
60 changes: 60 additions & 0 deletions
60
Source/Android/src/org/dolphinemu/dolphinemu/SettingMenuAdapter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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; | ||
| } | ||
|
|
||
|
|
||
|
|
||
| } | ||
|
|
37 changes: 37 additions & 0 deletions
37
Source/Android/src/org/dolphinemu/dolphinemu/SettingMenuItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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(); | ||
| } | ||
| } | ||
|
|
6 changes: 6 additions & 0 deletions
6
Source/Android/src/org/dolphinemu/dolphinemu/SideMenuItem.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters