From 76afc004df452384cfd00137a59c7a3e0502ff75 Mon Sep 17 00:00:00 2001 From: Xavier Ducrohet Date: Mon, 27 Sep 2010 13:58:45 -0700 Subject: [PATCH 1/3] Integrate sdk.atree changes from master. DO NOT MERGE - Move adb to the platform-tools. - Update the windows build for it. - Split the tools component from sdk.atre into sdk/build/tools.atree Change-Id: I75608f12d6e1d8bc0f470e3ca26c7e550cfdcbd6 --- build/sdk.atree | 92 +++----------------------------- build/tools/patch_windows_sdk.sh | 8 +-- 2 files changed, 11 insertions(+), 89 deletions(-) diff --git a/build/sdk.atree b/build/sdk.atree index 73bf0bcac..376592943 100644 --- a/build/sdk.atree +++ b/build/sdk.atree @@ -15,7 +15,12 @@ # # -# These are the files that comprise that SDK +# These are the files that comprise that SDK. +# +# The files that will go in the tools folder are setup through +# sdk/build/tools.atree +# This is to help when the sdk.git project is branched differently from +# the other projects. # ############################################################################## @@ -28,94 +33,12 @@ development/docs/SDK_RELEASE_NOTES RELEASE_NOTES.html # doc redirect frameworks/base/docs/docs-redirect.html documentation.html -############################################################################## -# Tools Component -############################################################################## - -# version files for the SDK updater, from sdk.git -sdk/files/tools_source.properties tools/source.properties - -# copy plugin.prop from sdk.git -sdk/files/plugin.prop tools/lib/plugin.prop - -# native host tools from out/host/$(HOST_OS)-$(HOST_ARCH)/ -bin/adb tools/adb -bin/sqlite3 tools/sqlite3 -bin/dmtracedump tools/dmtracedump -bin/etc1tool tools/etc1tool -bin/hprof-conv tools/hprof-conv -bin/mksdcard tools/mksdcard -bin/zipalign tools/zipalign - -# emulator -bin/emulator tools/emulator - -# Java-Based SDK Tools -bin/ddms tools/ddms -bin/hierarchyviewer tools/hierarchyviewer -bin/draw9patch tools/draw9patch -bin/layoutopt tools/layoutopt -bin/traceview tools/traceview -bin/android tools/android - - -# sdk.git Ant templates for project build files -sdk/templates/build.template tools/lib/build.template -sdk/templates/build.export.template tools/lib/build.export.template - -# Ant Build Rules -sdk/files/ant tools/ant -sdk/files/sdk_files_NOTICE.txt tools/ant/NOTICE.txt - -# layout device definition -sdk/files/devices.xml tools/lib/devices.xml - -# AVD Hardware property list -external/qemu/android/avd/hardware-properties.ini tools/lib/hardware-properties.ini - -# emacs support from sdk.git -sdk/files/android.el tools/lib/android.el - -# Java Libraries for the tools -framework/androidprefs.jar tools/lib/androidprefs.jar -sdk/apkbuilder/etc/apkbuilder tools/apkbuilder -framework/sdkstats.jar tools/lib/sdkstats.jar -framework/archquery.jar tools/lib/archquery.jar -framework/ddms.jar tools/lib/ddms.jar -framework/ddmlib.jar tools/lib/ddmlib.jar -framework/ddmuilib.jar tools/lib/ddmuilib.jar -framework/hierarchyviewer.jar tools/lib/hierarchyviewer.jar -framework/draw9patch.jar tools/lib/draw9patch.jar -framework/layoutopt.jar tools/lib/layoutopt.jar -framework/uix.jar tools/lib/uix.jar -framework/traceview.jar tools/lib/traceview.jar -framework/anttasks.jar tools/lib/anttasks.jar -framework/sdklib.jar tools/lib/sdklib.jar -framework/sdkuilib.jar tools/lib/sdkuilib.jar -framework/sdkmanager.jar tools/lib/sdkmanager.jar - -# 3rd Party java libraries -framework/swing-worker-1.1.jar tools/lib/swing-worker-1.1.jar -framework/groovy-all-1.7.0.jar tools/lib/groovy-all-1.7.0.jar -framework/commons-compress-1.0.jar tools/lib/commons-compress-1.0.jar -framework/emmalib.jar tools/lib/emma_device.jar -external/emma/lib/emma.jar tools/lib/emma.jar -external/emma/lib/emma_ant.jar tools/lib/emma_ant.jar -framework/org-netbeans-api-visual.jar tools/lib/org-netbeans-api-visual.jar -framework/org-openide-util.jar tools/lib/org-openide-util.jar -framework/jcommon-1.0.12.jar tools/lib/jcommon-1.0.12.jar -framework/jfreechart-1.0.9.jar tools/lib/jfreechart-1.0.9.jar -framework/jfreechart-1.0.9-swt.jar tools/lib/jfreechart-1.0.9-swt.jar -framework/org.eclipse.core.commands_3.4.0.I20080509-2000.jar tools/lib/org.eclipse.core.commands_3.4.0.I20080509-2000.jar -framework/org.eclipse.equinox.common_3.4.0.v20080421-2006.jar tools/lib/org.eclipse.equinox.common_3.4.0.v20080421-2006.jar -framework/org.eclipse.jface_3.4.2.M20090107-0800.jar tools/lib/org.eclipse.jface_3.4.2.M20090107-0800.jar -framework/osgi.jar tools/lib/osgi.jar - ############################################################################## # Platform Tools Component ############################################################################## # host tools from out/host/$(HOST_OS)-$(HOST_ARCH)/ +bin/adb platform-tools/adb bin/aapt platform-tools/aapt bin/aidl platform-tools/aidl # dx @@ -213,7 +136,6 @@ frameworks/base/docs/docs-samples-redirect.html docs/samples/index.html # Samples Component ############################################################################## - # samples to include in the sdk samples package # # the list here should match the list of samples that we generate docs for, diff --git a/build/tools/patch_windows_sdk.sh b/build/tools/patch_windows_sdk.sh index 1f3b5bdeb..edc8541cf 100755 --- a/build/tools/patch_windows_sdk.sh +++ b/build/tools/patch_windows_sdk.sh @@ -26,10 +26,10 @@ fi # Remove obsolete stuff from tools & platform TOOLS=$TEMP_SDK_DIR/tools LIB=$TEMP_SDK_DIR/tools/lib -rm $V $TOOLS/{adb,android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool} +rm $V $TOOLS/{android,apkbuilder,ddms,dmtracedump,draw9patch,emulator,etc1tool} rm $V $TOOLS/{hierarchyviewer,hprof-conv,layoutopt,mksdcard,sqlite3,traceview,zipalign} rm $V $LIB/*/swt.jar -rm $V $PLATFORM_TOOLS/{aapt,aidl,dx,dexdump} +rm $V $PLATFORM_TOOLS/{adb,aapt,aidl,dx,dexdump} # Copy all the new stuff in tools # Note: some tools are first copied here and then moved in platforms//tools/ @@ -80,7 +80,7 @@ cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator $JETCREATOR/ cp -r $V ${TOPDIR}external/sonivox/jet_tools/JetCreator_content $JETDEMOCONTENT/ cp -r $V ${TOPDIR}external/sonivox/jet_tools/logic_templates $JETLOGICTEMPLATES/ chmod $V -R u+w $JETCREATOR # fixes an issue where Cygwin might copy the above as u+rx only -cp $V ${TOPDIR}prebuilt/windows/jetcreator/EASDLL.dll $JETCREATOR/ +cp $V ${TOPDIR}prebuilt/windows/jetcreator/EASDLL.dll $JETCREATOR/ cp $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines.html $JETDOC/ cp -r $V ${TOPDIR}external/sonivox/docs/JET_Authoring_Guidelines_files $JETDOC/ @@ -89,7 +89,7 @@ cp -r $V ${TOPDIR}external/sonivox/docs/JET_Creator_User_Manual_files $JETDOC/ # Copy or move platform specific tools to the default platform. cp $V ${TOPDIR}dalvik/dx/etc/dx.bat $PLATFORM_TOOLS/ -mv $V $TOOLS/{aapt.exe,aidl.exe,dexdump.exe} $PLATFORM_TOOLS/ +mv $V $TOOLS/{adb.exe,aapt.exe,aidl.exe,dexdump.exe} $TOOLS/Adb*.dll $PLATFORM_TOOLS/ # When building under cygwin, mgwz.dll must be both in SDK/tools for zipalign # and in SDK/platform/XYZ/tools/ for aapt From c70ceb2363a444680aa17c8dcefbf8075e83cc91 Mon Sep 17 00:00:00 2001 From: Nick Kralevich Date: Thu, 30 Sep 2010 14:14:17 -0700 Subject: [PATCH 2/3] initial checkin. Needs lots of love. Change-Id: I126e355af94915d60d7a97bc3bee84e0a2ad61d4 --- apps/Tag/Android.mk | 17 ++++ apps/Tag/AndroidManifest.xml | 35 ++++++++ apps/Tag/res/drawable/ic_tab_artists.xml | 8 ++ apps/Tag/res/drawable/ic_tab_artists_grey.png | Bin 0 -> 791 bytes .../Tag/res/drawable/ic_tab_artists_white.png | Bin 0 -> 1127 bytes apps/Tag/res/layout/hello_activity.xml | 25 ++++++ apps/Tag/res/layout/main.xml | 21 +++++ apps/Tag/res/menu/mailbox_menu.xml | 22 +++++ apps/Tag/res/values/strings.xml | 23 +++++ .../src/com/android/apps/tag/TagDBHelper.java | 56 ++++++++++++ .../Tag/src/com/android/apps/tag/TagList.java | 84 ++++++++++++++++++ .../com/android/apps/tag/TagListAdapter.java | 64 +++++++++++++ .../src/com/android/apps/tag/TagSelector.java | 67 ++++++++++++++ apps/Tag/src/com/android/apps/tag/TagUi.java | 26 ++++++ apps/Tag/src/com/android/apps/tag/Tags.java | 63 +++++++++++++ apps/Tag/tests/Android.mk | 14 +++ apps/Tag/tests/AndroidManifest.xml | 32 +++++++ apps/Tag/tests/build.properties | 1 + .../src/com/android/apps/tag/TagsTest.java | 40 +++++++++ 19 files changed, 598 insertions(+) create mode 100644 apps/Tag/Android.mk create mode 100644 apps/Tag/AndroidManifest.xml create mode 100644 apps/Tag/res/drawable/ic_tab_artists.xml create mode 100644 apps/Tag/res/drawable/ic_tab_artists_grey.png create mode 100644 apps/Tag/res/drawable/ic_tab_artists_white.png create mode 100644 apps/Tag/res/layout/hello_activity.xml create mode 100644 apps/Tag/res/layout/main.xml create mode 100644 apps/Tag/res/menu/mailbox_menu.xml create mode 100644 apps/Tag/res/values/strings.xml create mode 100644 apps/Tag/src/com/android/apps/tag/TagDBHelper.java create mode 100644 apps/Tag/src/com/android/apps/tag/TagList.java create mode 100644 apps/Tag/src/com/android/apps/tag/TagListAdapter.java create mode 100644 apps/Tag/src/com/android/apps/tag/TagSelector.java create mode 100644 apps/Tag/src/com/android/apps/tag/TagUi.java create mode 100644 apps/Tag/src/com/android/apps/tag/Tags.java create mode 100644 apps/Tag/tests/Android.mk create mode 100644 apps/Tag/tests/AndroidManifest.xml create mode 100644 apps/Tag/tests/build.properties create mode 100644 apps/Tag/tests/src/com/android/apps/tag/TagsTest.java diff --git a/apps/Tag/Android.mk b/apps/Tag/Android.mk new file mode 100644 index 000000000..949cd3f6b --- /dev/null +++ b/apps/Tag/Android.mk @@ -0,0 +1,17 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_MODULE_TAGS := optional + +# Only compile source java files in this apk. +LOCAL_SRC_FILES := $(call all-java-files-under, src) + +LOCAL_PACKAGE_NAME := TagApp +# LOCAL_PROGUARD_EABLED := disabled + +# LOCAL_SDK_VERSION := current + +include $(BUILD_PACKAGE) + +# Use the following include to make our test apk. +include $(call all-makefiles-under,$(LOCAL_PATH)) diff --git a/apps/Tag/AndroidManifest.xml b/apps/Tag/AndroidManifest.xml new file mode 100644 index 000000000..44c96c205 --- /dev/null +++ b/apps/Tag/AndroidManifest.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + diff --git a/apps/Tag/res/drawable/ic_tab_artists.xml b/apps/Tag/res/drawable/ic_tab_artists.xml new file mode 100644 index 000000000..a100b7cc2 --- /dev/null +++ b/apps/Tag/res/drawable/ic_tab_artists.xml @@ -0,0 +1,8 @@ + + + + + + + diff --git a/apps/Tag/res/drawable/ic_tab_artists_grey.png b/apps/Tag/res/drawable/ic_tab_artists_grey.png new file mode 100644 index 0000000000000000000000000000000000000000..9baa30eac584bf58444ca357f4ebfbf363daa0a8 GIT binary patch literal 791 zcmV+y1L*vTP)Y|nFho{Fe_M)6g-F0vw(OeOb{S|F#LfI7*kVIF9B&?C|?PPE1=de%$hZe zkqJo>1nvWII*@m2#BQvu@J*bMj!%QI;42uk=S=uw9ejg$a@0HW9cSXtr$O=ZkP z>N^g^R=|V=kA>}6G#`Nm94{6FK#A@Wp>$virN7`XM3I!#gOO2cH43B6~VC{pSPmd?4Nh#A3vFfenb0fjA3@4S_fc$?2dB z_ZDkXMgwzzI1p6k0kJt$ObA-Jun`*z-bh(E6KXRXmV%X{XpEprb_NJAiVdI?z#{=z zrg%fk6jHz=Xu{MYQC}#qELwve2OEjhd<|MTgOZj!5Njhj0LOS1tlPHF9c3qYI##GA-4`x>;tx`q-56a(>GXe09xR7{b8 z9u-(tgEq=T@g!P;4oF5~$3baO+bRS{E&l}C6Dfm+00_ilE5z~D2FM@^n(9H(a1g2< z)M{Lfr%em0hF(MYAcroZG!Z64YnFCs4N{EO@nc5Q50eV0j1Z}v|3LJ;pp*Lu%V*t{= Vpy{A9EaLzG002ovPDHLkV1lTqG^GFl literal 0 HcmV?d00001 diff --git a/apps/Tag/res/drawable/ic_tab_artists_white.png b/apps/Tag/res/drawable/ic_tab_artists_white.png new file mode 100644 index 0000000000000000000000000000000000000000..3b010d536ade7f97d2b906d855733fb406daf748 GIT binary patch literal 1127 zcmV-t1ep7YP)R~<&4ZG zWjQx@`8sEwFNUQ1zP0{DFFd^4`QG z_1edeEBVexF61O`(KNt(zT1u~4h{}lP21=Xm;soLhCHdSui$$e$VuEHKR`5J>yIBf zasbAM0DR~S#k7@yxDz8I7Be3`$VuG7444-cg{xN}IqDhJn)BdbiQ%(uz5&`K2MwtOPuU)b4c#I?R z1w_4RZ*RhJXHK6!igW$^{NjgACX+{wNGg@$yZ)-zfA}=`ZEyf(8`NqQqesyvmQx;TD{8SJAmh&n4sPW-@^cr&5aG^+_%?lZ4Ece z%JSi&oqO8Uq~Y!eW<3gp0?${8`2zfZ{YTNTQLC-SSPxL4Vu<-=YGMBiVm63$eDH+IJg#za(KpQo1TEbdftHavwRm=wV!i?=)WvA7Xu1 zciY1UHATBK_uQfy(dJs5PNqu5U2%$cW`q)D?I3;>+`EfqPir)mHI002ovPDHLkV1m}t7~TK? literal 0 HcmV?d00001 diff --git a/apps/Tag/res/layout/hello_activity.xml b/apps/Tag/res/layout/hello_activity.xml new file mode 100644 index 000000000..d4f5fe669 --- /dev/null +++ b/apps/Tag/res/layout/hello_activity.xml @@ -0,0 +1,25 @@ + + + + + + diff --git a/apps/Tag/res/layout/main.xml b/apps/Tag/res/layout/main.xml new file mode 100644 index 000000000..dd8a07cbe --- /dev/null +++ b/apps/Tag/res/layout/main.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/apps/Tag/res/menu/mailbox_menu.xml b/apps/Tag/res/menu/mailbox_menu.xml new file mode 100644 index 000000000..8bb8d7b4d --- /dev/null +++ b/apps/Tag/res/menu/mailbox_menu.xml @@ -0,0 +1,22 @@ + + + + + + diff --git a/apps/Tag/res/values/strings.xml b/apps/Tag/res/values/strings.xml new file mode 100644 index 000000000..3d0432765 --- /dev/null +++ b/apps/Tag/res/values/strings.xml @@ -0,0 +1,23 @@ + + + + + + Hello, World! + help and info + Saved + + diff --git a/apps/Tag/src/com/android/apps/tag/TagDBHelper.java b/apps/Tag/src/com/android/apps/tag/TagDBHelper.java new file mode 100644 index 000000000..15c18f3ba --- /dev/null +++ b/apps/Tag/src/com/android/apps/tag/TagDBHelper.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + +import android.content.Context; +import android.database.sqlite.SQLiteDatabase; +import android.database.sqlite.SQLiteOpenHelper; + +/** + * @author nnk@google.com (Nick Kralevich) + */ +public class TagDBHelper extends SQLiteOpenHelper { + + private static final int DATABASE_VERSION = 1; + private static final String TABLE_CREATE = "create table Tags (" + + "_id INTEGER PRIMARY KEY ASC, " + + "description TEXT, " + + "date TEXT" + + ")"; + + private static final String FAKE_DATA = + "INSERT INTO Tags (description) values ('hello world')"; + + private static final String FAKE_DATA2 = + "INSERT INTO Tags (description) values ('hi world')"; + + + public TagDBHelper(Context context) { + super(context, "Tags.db", null, DATABASE_VERSION); + } + + @Override + public void onCreate(SQLiteDatabase db) { + db.execSQL(TABLE_CREATE); + db.execSQL(FAKE_DATA); + db.execSQL(FAKE_DATA2); + } + + @Override + public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) { + } +} diff --git a/apps/Tag/src/com/android/apps/tag/TagList.java b/apps/Tag/src/com/android/apps/tag/TagList.java new file mode 100644 index 000000000..5abd35bf9 --- /dev/null +++ b/apps/Tag/src/com/android/apps/tag/TagList.java @@ -0,0 +1,84 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + +import android.app.AlertDialog; +import android.app.Dialog; +import android.app.ListActivity; +import android.content.DialogInterface; +import android.database.Cursor; +import android.database.sqlite.SQLiteDatabase; +import android.os.Bundle; +import android.provider.Contacts; +import android.view.Menu; +import android.view.View; +import android.widget.ListView; +import android.widget.SimpleCursorAdapter; +import com.trustedlogic.trustednfc.android.NfcManager; + +/** + * @author nnk@google.com (Nick Kralevich) + */ +public class TagList extends ListActivity implements DialogInterface.OnClickListener { + + private NfcManager mManager; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + SQLiteDatabase db = new TagDBHelper(this.getBaseContext()).getReadableDatabase(); + Cursor c = db.query("Tags", new String[] { "_id", "description" }, null, null, null, null, null); + SimpleCursorAdapter sca = + new SimpleCursorAdapter(this, + android.R.layout.two_line_list_item, + c, + new String[] { "description" }, + new int[] { android.R.id.text1 }); + + setListAdapter(sca); + registerForContextMenu(getListView()); + } + + @Override + public boolean onCreateOptionsMenu(Menu menu) { + super.onCreateOptionsMenu(menu); + menu.add("hello world"); + return true; + } + + @Override + protected Dialog onCreateDialog(int id, Bundle args) { + String[] stuff = new String[] { "a", "b" }; + return new AlertDialog.Builder(this) + .setTitle("blah") + .setItems(stuff, this) + .setPositiveButton("Delete", null) + .setNegativeButton("Cancel", null) + .create(); + } + + @Override + protected void onListItemClick(ListView l, View v, int position, long id) { + showDialog(1); + super.onListItemClick(l, v, position, id); + } + + @Override + public void onClick(DialogInterface dialog, int which) { } + +} diff --git a/apps/Tag/src/com/android/apps/tag/TagListAdapter.java b/apps/Tag/src/com/android/apps/tag/TagListAdapter.java new file mode 100644 index 000000000..45a8a1178 --- /dev/null +++ b/apps/Tag/src/com/android/apps/tag/TagListAdapter.java @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + +import android.content.Context; +import android.view.View; +import android.view.ViewGroup; +import android.widget.BaseAdapter; +import android.widget.TextView; + +/** + * @author nnk@google.com (Nick Kralevich) + */ +public class TagListAdapter extends BaseAdapter { + + private Context context; + + TagListAdapter(Context context) { + this.context = context; + } + + private static final String[] listItems = { + "Welcome! T2000 Festival", + "Free songs by Hula 88", + "Welcome to FreeBucks", + "BooBox Movie Coupons" + }; + + @Override + public int getCount() { + return listItems.length; + } + + @Override + public String getItem(int position) { + return listItems[position]; + } + + @Override + public long getItemId(int position) { + return position; + } + + @Override + public View getView(int position, View convertView, ViewGroup parent) { + TextView tv = new TextView(context); + tv.setText(getItem(position)); + return tv; + } +} diff --git a/apps/Tag/src/com/android/apps/tag/TagSelector.java b/apps/Tag/src/com/android/apps/tag/TagSelector.java new file mode 100644 index 000000000..a6c034547 --- /dev/null +++ b/apps/Tag/src/com/android/apps/tag/TagSelector.java @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + +import android.app.Activity; +import android.app.AlertDialog; +import android.app.Dialog; +import android.os.Bundle; +import android.view.View; +import android.widget.TextView; + +/** + * A minimal "Hello, World!" application. + */ +public class TagSelector extends Activity { + private static final int DIALOG = 1; + private static final String[] elements = { "hello world" }; + + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + + final TextView tv = new TextView(this); + tv.setText("hello world"); + tv.setOnClickListener(new View.OnClickListener() { + public void onClick(View v) { + tv.setText("clicked!"); + showAlert(); + } + }); + + setContentView(tv); + + // Set the layout for this activity. You can find it + // in res/layout/hello_activity.xml + // setContentView(R.layout.hello_activity); + } + + @Override + protected Dialog onCreateDialog(int id, Bundle bundle) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setTitle("Welcome "); + builder.setCancelable(true); + builder.setItems(elements, null); + return builder.create(); + } + + + private void showAlert() { + showDialog(DIALOG); + } +} + diff --git a/apps/Tag/src/com/android/apps/tag/TagUi.java b/apps/Tag/src/com/android/apps/tag/TagUi.java new file mode 100644 index 000000000..98f384244 --- /dev/null +++ b/apps/Tag/src/com/android/apps/tag/TagUi.java @@ -0,0 +1,26 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + + +/** + * @author nnk@google.com (Nick Kralevich) + */ +public class TagUi { + + +} diff --git a/apps/Tag/src/com/android/apps/tag/Tags.java b/apps/Tag/src/com/android/apps/tag/Tags.java new file mode 100644 index 000000000..781e05e21 --- /dev/null +++ b/apps/Tag/src/com/android/apps/tag/Tags.java @@ -0,0 +1,63 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + +import android.app.TabActivity; +import android.content.Intent; +import android.content.res.Resources; +import android.os.Bundle; +import android.widget.TabHost; + +/** + * A minimal "Hello, World!" application. + */ +public class Tags extends TabActivity { + /** + * Called with the activity is first created. + */ + @Override + public void onCreate(Bundle savedInstanceState) { + super.onCreate(savedInstanceState); + setContentView(R.layout.main); + + Resources res = getResources(); + TabHost tabHost = getTabHost(); + Intent i = new Intent().setClass(this, TagList.class); + + Intent iSavedList = new Intent().setClass(this, TagList.class); + Intent iRecentList = new Intent().setClass(this, TagList.class); + Intent iMyTagList = new Intent().setClass(this, TagList.class); + + + TabHost.TabSpec spec1 = tabHost.newTabSpec("1") + .setIndicator("Saved", res.getDrawable(R.drawable.ic_tab_artists)) + .setContent(iSavedList); + tabHost.addTab(spec1); + + TabHost.TabSpec spec2 = tabHost.newTabSpec("2") + .setIndicator("Recent", res.getDrawable(R.drawable.ic_tab_artists)) + .setContent(iRecentList); + tabHost.addTab(spec2); + + TabHost.TabSpec spec3 = tabHost.newTabSpec("3") + .setIndicator("My Tag", res.getDrawable(R.drawable.ic_tab_artists)) + .setContent(iMyTagList); + tabHost.addTab(spec3); + + } +} + diff --git a/apps/Tag/tests/Android.mk b/apps/Tag/tests/Android.mk new file mode 100644 index 000000000..d0a36d7c6 --- /dev/null +++ b/apps/Tag/tests/Android.mk @@ -0,0 +1,14 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(call all-subdir-java-files) + +LOCAL_JAVA_LIBRARIES := android.test.runner + +LOCAL_PACKAGE_NAME := TagAppTests + +LOCAL_MODULE_TAGS := tests + +LOCAL_INSTRUMENTATION_FOR := TagApp + +include $(BUILD_PACKAGE) diff --git a/apps/Tag/tests/AndroidManifest.xml b/apps/Tag/tests/AndroidManifest.xml new file mode 100644 index 000000000..f4e79ed34 --- /dev/null +++ b/apps/Tag/tests/AndroidManifest.xml @@ -0,0 +1,32 @@ + + + + + + + + + + + + + + diff --git a/apps/Tag/tests/build.properties b/apps/Tag/tests/build.properties new file mode 100644 index 000000000..e0c39def1 --- /dev/null +++ b/apps/Tag/tests/build.properties @@ -0,0 +1 @@ +tested.project.dir=.. diff --git a/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java b/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java new file mode 100644 index 000000000..a0bc2247c --- /dev/null +++ b/apps/Tag/tests/src/com/android/apps/tag/TagsTest.java @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.apps.tag; + +import android.test.ActivityInstrumentationTestCase2; + +/** + * Make sure that the main launcher activity opens up properly, which will be + * verified by {@link #testActivityTestCaseSetUpProperly}. + */ +public class TagsTest extends ActivityInstrumentationTestCase2 { + + /** + * Creates an {@link ActivityInstrumentationTestCase2} for the {@link Tags} activity. + */ + public TagsTest() { + super(Tags.class); + } + + /** + * Verifies that the activity under test can be launched. + */ + public void testActivityTestCaseSetUpProperly() { + assertNotNull("activity should be launched successfully", getActivity()); + } +} From fc1ee063695ad11b2b6123f206b3befa8e830d75 Mon Sep 17 00:00:00 2001 From: Jeff Brown Date: Wed, 29 Sep 2010 20:51:48 -0700 Subject: [PATCH 3/3] Improve touch paint sample to use geometrical touch width. Added multitouch support. Fixed the trackball based drawing. Change-Id: I15d9c5c4ac26a83f476f98c1f2ef3a5841e2ffbd --- .../android/apis/graphics/TouchPaint.java | 83 +++++++++---------- 1 file changed, 40 insertions(+), 43 deletions(-) diff --git a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java index 094285206..14e6c4f71 100644 --- a/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java +++ b/samples/ApiDemos/src/com/example/android/apis/graphics/TouchPaint.java @@ -159,21 +159,20 @@ public class TouchPaint extends GraphicsActivity { public class MyView extends View { private static final int FADE_ALPHA = 0x06; private static final int MAX_FADE_STEPS = 256/FADE_ALPHA + 4; + private static final int TRACKBALL_SCALE = 10; + private Bitmap mBitmap; private Canvas mCanvas; private final Rect mRect = new Rect(); private final Paint mPaint; private final Paint mFadePaint; - private boolean mCurDown; - private int mCurX; - private int mCurY; - private float mCurPressure; - private float mCurSize; - private int mCurWidth; + private float mCurX; + private float mCurY; private int mFadeSteps = MAX_FADE_STEPS; public MyView(Context c) { super(c); + setFocusable(true); mPaint = new Paint(); mPaint.setAntiAlias(true); mPaint.setARGB(255, 255, 255, 255); @@ -229,61 +228,59 @@ public class TouchPaint extends GraphicsActivity { } @Override public boolean onTrackballEvent(MotionEvent event) { - boolean oldDown = mCurDown; - mCurDown = true; int N = event.getHistorySize(); - int baseX = mCurX; - int baseY = mCurY; - final float scaleX = event.getXPrecision(); - final float scaleY = event.getYPrecision(); + final float scaleX = event.getXPrecision() * TRACKBALL_SCALE; + final float scaleY = event.getYPrecision() * TRACKBALL_SCALE; for (int i=0; i