diff options
Diffstat (limited to 'tests/gadgets')
18 files changed, 0 insertions, 695 deletions
diff --git a/tests/gadgets/GadgetHostTest/Android.mk b/tests/gadgets/GadgetHostTest/Android.mk deleted file mode 100644 index 5e04b81..0000000 --- a/tests/gadgets/GadgetHostTest/Android.mk +++ /dev/null @@ -1,11 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := user - -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_PACKAGE_NAME := GadgetHostTest -LOCAL_CERTIFICATE := platform - -include $(BUILD_PACKAGE) diff --git a/tests/gadgets/GadgetHostTest/AndroidManifest.xml b/tests/gadgets/GadgetHostTest/AndroidManifest.xml deleted file mode 100644 index 52e314f..0000000 --- a/tests/gadgets/GadgetHostTest/AndroidManifest.xml +++ /dev/null @@ -1,36 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.gadgethost"> - <uses-permission android:name="android.permission.VIBRATE" /> - - <application> - <activity android:name="GadgetHostActivity" android:label="_GadgetHost"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - <activity android:name="TestGadgetConfigure" android:label="Configure TestGadgetProvider"> - <intent-filter> - <action android:name="android.intent.action.MAIN" /> - <category android:name="android.intent.category.DEFAULT" /> - <category android:name="android.intent.category.LAUNCHER" /> - </intent-filter> - </activity> - - <!-- BEGIN_INCLUDE(GadgetProvider) --> - <receiver android:name="TestGadgetProvider" - android:label="@string/oh_hai" - android:icon="@drawable/oh_hai_icon" - > - <intent-filter> - <action android:name="android.gadget.action.GADGET_UPDATE" /> - </intent-filter> - <meta-data android:name="android.gadget.provider" - android:resource="@xml/gadget_info" - /> - </receiver> - <!-- END_INCLUDE(GadgetProvider) --> - - </application> -</manifest> diff --git a/tests/gadgets/GadgetHostTest/res/drawable/oh_hai_icon.png b/tests/gadgets/GadgetHostTest/res/drawable/oh_hai_icon.png Binary files differdeleted file mode 100644 index 30ff267..0000000 --- a/tests/gadgets/GadgetHostTest/res/drawable/oh_hai_icon.png +++ /dev/null diff --git a/tests/gadgets/GadgetHostTest/res/layout/gadget_host.xml b/tests/gadgets/GadgetHostTest/res/layout/gadget_host.xml deleted file mode 100644 index 743f6c6..0000000 --- a/tests/gadgets/GadgetHostTest/res/layout/gadget_host.xml +++ /dev/null @@ -1,51 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2006 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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:orientation="vertical" - android:layout_width="fill_parent" - android:layout_height="fill_parent" > - - <TextView - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/gadget_view_title" - /> - - <ScrollView - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:layout_weight="1" - > - - <com.android.tests.gadgethost.GadgetContainerView - android:id="@+id/gadget_container" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:orientation="vertical" - /> - - </ScrollView> - - <Button - android:id="@+id/add_gadget" - android:text="@string/add_gadget" - android:layout_height="wrap_content" - android:layout_width="wrap_content" - /> - -</LinearLayout> - diff --git a/tests/gadgets/GadgetHostTest/res/layout/test_gadget.xml b/tests/gadgets/GadgetHostTest/res/layout/test_gadget.xml deleted file mode 100644 index 4d483c7..0000000 --- a/tests/gadgets/GadgetHostTest/res/layout/test_gadget.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2006 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. ---> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/oh_hai_text" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/oh_hai" -/> - diff --git a/tests/gadgets/GadgetHostTest/res/layout/test_gadget_configure.xml b/tests/gadgets/GadgetHostTest/res/layout/test_gadget_configure.xml deleted file mode 100644 index 0d9b983..0000000 --- a/tests/gadgets/GadgetHostTest/res/layout/test_gadget_configure.xml +++ /dev/null @@ -1,44 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2006 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. ---> - -<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:orientation="vertical" - > - - <TextView - android:id="@+id/oh_hai_text" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - android:text="@string/oh_hai" - /> - - <EditText - android:id="@+id/edit_text" - android:layout_width="fill_parent" - android:layout_height="wrap_content" - /> - - <Button - android:id="@+id/save_button" - android:layout_width="wrap_content" - android:layout_height="wrap_content" - android:text="@string/save" - /> - - -</LinearLayout> diff --git a/tests/gadgets/GadgetHostTest/res/values/strings.xml b/tests/gadgets/GadgetHostTest/res/values/strings.xml deleted file mode 100644 index ad9916a..0000000 --- a/tests/gadgets/GadgetHostTest/res/values/strings.xml +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 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. ---> - -<resources> - <string name="gadget_view_title">Gadget Test</string> - <string name="add_gadget">Add Gadget</string> - <string name="oh_hai">Oh hai.</string> - <string name="delete_gadget">Delete</string> - <string name="save">Save</string> -</resources> - diff --git a/tests/gadgets/GadgetHostTest/res/xml/gadget_info.xml b/tests/gadgets/GadgetHostTest/res/xml/gadget_info.xml deleted file mode 100644 index e0c4222..0000000 --- a/tests/gadgets/GadgetHostTest/res/xml/gadget_info.xml +++ /dev/null @@ -1,10 +0,0 @@ -<!-- BEGIN_INCLUDE(GadgetProviderInfo) --> -<gadget-provider xmlns:android="http://schemas.android.com/apk/res/android" - android:minWidth="40dp" - android:minHeight="30dp" - android:updatePeriodMillis="86400000" - android:initialLayout="@layout/test_gadget" - android:configure="com.android.tests.gadgethost.TestGadgetConfigure" - > -</gadget-provider> -<!-- END_INCLUDE(GadgetProviderInfo) --> diff --git a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/GadgetContainerView.java b/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/GadgetContainerView.java deleted file mode 100644 index 3814836..0000000 --- a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/GadgetContainerView.java +++ /dev/null @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2008 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.tests.gadgethost; - -import android.content.Context; -import android.util.AttributeSet; -import android.widget.LinearLayout; - -public class GadgetContainerView extends LinearLayout -{ - public GadgetContainerView(Context context) { - super(context); - } - - public GadgetContainerView(Context context, AttributeSet attrs) { - super(context, attrs); - } -} diff --git a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/GadgetHostActivity.java b/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/GadgetHostActivity.java deleted file mode 100644 index 0bd8926..0000000 --- a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/GadgetHostActivity.java +++ /dev/null @@ -1,198 +0,0 @@ -/* - * Copyright (C) 2008 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.tests.gadgethost; - -import android.app.Activity; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.gadget.GadgetHost; -import android.gadget.GadgetHostView; -import android.gadget.GadgetProviderInfo; -import android.gadget.GadgetManager; -import android.os.Bundle; -import android.util.Log; -import android.view.ContextMenu; -import android.view.MenuItem; -import android.view.View; -import android.widget.LinearLayout; - -public class GadgetHostActivity extends Activity -{ - static final String TAG = "GadgetHostActivity"; - - static final int DISCOVER_GADGET_REQUEST = 1; - static final int CONFIGURE_GADGET_REQUEST = 2; - static final int HOST_ID = 1234; - - static final String PENDING_GADGET_ID = "pending_gadget"; - - GadgetManager mGadgetManager; - GadgetContainerView mGadgetContainer; - - public GadgetHostActivity() { - mGadgetManager = GadgetManager.getInstance(this); - } - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - setContentView(R.layout.gadget_host); - - findViewById(R.id.add_gadget).setOnClickListener(mOnClickListener); - mGadgetContainer = (GadgetContainerView)findViewById(R.id.gadget_container); - - if (false) { - if (false) { - mHost.deleteHost(); - } else { - GadgetHost.deleteAllHosts(); - } - } - } - - View.OnClickListener mOnClickListener = new View.OnClickListener() { - public void onClick(View v) { - discoverGadget(DISCOVER_GADGET_REQUEST); - } - }; - - void discoverGadget(int requestCode) { - Intent intent = new Intent(GadgetManager.ACTION_GADGET_PICK); - intent.putExtra(GadgetManager.EXTRA_GADGET_ID, mHost.allocateGadgetId()); - startActivityForResult(intent, requestCode); - } - - void configureGadget(int requestCode, int gadgetId, ComponentName configure) { - Intent intent = new Intent(GadgetManager.ACTION_GADGET_CONFIGURE); - intent.setComponent(configure); - intent.putExtra(GadgetManager.EXTRA_GADGET_ID, gadgetId); - SharedPreferences.Editor prefs = getPreferences(0).edit(); - prefs.putInt(PENDING_GADGET_ID, gadgetId); - prefs.commit(); - startActivityForResult(intent, requestCode); - } - - void handleGadgetPickResult(int resultCode, Intent intent) { - // BEGIN_INCLUDE(getExtra_EXTRA_GADGET_ID) - Bundle extras = intent.getExtras(); - int gadgetId = extras.getInt(GadgetManager.EXTRA_GADGET_ID); - // END_INCLUDE(getExtra_EXTRA_GADGET_ID) - if (resultCode == RESULT_OK) { - GadgetProviderInfo gadget = mGadgetManager.getGadgetInfo(gadgetId); - - if (gadget.configure != null) { - // configure the gadget if we should - configureGadget(CONFIGURE_GADGET_REQUEST, gadgetId, gadget.configure); - } else { - // just add it as is - addGadgetView(gadgetId, gadget); - } - } else { - mHost.deleteGadgetId(gadgetId); - } - } - - void handleGadgetConfigureResult(int resultCode, Intent data) { - int gadgetId = getPreferences(0).getInt(PENDING_GADGET_ID, -1); - Log.d(TAG, "resultCode=" + resultCode + " gadgetId=" + gadgetId); - if (gadgetId < 0) { - Log.w(TAG, "was no preference for PENDING_GADGET_ID"); - return; - } - if (resultCode == RESULT_OK) { - GadgetProviderInfo gadget = mGadgetManager.getGadgetInfo(gadgetId); - addGadgetView(gadgetId, gadget); - } else { - mHost.deleteGadgetId(gadgetId); - } - } - - void addGadgetView(int gadgetId, GadgetProviderInfo gadget) { - // Inflate the gadget's RemoteViews - GadgetHostView view = mHost.createView(this, gadgetId, gadget); - - // Add it to the list - LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams( - LinearLayout.LayoutParams.FILL_PARENT, - LinearLayout.LayoutParams.WRAP_CONTENT); - mGadgetContainer.addView(view, layoutParams); - - registerForContextMenu(view); - } - - protected void onActivityResult(int requestCode, int resultCode, Intent data) { - switch (requestCode) { - case DISCOVER_GADGET_REQUEST: - handleGadgetPickResult(resultCode, data); - break; - case CONFIGURE_GADGET_REQUEST: - handleGadgetConfigureResult(resultCode, data); - } - } - - protected void onStart() { - super.onStart(); - mHost.startListening(); - } - - protected void onStop() { - super.onStop(); - mHost.stopListening(); - } - - public void onCreateContextMenu(ContextMenu menu, View v, - ContextMenu.ContextMenuInfo menuInfo) { - menu.add(ContextMenu.NONE, R.string.delete_gadget, ContextMenu.NONE, - R.string.delete_gadget); - } - - public boolean onContextItemSelected(MenuItem item) { - MyGadgetView view = (MyGadgetView)item.getMenuInfo(); - switch (item.getItemId()) { - case R.string.delete_gadget: - Log.d(TAG, "delete! " + view.gadgetId); - mGadgetContainer.removeView(view); - mHost.deleteGadgetId(view.gadgetId); - break; - } - - return true; - } - - class MyGadgetView extends GadgetHostView implements ContextMenu.ContextMenuInfo { - int gadgetId; - - MyGadgetView(int gadgetId) { - super(GadgetHostActivity.this); - this.gadgetId = gadgetId; - } - - public ContextMenu.ContextMenuInfo getContextMenuInfo() { - return this; - } - } - - GadgetHost mHost = new GadgetHost(this, HOST_ID) { - protected GadgetHostView onCreateView(Context context, int gadgetId, GadgetProviderInfo gadget) { - return new MyGadgetView(gadgetId); - } - }; -} - - diff --git a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/TestGadgetConfigure.java b/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/TestGadgetConfigure.java deleted file mode 100644 index 897c13c..0000000 --- a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/TestGadgetConfigure.java +++ /dev/null @@ -1,57 +0,0 @@ -/* - * Copyright (C) 2008 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.tests.gadgethost; - -import android.app.Activity; -import android.content.Intent; -import android.content.SharedPreferences; -import android.os.Bundle; -import android.util.Log; -import android.view.View; -import android.widget.EditText; - -public class TestGadgetConfigure extends Activity { - static final String TAG = "TestGadgetConfigure"; - - public TestGadgetConfigure() { - super(); - } - - @Override - public void onCreate(Bundle icicle) { - super.onCreate(icicle); - setContentView(R.layout.test_gadget_configure); - - findViewById(R.id.save_button).setOnClickListener(mOnClickListener); - } - - View.OnClickListener mOnClickListener = new View.OnClickListener() { - public void onClick(View v) { - String text = ((EditText)findViewById(R.id.edit_text)).getText().toString(); - Log.d(TAG, "text is '" + text + '\''); - SharedPreferences.Editor prefs = getSharedPreferences(TestGadgetProvider.PREFS_NAME, 0) - .edit(); - prefs.putString(TestGadgetProvider.PREF_PREFIX_KEY, text); - prefs.commit(); - setResult(RESULT_OK); - finish(); - } - }; - -} - - diff --git a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/TestGadgetProvider.java b/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/TestGadgetProvider.java deleted file mode 100644 index 370a50b..0000000 --- a/tests/gadgets/GadgetHostTest/src/com/android/tests/gadgethost/TestGadgetProvider.java +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2008 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.tests.gadgethost; - -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.content.SharedPreferences; -import android.gadget.GadgetManager; -import android.os.Bundle; -import android.os.SystemClock; -import android.util.Log; -import android.widget.RemoteViews; - -public class TestGadgetProvider extends BroadcastReceiver { - static final String TAG = "TestGadgetProvider"; - - static final String PREFS_NAME = "com.android.tests.gadgethost.TestGadgetProvider"; - static final String PREF_PREFIX_KEY = "prefix"; - - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - Log.d(TAG, "intent=" + intent); - - if (GadgetManager.ACTION_GADGET_ENABLED.equals(action)) { - Log.d(TAG, "ENABLED"); - } - else if (GadgetManager.ACTION_GADGET_DISABLED.equals(action)) { - Log.d(TAG, "DISABLED"); - } - else if (GadgetManager.ACTION_GADGET_UPDATE.equals(action)) { - Log.d(TAG, "UPDATE"); - // BEGIN_INCLUDE(getExtra_EXTRA_GADGET_IDS) - Bundle extras = intent.getExtras(); - int[] gadgetIds = extras.getIntArray(GadgetManager.EXTRA_GADGET_IDS); - // END_INCLUDE(getExtra_EXTRA_GADGET_IDS) - - SharedPreferences prefs = context.getSharedPreferences( - TestGadgetProvider.PREFS_NAME, 0); - String prefix = prefs.getString(PREF_PREFIX_KEY, "hai"); - - GadgetManager gm = GadgetManager.getInstance(context); - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.test_gadget); - views.setTextViewText(R.id.oh_hai_text, prefix + ": " + SystemClock.elapsedRealtime()); - if (false) { - gm.updateGadget(gadgetIds, views); - } else { - gm.updateGadget(new ComponentName("com.android.tests.gadgethost", - "com.android.tests.gadgethost.TestGadgetProvider"), views); - } - } - } -} - diff --git a/tests/gadgets/GadgetProviderTest/Android.mk b/tests/gadgets/GadgetProviderTest/Android.mk deleted file mode 100644 index b9bfcdb..0000000 --- a/tests/gadgets/GadgetProviderTest/Android.mk +++ /dev/null @@ -1,11 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE_TAGS := user - -LOCAL_SRC_FILES := $(call all-subdir-java-files) - -LOCAL_PACKAGE_NAME := GadgetProvider -LOCAL_CERTIFICATE := platform - -include $(BUILD_PACKAGE) diff --git a/tests/gadgets/GadgetProviderTest/AndroidManifest.xml b/tests/gadgets/GadgetProviderTest/AndroidManifest.xml deleted file mode 100644 index 47a7a2e..0000000 --- a/tests/gadgets/GadgetProviderTest/AndroidManifest.xml +++ /dev/null @@ -1,13 +0,0 @@ -<manifest xmlns:android="http://schemas.android.com/apk/res/android" - package="com.android.tests.gadgetprovider"> - <uses-permission android:name="android.permission.VIBRATE" /> - - <application> - <receiver android:name="TestGadgetProvider"> - <intent-filter> - <action android:name="android.gadget.action.GADGET_UPDATE" /> - </intent-filter> - <meta-data android:name="android.gadget.provider" android:resource="@xml/gadget_info" /> - </receiver> - </application> -</manifest> diff --git a/tests/gadgets/GadgetProviderTest/res/layout/test_gadget.xml b/tests/gadgets/GadgetProviderTest/res/layout/test_gadget.xml deleted file mode 100644 index e0a416e..0000000 --- a/tests/gadgets/GadgetProviderTest/res/layout/test_gadget.xml +++ /dev/null @@ -1,26 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2006 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. ---> - -<TextView xmlns:android="http://schemas.android.com/apk/res/android" - android:id="@+id/oh_hai_text" - android:layout_width="150dp" - android:layout_height="150dp" - android:text="@string/oh_hai" - android:background="#8fff" - android:textColor="#000" - android:textStyle="bold" -/> - diff --git a/tests/gadgets/GadgetProviderTest/res/values/strings.xml b/tests/gadgets/GadgetProviderTest/res/values/strings.xml deleted file mode 100644 index e07725f..0000000 --- a/tests/gadgets/GadgetProviderTest/res/values/strings.xml +++ /dev/null @@ -1,23 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?> -<!-- Copyright (C) 2007 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. ---> - -<resources> - <string name="gadget_view_title">Gadget Test</string> - <string name="add_gadget">Add Gadget</string> - <string name="oh_hai">Oh hai.</string> - <string name="delete_gadget">Delete</string> -</resources> - diff --git a/tests/gadgets/GadgetProviderTest/res/xml/gadget_info.xml b/tests/gadgets/GadgetProviderTest/res/xml/gadget_info.xml deleted file mode 100644 index 33cc2e3..0000000 --- a/tests/gadgets/GadgetProviderTest/res/xml/gadget_info.xml +++ /dev/null @@ -1,7 +0,0 @@ -<gadget-provider xmlns:android="http://schemas.android.com/apk/res/android" - android:minWidth="150dp" - android:minHeight="150dp" - android:updatePeriodMillis="2000" - android:initialLayout="@layout/test_gadget" - > -</gadget-provider> diff --git a/tests/gadgets/GadgetProviderTest/src/com/android/tests/gadgetprovider/TestGadgetProvider.java b/tests/gadgets/GadgetProviderTest/src/com/android/tests/gadgetprovider/TestGadgetProvider.java deleted file mode 100644 index b81575f..0000000 --- a/tests/gadgets/GadgetProviderTest/src/com/android/tests/gadgetprovider/TestGadgetProvider.java +++ /dev/null @@ -1,60 +0,0 @@ -/* - * Copyright (C) 2008 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.tests.gadgetprovider; - -import android.content.BroadcastReceiver; -import android.content.ComponentName; -import android.content.Context; -import android.content.Intent; -import android.gadget.GadgetManager; -import android.os.Bundle; -import android.os.SystemClock; -import android.util.Log; -import android.widget.RemoteViews; - -public class TestGadgetProvider extends BroadcastReceiver { - - static final String TAG = "TestGadgetProvider"; - - public void onReceive(Context context, Intent intent) { - String action = intent.getAction(); - Log.d(TAG, "intent=" + intent); - - if (GadgetManager.ACTION_GADGET_ENABLED.equals(action)) { - Log.d(TAG, "ENABLED"); - } - else if (GadgetManager.ACTION_GADGET_DISABLED.equals(action)) { - Log.d(TAG, "DISABLED"); - } - else if (GadgetManager.ACTION_GADGET_UPDATE.equals(action)) { - Log.d(TAG, "UPDATE"); - Bundle extras = intent.getExtras(); - int[] gadgetIds = extras.getIntArray(GadgetManager.EXTRA_GADGET_IDS); - - GadgetManager gm = GadgetManager.getInstance(context); - RemoteViews views = new RemoteViews(context.getPackageName(), R.layout.test_gadget); - views.setTextViewText(R.id.oh_hai_text, "hai: " + SystemClock.elapsedRealtime()); - if (false) { - gm.updateGadget(gadgetIds, views); - } else { - gm.updateGadget(new ComponentName("com.android.tests.gadgetprovider", - "com.android.tests.gadgetprovider.TestGadgetProvider"), views); - } - } - } -} - |