Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

remove header view for more space and replace it by 'This' information

  • Loading branch information...
commit 9cb728d53b5be99150223516a9f9ea38a1822cb7 1 parent 90d7e60
@jrudolph authored
View
3  gen/net/virtualvoid/android/browser/R.java
@@ -16,9 +16,7 @@
public static final int yoodoo=0x7f020002;
}
public static final class id {
- public static final int clazz=0x7f050005;
public static final int name=0x7f050000;
- public static final int object=0x7f050004;
public static final int result_type=0x7f050001;
public static final int value=0x7f050002;
public static final int valueDrawable=0x7f050003;
@@ -27,7 +25,6 @@
public static final int group=0x7f030000;
public static final int item=0x7f030001;
public static final int main=0x7f030002;
- public static final int object=0x7f030003;
}
public static final class string {
public static final int app_name=0x7f040000;
View
1  res/layout/main.xml
@@ -4,7 +4,6 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
- <include layout="@layout/object"/>
<ExpandableListView
android:id="@id/android:list"
android:layout_width="fill_parent"
View
25 res/layout/object.xml
@@ -1,25 +0,0 @@
-<LinearLayout
- xmlns:android="http://schemas.android.com/apk/res/android"
- android:orientation="vertical"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
->
- <TextView
- android:id="@+id/object"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="You should not see this"
- android:textStyle="bold"
- android:textAppearance="?android:attr/textAppearanceMediumInverse"
- android:background="#ffffff"
- android:maxHeight="100dip"
- />
- <TextView
- android:id="@+id/clazz"
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="You should not see this"
- android:textAppearance="?android:attr/textAppearanceMediumInverse"
- android:background="#ffffff"
- />
-</LinearLayout>
View
49 src/net/virtualvoid/android/browser/ItemFactory.java
@@ -89,6 +89,22 @@ public int size() {
}
};
}
+ private static ItemList fromArray(final String name,final Item...is){
+ return new ItemList(){
+ @Override
+ public Item get(int position) {
+ return is[position];
+ }
+ @Override
+ public CharSequence getName() {
+ return name;
+ }
+ @Override
+ public int size() {
+ return is.length;
+ }
+ };
+ }
private static ItemList join(final String name,final ItemList list1,final ItemList list2){
return new ItemList(){
@Override
@@ -444,6 +460,37 @@ public CharSequence getName() {
}
};
}
+ private static ItemList informationFor(final Object o){
+ return fromArray("This"
+ ,new Item(){
+ @Override
+ public Object get() {
+ return o.toString();
+ }
+ @Override
+ public CharSequence getName() {
+ return "String representation";
+ }
+ @Override
+ public Class<?> getReturnType() {
+ return String.class;
+ }
+ }
+ ,new Item(){
+ @Override
+ public Object get() {
+ return o.getClass();
+ }
+ @Override
+ public CharSequence getName() {
+ return "Class";
+ }
+ @Override
+ public Class<?> getReturnType() {
+ return Class.class;
+ }
+ });
+ }
private static void add(ArrayList<ItemList> list,ItemList il){
if (il.size() > 0)
@@ -452,6 +499,8 @@ private static void add(ArrayList<ItemList> list,ItemList il){
public static ArrayList<ItemList> itemsFor(Object o){
ArrayList<ItemList> res = new ArrayList<ItemList>();
+ add(res,informationFor(o));
+
if (o.getClass().isArray())
add(res,elementsOfArray(o));
else if (o instanceof Map)
View
10 src/net/virtualvoid/android/browser/ObjectBrowserView.java
@@ -27,6 +27,7 @@
public class ObjectBrowserView extends ExpandableListActivity {
private LayoutInflater inflater;
+ private Adapter myAdapter;
private ObjectBrowser getApp(){
return (ObjectBrowser) getApplication();
@@ -39,7 +40,8 @@ public void onCreate(Bundle savedInstanceState) {
inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
- setListAdapter(new Adapter());
+ myAdapter = new Adapter();
+ setListAdapter(myAdapter);
setContentView(R.layout.main);
setObject(getApp().getCurrent());
@@ -55,15 +57,13 @@ private void setObject(HistoryItem item){
if (current == null)
return;
- ((TextView)findViewById(R.id.object)).setText(Html.fromHtml(ItemFactory.toString(current)));
- ((TextView)findViewById(R.id.clazz)).setText(current.getClass().getCanonicalName());
+ ExpandableListView list = getExpandableListView();
items.clear();
items.addAll(ItemFactory.itemsFor(current));
- ((Adapter)getExpandableListAdapter()).notifyDataSetInvalidated();
+ myAdapter.notifyDataSetInvalidated();
- ExpandableListView list = getExpandableListView();
// HACK: call layoutChildren before setting the selection, since
// setSelection will not work otherwise
Tools.layoutChildren(list);
Please sign in to comment.
Something went wrong with that request. Please try again.