Permalink
Browse files

initial version

  • Loading branch information...
1 parent 43bb48b commit 7ff55d6321d9113027ae028d83ad35794d161179 @jrudolph committed May 1, 2009
View
@@ -2,5 +2,6 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="com.android.ide.eclipse.adt.ANDROID_FRAMEWORK"/>
+ <classpathentry kind="src" path="gen"/>
<classpathentry kind="output" path="bin"/>
</classpath>
@@ -0,0 +1,54 @@
+#Fri May 01 21:20:47 CEST 2009
+eclipse.preferences.version=1
+editor_save_participant_org.eclipse.jdt.ui.postsavelistener.cleanup=true
+sp_cleanup.add_default_serial_version_id=true
+sp_cleanup.add_generated_serial_version_id=false
+sp_cleanup.add_missing_annotations=true
+sp_cleanup.add_missing_deprecated_annotations=true
+sp_cleanup.add_missing_methods=false
+sp_cleanup.add_missing_nls_tags=false
+sp_cleanup.add_missing_override_annotations=true
+sp_cleanup.add_serial_version_id=false
+sp_cleanup.always_use_blocks=true
+sp_cleanup.always_use_parentheses_in_expressions=false
+sp_cleanup.always_use_this_for_non_static_field_access=false
+sp_cleanup.always_use_this_for_non_static_method_access=false
+sp_cleanup.convert_to_enhanced_for_loop=false
+sp_cleanup.correct_indentation=false
+sp_cleanup.format_source_code=false
+sp_cleanup.format_source_code_changes_only=false
+sp_cleanup.make_local_variable_final=false
+sp_cleanup.make_parameters_final=false
+sp_cleanup.make_private_fields_final=true
+sp_cleanup.make_type_abstract_if_missing_method=false
+sp_cleanup.make_variable_declarations_final=true
+sp_cleanup.never_use_blocks=false
+sp_cleanup.never_use_parentheses_in_expressions=true
+sp_cleanup.on_save_use_additional_actions=false
+sp_cleanup.organize_imports=true
+sp_cleanup.qualify_static_field_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_member_accesses_through_instances_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_through_subtypes_with_declaring_class=true
+sp_cleanup.qualify_static_member_accesses_with_declaring_class=false
+sp_cleanup.qualify_static_method_accesses_with_declaring_class=false
+sp_cleanup.remove_private_constructors=true
+sp_cleanup.remove_trailing_whitespaces=false
+sp_cleanup.remove_trailing_whitespaces_all=true
+sp_cleanup.remove_trailing_whitespaces_ignore_empty=false
+sp_cleanup.remove_unnecessary_casts=true
+sp_cleanup.remove_unnecessary_nls_tags=false
+sp_cleanup.remove_unused_imports=false
+sp_cleanup.remove_unused_local_variables=false
+sp_cleanup.remove_unused_private_fields=true
+sp_cleanup.remove_unused_private_members=false
+sp_cleanup.remove_unused_private_methods=true
+sp_cleanup.remove_unused_private_types=true
+sp_cleanup.sort_members=false
+sp_cleanup.sort_members_all=false
+sp_cleanup.use_blocks=false
+sp_cleanup.use_blocks_only_for_return_and_throw=false
+sp_cleanup.use_parentheses_in_expressions=false
+sp_cleanup.use_this_for_non_static_field_access=false
+sp_cleanup.use_this_for_non_static_field_access_only_if_necessary=true
+sp_cleanup.use_this_for_non_static_method_access=false
+sp_cleanup.use_this_for_non_static_method_access_only_if_necessary=true
View
@@ -2,7 +2,7 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="net.virtualvoid.android.browser"
android:versionCode="1"
- android:versionName="1.0.0">
+ android:versionName="0.0.1">
<application android:icon="@drawable/icon" android:label="@string/app_name">
<activity android:name=".APIBrowser"
android:label="@string/app_name">
@@ -12,4 +12,4 @@
</intent-filter>
</activity>
</application>
-</manifest>
+</manifest>
View
@@ -0,0 +1,22 @@
+# This file is automatically generated by Android Tools.
+# Do not modify this file -- YOUR CHANGES WILL BE ERASED!
+#
+# This file must be checked in Version Control Systems.
+#
+# To customize properties used by the Ant build system use,
+# "build.properties", and override values to adapt the script to your
+# project structure.
+
+# Project target.
+target=android-2
+# apk configurations. This property allows creation of APK files with limited
+# resources. For example, if your application contains many locales and
+# you wish to release multiple smaller apks instead of a large one, you can
+# define configuration to create apks with limited language sets.
+# Format is a comma separated list of configuration names. For each
+# configuration, a property will declare the resource configurations to
+# include. Example:
+# apk-configurations=european,northamerica
+# apk-config-european=en,fr,it,de,es
+# apk-config-northamerica=en,es
+apk-configurations=
@@ -13,11 +13,16 @@
public static final class drawable {
public static final int icon=0x7f020000;
}
+ public static final class id {
+ public static final int name=0x7f050001;
+ public static final int object=0x7f050000;
+ public static final int result_type=0x7f050002;
+ }
public static final class layout {
public static final int main=0x7f030000;
+ public static final int method=0x7f030001;
}
public static final class string {
- public static final int app_name=0x7f040001;
- public static final int hello=0x7f040000;
+ public static final int app_name=0x7f040000;
}
}
View
@@ -4,9 +4,16 @@
android:layout_width="fill_parent"
android:layout_height="fill_parent"
>
-<TextView
- android:layout_width="fill_parent"
- android:layout_height="wrap_content"
- android:text="@string/hello"
+ <TextView
+ android:id="@+id/object"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:text="You should not see this"
/>
+ <ListView
+ android:id="@id/android:list"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ android:layout_weight="1"
+ android:drawSelectorOnTop="false"/>
</LinearLayout>
View
@@ -0,0 +1,18 @@
+<?xml version="1.0" encoding="utf-8"?>
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:orientation="vertical"
+>
+ <TextView
+ android:id="@+id/name"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+ <TextView
+ android:id="@+id/result_type"
+ android:layout_width="fill_parent"
+ android:layout_height="wrap_content"
+ />
+</LinearLayout>
View
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
- <string name="hello">Hello World, APIBrowser</string>
- <string name="app_name"></string>
+
+ <string name="app_name">API Browser</string>
</resources>
@@ -1,13 +1,87 @@
package net.virtualvoid.android.browser;
-import android.app.Activity;
+import java.lang.reflect.Method;
+import java.lang.reflect.Modifier;
+import java.util.ArrayList;
+
+import android.app.ListActivity;
+import android.content.Context;
import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.BaseAdapter;
+import android.widget.ListView;
+import android.widget.TextView;
-public class APIBrowser extends Activity {
+public class APIBrowser extends ListActivity {
+ private Object current;
+ private LayoutInflater inflater;
+
/** Called when the activity is first created. */
@Override
- public void onCreate(Bundle savedInstanceState) {
+ public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
+
+ inflater = (LayoutInflater) getSystemService(Context.LAYOUT_INFLATER_SERVICE);
+
+ setListAdapter(new Adapter());
setContentView(R.layout.main);
+
+ setObject(this);
+ }
+ private ArrayList<Method> methods = new ArrayList<Method>();
+ private final static String TAG = "APIBrowser";
+
+ private void setObject(Object o){
+ this.current = o;
+ Log.d(TAG,"setObject called with "+o.toString());
+
+ ((TextView)findViewById(R.id.object)).setText(current.toString());
+
+ methods.clear();
+ for (Method m:current.getClass().getMethods()){
+ if (m.getParameterTypes().length == 0 && (m.getModifiers()&Modifier.STATIC)==0)
+ methods.add(m);
+ }
+ ((Adapter)getListAdapter()).notifyDataSetInvalidated();
}
+
+ @Override
+ protected void onListItemClick(ListView l, View v, int position, long id) {
+ Method m = methods.get(position);
+ try {
+ setObject(m.invoke(current));
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ class Adapter extends BaseAdapter{
+ @Override
+ public int getCount() {
+ return methods.size();
+ }
+ @Override
+ public Object getItem(int position) {
+ return methods.get(position);
+ }
+ @Override
+ public long getItemId(int position) {
+ return methods.get(position).hashCode();
+ }
+ @Override
+ public View getView(int position, View convertView, ViewGroup parent) {
+ if (convertView == null)
+ convertView = inflater.inflate(R.layout.method, null);
+
+ Method m = methods.get(position);
+
+ ((TextView) convertView.findViewById(R.id.name)).setText(m.getName());
+ ((TextView) convertView.findViewById(R.id.result_type)).setText(m.getReturnType().getSimpleName());
+
+ return convertView;
+ }
+ }
}

0 comments on commit 7ff55d6

Please sign in to comment.