Merge "Move SDK component to API 10 + codename." into honeycomb
diff --git a/apps/WidgetPreview/Android.mk b/apps/WidgetPreview/Android.mk
new file mode 100644
index 0000000..04a4927
--- /dev/null
+++ b/apps/WidgetPreview/Android.mk
@@ -0,0 +1,27 @@
+#
+# 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.
+#
+
+LOCAL_PATH:= $(call my-dir)
+include $(CLEAR_VARS)
+
+LOCAL_MODULE_TAGS := samples
+
+LOCAL_SRC_FILES := $(call all-subdir-java-files)
+
+LOCAL_PACKAGE_NAME := WidgetPreview
+LOCAL_SDK_VERSION := current
+
+include $(BUILD_PACKAGE)
diff --git a/apps/WidgetPreview/AndroidManifest.xml b/apps/WidgetPreview/AndroidManifest.xml
new file mode 100644
index 0000000..3d50188
--- /dev/null
+++ b/apps/WidgetPreview/AndroidManifest.xml
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.android.widgetpreview">
+
+ <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/>
+ <uses-permission android:name="android.permission.BIND_APPWIDGET" />
+
+ <application android:label="@string/application_label">
+
+ <activity
+ android:name="WidgetPreviewActivity"
+ android:label="@string/application_label"
+ android:icon="@drawable/ic_widget_preview">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN"/>
+ <category android:name="android.intent.category.LAUNCHER"/>
+ <category android:name="android.intent.category.DEFAULT"/>
+ </intent-filter>
+ </activity>
+
+ </application>
+</manifest>
diff --git a/apps/WidgetPreview/res/drawable-hdpi/ic_widget_preview.png b/apps/WidgetPreview/res/drawable-hdpi/ic_widget_preview.png
new file mode 100644
index 0000000..168cdda
--- /dev/null
+++ b/apps/WidgetPreview/res/drawable-hdpi/ic_widget_preview.png
Binary files differ
diff --git a/apps/WidgetPreview/res/drawable-mdpi/ic_widget_preview.png b/apps/WidgetPreview/res/drawable-mdpi/ic_widget_preview.png
new file mode 100644
index 0000000..55c7661
--- /dev/null
+++ b/apps/WidgetPreview/res/drawable-mdpi/ic_widget_preview.png
Binary files differ
diff --git a/apps/WidgetPreview/res/layout/activity_main.xml b/apps/WidgetPreview/res/layout/activity_main.xml
new file mode 100644
index 0000000..e43d246
--- /dev/null
+++ b/apps/WidgetPreview/res/layout/activity_main.xml
@@ -0,0 +1,45 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:padding="20dp">
+ <Button
+ android:id="@+id/email_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_alignParentBottom="true"
+ android:text="@string/email_button" />
+ <Button
+ android:id="@+id/snapshot_button"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:layout_above="@id/email_button"
+ android:text="@string/snapshot_button" />
+ <FrameLayout
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content"
+ android:layout_alignParentTop="true"
+ android:layout_above="@id/snapshot_button"
+ android:layout_centerHorizontal="true">
+ <FrameLayout
+ android:id="@+id/main_frame"
+ android:layout_width="wrap_content"
+ android:layout_height="wrap_content">
+ </FrameLayout>
+ </FrameLayout>
+</RelativeLayout>
\ No newline at end of file
diff --git a/apps/WidgetPreview/res/values-land/dimens.xml b/apps/WidgetPreview/res/values-land/dimens.xml
new file mode 100644
index 0000000..dea2576
--- /dev/null
+++ b/apps/WidgetPreview/res/values-land/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <dimen name="workspace_cell_width">106dip</dimen>
+ <dimen name="workspace_cell_height">74dip</dimen>
+ <dimen name="workspace_width_gap">0dp</dimen>
+ <dimen name="workspace_height_gap">0dp</dimen>
+</resources>
diff --git a/apps/WidgetPreview/res/values-port/dimens.xml b/apps/WidgetPreview/res/values-port/dimens.xml
new file mode 100644
index 0000000..0276ffb
--- /dev/null
+++ b/apps/WidgetPreview/res/values-port/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <dimen name="workspace_cell_width">80dip</dimen>
+ <dimen name="workspace_cell_height">100dip</dimen>
+ <dimen name="workspace_width_gap">0dp</dimen>
+ <dimen name="workspace_height_gap">0dp</dimen>
+</resources>
diff --git a/apps/WidgetPreview/res/values-xlarge/dimens.xml b/apps/WidgetPreview/res/values-xlarge/dimens.xml
new file mode 100644
index 0000000..b6b5dfe
--- /dev/null
+++ b/apps/WidgetPreview/res/values-xlarge/dimens.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <dimen name="workspace_cell_width">96dip</dimen>
+ <dimen name="workspace_cell_height">96dip</dimen>
+ <dimen name="workspace_width_gap">0dp</dimen>
+ <dimen name="workspace_height_gap">0dp</dimen>
+</resources>
diff --git a/apps/WidgetPreview/res/values/dimens.xml b/apps/WidgetPreview/res/values/dimens.xml
new file mode 100644
index 0000000..ccd71d3
--- /dev/null
+++ b/apps/WidgetPreview/res/values/dimens.xml
@@ -0,0 +1,19 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <dimen name="preview_cell_size">196dip</dimen>
+</resources>
diff --git a/apps/WidgetPreview/res/values/strings.xml b/apps/WidgetPreview/res/values/strings.xml
new file mode 100644
index 0000000..2cc9ccf
--- /dev/null
+++ b/apps/WidgetPreview/res/values/strings.xml
@@ -0,0 +1,29 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- 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.
+-->
+
+<resources>
+ <string name="application_label">Widget Preview</string>
+ <string name="saving_preview">Saving widget preview...</string>
+ <string name="preview_saved">Widget preview saved!</string>
+ <string name="no_preview">Please take a snapshot first</string>
+ <string name="preview_save_error">Error saving preview</string>
+ <string name="configure_error">Error configuring, no configuration activity found</string>
+ <string name="email_subject">Widget preview</string>
+ <string name="email_body">Attached is the preview of your AppWidget</string>
+
+ <string name="snapshot_button">Take Snapshot</string>
+ <string name="email_button">Email Preview</string>
+</resources>
diff --git a/apps/WidgetPreview/src/com/android/widgetpreview/WidgetPreviewActivity.java b/apps/WidgetPreview/src/com/android/widgetpreview/WidgetPreviewActivity.java
new file mode 100644
index 0000000..1026ba8
--- /dev/null
+++ b/apps/WidgetPreview/src/com/android/widgetpreview/WidgetPreviewActivity.java
@@ -0,0 +1,322 @@
+/*
+ * 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.widgetpreview;
+
+import android.app.Activity;
+import android.appwidget.AppWidgetHost;
+import android.appwidget.AppWidgetHostView;
+import android.appwidget.AppWidgetManager;
+import android.appwidget.AppWidgetProviderInfo;
+import android.content.ActivityNotFoundException;
+import android.content.Intent;
+import android.content.res.Configuration;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.Bitmap.CompressFormat;
+import android.graphics.Bitmap.Config;
+import android.graphics.Canvas;
+import android.net.Uri;
+import android.os.Bundle;
+import android.os.Environment;
+import android.util.Log;
+import android.view.View;
+import android.view.View.OnClickListener;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.FrameLayout;
+import android.widget.Toast;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+
+public class WidgetPreviewActivity extends Activity implements OnClickListener {
+
+ private static final String LOG_TAG = "WidgetPreviewActivity";
+ private static final boolean DEBUG = true;
+ private static final int APPWIDGET_HOST_ID = 2048;
+ private static final int REQUEST_WIDGET = 0;
+ private static final int REQUEST_CONFIGURE = 1;
+
+ private AppWidgetHost mAppWidgetHost = null;
+ private FrameLayout mAppWidgetFrame = null;
+ private AppWidgetHostView mAppWidgetView = null;
+ private int mAppWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
+ private String mAppWidgetName;
+ private int mPreviewWidth;
+ private int mPreviewHeight;
+
+ private Button mSnapshotButton = null;
+ private Button mEmailButton = null;
+
+ @Override
+ public void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.activity_main);
+ mAppWidgetFrame = (FrameLayout)findViewById(R.id.main_frame);
+ mSnapshotButton = (Button)findViewById(R.id.snapshot_button);
+ mSnapshotButton.setOnClickListener(this);
+ mEmailButton = (Button)findViewById(R.id.email_button);
+ mEmailButton.setOnClickListener(this);
+
+ mAppWidgetHost = new AppWidgetHost(getApplicationContext(), APPWIDGET_HOST_ID);
+
+ final Object retainedObj = getLastNonConfigurationInstance();
+ if (retainedObj instanceof AppWidgetProviderInfo) {
+ AppWidgetProviderInfo info = (AppWidgetProviderInfo) retainedObj;
+ int id = mAppWidgetHost.allocateAppWidgetId();
+ AppWidgetManager.getInstance(getBaseContext()).bindAppWidgetId(id, info.provider);
+ setAppWidget(id);
+ } else {
+ startChooseActivity();
+ }
+ }
+
+ @Override
+ public void onStart() {
+ super.onStart();
+ mAppWidgetHost.startListening();
+ }
+
+ @Override
+ public Object onRetainNonConfigurationInstance() {
+ AppWidgetProviderInfo info = AppWidgetManager.getInstance(
+ getBaseContext()).getAppWidgetInfo(mAppWidgetId);
+ return info;
+ }
+
+ private void startChooseActivity() {
+ int id = mAppWidgetHost.allocateAppWidgetId();
+ Intent selectIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_PICK);
+ selectIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, id);
+ startActivityForResult(selectIntent, REQUEST_WIDGET);
+ }
+
+ @Override
+ public void onActivityResult(int requestCode, int resultCode, Intent data) {
+ if (requestCode == REQUEST_WIDGET) {
+ if (data != null) {
+ int appWidgetId = AppWidgetManager.INVALID_APPWIDGET_ID;
+ if (data.hasExtra(AppWidgetManager.EXTRA_APPWIDGET_ID)) {
+ appWidgetId = data.getExtras().getInt(AppWidgetManager.EXTRA_APPWIDGET_ID);
+ }
+
+ if (resultCode == RESULT_OK) {
+ setAppWidget(appWidgetId);
+ } else {
+ mAppWidgetHost.deleteAppWidgetId(appWidgetId);
+ finish();
+ }
+ } else {
+ finish();
+ }
+ } else if (requestCode == REQUEST_CONFIGURE) {
+ if (data != null) {
+ int appWidgetId = data.getExtras().getInt(
+ AppWidgetManager.EXTRA_APPWIDGET_ID, AppWidgetManager.INVALID_APPWIDGET_ID);
+ if (resultCode == RESULT_OK) {
+ finishSetAppWidget(appWidgetId);
+ } else {
+ mAppWidgetHost.deleteAppWidgetId(appWidgetId);
+ }
+ }
+ }
+ }
+
+ private void setAppWidget(int appWidgetId) {
+ if (mAppWidgetId != AppWidgetManager.INVALID_APPWIDGET_ID) {
+ mAppWidgetHost.deleteAppWidgetId(mAppWidgetId);
+ }
+
+ /* Check for configuration */
+ AppWidgetProviderInfo providerInfo =
+ AppWidgetManager.getInstance(getBaseContext()).getAppWidgetInfo(appWidgetId);
+
+ if (providerInfo.configure != null) {
+ Intent configureIntent = new Intent(AppWidgetManager.ACTION_APPWIDGET_CONFIGURE);
+ configureIntent.setComponent(providerInfo.configure);
+ configureIntent.putExtra(AppWidgetManager.EXTRA_APPWIDGET_ID, appWidgetId);
+
+ if (configureIntent != null) {
+ try {
+ startActivityForResult(configureIntent, REQUEST_CONFIGURE);
+ } catch (ActivityNotFoundException e) {
+ Log.d(LOG_TAG, "Configuration activity not found: " + e);
+ Toast errorToast = Toast.makeText(
+ getBaseContext(), R.string.configure_error, Toast.LENGTH_SHORT);
+ errorToast.show();
+ }
+ }
+ } else {
+ finishSetAppWidget(appWidgetId);
+ }
+ }
+
+ private void finishSetAppWidget(int appWidgetId) {
+ AppWidgetProviderInfo providerInfo =
+ AppWidgetManager.getInstance(getBaseContext()).getAppWidgetInfo(appWidgetId);
+ if (providerInfo != null) {
+ mAppWidgetView =
+ mAppWidgetHost.createView(getBaseContext(), appWidgetId, providerInfo);
+
+ int [] dimensions =
+ getLauncherCellDimensions(providerInfo.minWidth, providerInfo.minHeight);
+
+ mPreviewWidth = dimensions[0];
+ mPreviewHeight = dimensions[1];
+
+ mAppWidgetName =
+ AppWidgetManager.getInstance(getBaseContext()).getAppWidgetInfo(appWidgetId).label;
+ mAppWidgetName = mAppWidgetName.replaceAll("[^a-zA-Z0-9]", "_");
+
+ ViewGroup.LayoutParams p = new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT);
+ mAppWidgetView.setLayoutParams(p);
+ mAppWidgetFrame.removeAllViews();
+ mAppWidgetHost.deleteAppWidgetId(mAppWidgetId);
+ mAppWidgetFrame.addView(mAppWidgetView, mPreviewWidth, mPreviewHeight);
+ mAppWidgetId = appWidgetId;
+ }
+ }
+
+ // Taken from CellLayout.java
+ public int[] getLauncherCellDimensions(int width, int height) {
+ // Always assume we're working with the smallest span to make sure we
+ // reserve enough space in both orientations.
+ Resources resources = getResources();
+ int cellWidth = resources.getDimensionPixelSize(R.dimen.workspace_cell_width);
+ int cellHeight = resources.getDimensionPixelSize(R.dimen.workspace_cell_height);
+ int widthGap = resources.getDimensionPixelSize(R.dimen.workspace_width_gap);
+ int heightGap = resources.getDimensionPixelSize(R.dimen.workspace_height_gap);
+ int previewCellSize = resources.getDimensionPixelSize(R.dimen.preview_cell_size);
+
+ // This logic imitates Launcher's CellLayout.rectToCell.
+ // Always round up to next largest cell
+ int smallerSize = Math.min(cellWidth, cellHeight);
+ int spanX = (width + smallerSize) / smallerSize;
+ int spanY = (height + smallerSize) / smallerSize;
+
+ // We use a fixed preview cell size so that you get the same preview image for
+ // the same cell-sized widgets across all devices
+ width = spanX * previewCellSize + ((spanX - 1) * widthGap);
+ height = spanY * previewCellSize + ((spanY - 1) * heightGap);
+ return new int[] { width, height };
+ }
+
+ private File buildFile(String name) {
+ if (!Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) {
+ return null;
+ }
+
+ File path = Environment.getExternalStoragePublicDirectory(
+ Environment.DIRECTORY_DOWNLOADS);
+ int orientationCode = getResources().getConfiguration().orientation;
+ String orientation;
+ if (getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE) {
+ orientation = "landscape";
+ } else if (orientationCode == Configuration.ORIENTATION_PORTRAIT) {
+ orientation = "portrait";
+ } else if (orientationCode == Configuration.ORIENTATION_SQUARE) {
+ orientation = "square";
+ } else {
+ orientation = "undefined";
+ }
+ return new File(path, name + "_ori_" + orientation + ".png");
+ }
+
+ public Bitmap getPreviewBitmap() {
+ mAppWidgetView.invalidate();
+ Bitmap bmp = Bitmap.createBitmap(
+ mAppWidgetView.getWidth(), mAppWidgetView.getHeight(), Config.ARGB_8888);
+ Canvas c = new Canvas(bmp);
+ mAppWidgetView.draw(c);
+ return bmp;
+ }
+
+ private boolean saveImage(Bitmap bmp, String name) {
+ File pic = buildFile(mAppWidgetName);
+ if (pic == null) {
+ Log.d(LOG_TAG, "External storage not present");
+ return false;
+ }
+
+ pic.getParentFile().mkdirs();
+ FileOutputStream fout = null;
+ try {
+ fout = new FileOutputStream(pic);
+ if (!bmp.compress(CompressFormat.PNG, 100, fout)) {
+ Log.d(LOG_TAG, "Failed to compress image");
+ return false;
+ }
+ return true;
+ } catch (IOException e) {
+ Log.d(LOG_TAG, "Error writing to disk: " + e);
+ } finally {
+ try {
+ if (fout != null) {
+ fout.close();
+ }
+ } catch (IOException e) {
+ Log.d(LOG_TAG, "Could not close file: " + e);
+ }
+ }
+ return false;
+ }
+
+ @Override
+ public void onBackPressed() {
+ if (!getFragmentManager().popBackStackImmediate()) {
+ startChooseActivity();
+ }
+ }
+
+ @Override
+ public void onClick(View v) {
+ if (v == mSnapshotButton) {
+ int textId = R.string.saving_preview;
+
+ Toast preToast = Toast.makeText(getBaseContext(), textId, Toast.LENGTH_SHORT);
+ preToast.show();
+
+ Bitmap bmp = getPreviewBitmap();
+ if (saveImage(bmp, mAppWidgetName)) {
+ textId = R.string.preview_saved;
+ } else {
+ textId = R.string.preview_save_error;
+ }
+
+ Toast postToast = Toast.makeText(getBaseContext(), textId, Toast.LENGTH_SHORT);
+ postToast.show();
+ } else if (v == mEmailButton) {
+ File file = buildFile(mAppWidgetName);
+ if (file.exists()) {
+ Intent emailIntent = new Intent(Intent.ACTION_SEND);
+ emailIntent.setType("image/png");
+ emailIntent.putExtra(Intent.EXTRA_SUBJECT,
+ getResources().getString(R.string.email_subject));
+ emailIntent.putExtra(Intent.EXTRA_TEXT,
+ getResources().getString(R.string.email_body));
+ emailIntent.putExtra(Intent.EXTRA_STREAM, Uri.fromFile(file));
+ startActivity(emailIntent);
+ } else {
+ Toast postToast = Toast.makeText(
+ getBaseContext(), R.string.no_preview, Toast.LENGTH_SHORT);
+ postToast.show();
+ }
+ }
+ }
+}
diff --git a/build/sdk.atree b/build/sdk.atree
index 842a30e..0c5edbf 100644
--- a/build/sdk.atree
+++ b/build/sdk.atree
@@ -66,6 +66,9 @@
# the aidl precompiled include
obj/framework.aidl platforms/${PLATFORM_NAME}/framework.aidl
+# Framework include for Renderscript
+frameworks/base/libs/rs/scriptc platforms/${PLATFORM_NAME}/renderscript/include
+
# System images + Kernel
system.img platforms/${PLATFORM_NAME}/images/system.img
ramdisk.img platforms/${PLATFORM_NAME}/images/ramdisk.img
@@ -73,12 +76,12 @@
prebuilt/android-arm/kernel/kernel-qemu platforms/${PLATFORM_NAME}/images/kernel-qemu
# emulator skins from sdk.git
-development/tools/emulator/skins/QVGA platforms/${PLATFORM_NAME}/skins/QVGA
-development/tools/emulator/skins/WQVGA432 platforms/${PLATFORM_NAME}/skins/WQVGA432
-development/tools/emulator/skins/WQVGA400 platforms/${PLATFORM_NAME}/skins/WQVGA400
-development/tools/emulator/skins/HVGA platforms/${PLATFORM_NAME}/skins/HVGA
-development/tools/emulator/skins/WVGA800 platforms/${PLATFORM_NAME}/skins/WVGA800
-development/tools/emulator/skins/WVGA854 platforms/${PLATFORM_NAME}/skins/WVGA854
+#development/tools/emulator/skins/QVGA platforms/${PLATFORM_NAME}/skins/QVGA
+#development/tools/emulator/skins/WQVGA432 platforms/${PLATFORM_NAME}/skins/WQVGA432
+#development/tools/emulator/skins/WQVGA400 platforms/${PLATFORM_NAME}/skins/WQVGA400
+#development/tools/emulator/skins/HVGA platforms/${PLATFORM_NAME}/skins/HVGA
+#development/tools/emulator/skins/WVGA800 platforms/${PLATFORM_NAME}/skins/WVGA800
+#development/tools/emulator/skins/WVGA854 platforms/${PLATFORM_NAME}/skins/WVGA854
development/tools/emulator/skins/WXGA platforms/${PLATFORM_NAME}/skins/WXGA
# Platform SDK properties
@@ -171,6 +174,7 @@
development/samples/TicTacToeLib samples/${PLATFORM_NAME}/TicTacToeLib
development/samples/TicTacToeMain samples/${PLATFORM_NAME}/TicTacToeMain
development/samples/VoiceRecognitionService samples/${PLATFORM_NAME}/VoiceRecognitionService
+development/apps/WidgetPreview samples/${PLATFORM_NAME}/WidgetPreview
development/samples/Wiktionary samples/${PLATFORM_NAME}/Wiktionary
development/samples/WiktionarySimple samples/${PLATFORM_NAME}/WiktionarySimple
development/samples/XmlAdapters samples/${PLATFORM_NAME}/XmlAdapters
diff --git a/samples/ApiDemos/AndroidManifest.xml b/samples/ApiDemos/AndroidManifest.xml
index 561096e..a9d66ff 100644
--- a/samples/ApiDemos/AndroidManifest.xml
+++ b/samples/ApiDemos/AndroidManifest.xml
@@ -35,6 +35,8 @@
<!-- For android.media.audiofx.Visualizer -->
<uses-permission android:name="android.permission.RECORD_AUDIO" />
+ <uses-sdk android:minSdkVersion="4" />
+
<!-- We will request access to the camera, saying we require a camera
of some sort but not one with autofocus capability. -->
<!--
@@ -152,7 +154,8 @@
</activity>
<activity android:name=".app.ActivityRecreate"
- android:label="@string/activity_recreate">
+ android:label="@string/activity_recreate"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -244,7 +247,8 @@
<!-- Fragment Samples -->
<activity android:name=".app.FragmentAlertDialog"
- android:label="@string/fragment_alert_dialog">
+ android:label="@string/fragment_alert_dialog"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -253,7 +257,8 @@
<activity android:name=".app.FragmentHideShow"
android:label="@string/fragment_hide_show"
- android:windowSoftInputMode="stateUnchanged">
+ android:windowSoftInputMode="stateUnchanged"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -261,7 +266,8 @@
</activity>
<activity android:name=".app.FragmentContextMenu"
- android:label="@string/fragment_context_menu">
+ android:label="@string/fragment_context_menu"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -269,7 +275,8 @@
</activity>
<activity android:name=".app.FragmentDialog"
- android:label="@string/fragment_dialog">
+ android:label="@string/fragment_dialog"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -277,7 +284,8 @@
</activity>
<activity android:name=".app.FragmentDialogOrActivity"
- android:label="@string/fragment_dialog_or_activity">
+ android:label="@string/fragment_dialog_or_activity"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -285,17 +293,20 @@
</activity>
<activity android:name=".app.FragmentLayout"
- android:label="@string/fragment_layout">
+ android:label="@string/fragment_layout"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".app.FragmentLayout$DetailsActivity" />
+ <activity android:name=".app.FragmentLayout$DetailsActivity"
+ android:enabled="@bool/atLeastHoneycomb" />
<activity android:name=".app.FragmentListCursorLoader"
- android:label="@string/fragment_list_cursor_loader">
+ android:label="@string/fragment_list_cursor_loader"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -303,7 +314,8 @@
</activity>
<activity android:name=".app.FragmentListArray"
- android:label="@string/fragment_list_array">
+ android:label="@string/fragment_list_array"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -311,7 +323,8 @@
</activity>
<activity android:name=".app.FragmentMenu"
- android:label="@string/fragment_menu">
+ android:label="@string/fragment_menu"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -319,7 +332,8 @@
</activity>
<activity android:name=".app.FragmentRetainInstance"
- android:label="@string/fragment_retain_instance">
+ android:label="@string/fragment_retain_instance"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -327,7 +341,8 @@
</activity>
<activity android:name=".app.FragmentReceiveResult"
- android:label="@string/fragment_receive_result">
+ android:label="@string/fragment_receive_result"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -335,7 +350,8 @@
</activity>
<activity android:name=".app.FragmentStack"
- android:label="@string/fragment_stack">
+ android:label="@string/fragment_stack"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -346,7 +362,8 @@
<!-- BEGIN_INCLUDE(loader_throttle) -->
<activity android:name=".app.LoaderThrottle"
- android:label="@string/loader_throttle">
+ android:label="@string/loader_throttle"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -719,14 +736,17 @@
<!-- Action Bar Samples -->
<activity android:name=".app.ActionBarMechanics"
- android:label="@string/action_bar_mechanics">
+ android:label="@string/action_bar_mechanics"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".app.ActionBarUsage" android:label="@string/action_bar_usage">
+ <activity android:name=".app.ActionBarUsage"
+ android:label="@string/action_bar_usage"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -734,8 +754,9 @@
</activity>
<activity android:name=".app.ActionBarDisplayOptions"
- android:label="@string/action_bar_display_options"
- android:logo="@drawable/apidemo_androidlogo">
+ android:label="@string/action_bar_display_options"
+ android:logo="@drawable/apidemo_androidlogo"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -743,7 +764,8 @@
</activity>
<activity android:name=".app.ActionBarTabs"
- android:label="@string/action_bar_tabs">
+ android:label="@string/action_bar_tabs"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -755,7 +777,8 @@
<!-- ************************************* -->
<activity android:name=".preference.FragmentPreferences"
- android:label="@string/fragment_preferences">
+ android:label="@string/fragment_preferences"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -763,7 +786,8 @@
</activity>
<activity android:name=".preference.PreferenceWithHeaders"
- android:label="@string/preference_with_headers">
+ android:label="@string/preference_with_headers"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -821,7 +845,9 @@
<!-- CONTENT PACKAGE SAMPLES -->
<!-- ************************************* -->
- <activity android:name=".content.ClipboardSample" android:label="@string/activity_clipboard">
+ <activity android:name=".content.ClipboardSample"
+ android:label="@string/activity_clipboard"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -912,8 +938,10 @@
<!-- ANDROID.ANIMATION PACKAGE SAMPLES -->
<!-- ************************************* -->
- <activity android:name=".animation.AnimationLoading" android:label="Animation/Loading"
- android:hardwareAccelerated="false">
+ <activity android:name=".animation.AnimationLoading"
+ android:label="Animation/Loading"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -921,24 +949,29 @@
</activity>
<activity android:name=".animation.AnimationCloning"
- android:label="Animation/Cloning"
- android:hardwareAccelerated="false">
+ android:label="Animation/Cloning"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".animation.AnimationSeeking" android:label="Animation/Seeking"
- android:hardwareAccelerated="false">
+ <activity android:name=".animation.AnimationSeeking"
+ android:label="Animation/Seeking"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".animation.AnimatorEvents" android:label="Animation/Events"
- android:hardwareAccelerated="false">
+ <activity android:name=".animation.AnimatorEvents"
+ android:label="Animation/Events"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -946,8 +979,9 @@
</activity>
<activity android:name=".animation.BouncingBalls"
- android:label="Animation/Bouncing Balls"
- android:hardwareAccelerated="false">
+ android:label="Animation/Bouncing Balls"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -955,23 +989,28 @@
</activity>
<activity android:name=".animation.CustomEvaluator"
- android:label="Animation/Custom Evaluator"
- android:hardwareAccelerated="false">
+ android:label="Animation/Custom Evaluator"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".animation.ListFlipper" android:label="Animation/View Flip">
+ <activity android:name=".animation.ListFlipper"
+ android:label="Animation/View Flip"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
- <activity android:name=".animation.ReversingAnimation" android:label="Animation/Reversing"
- android:hardwareAccelerated="false">
+ <activity android:name=".animation.ReversingAnimation"
+ android:label="Animation/Reversing"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -979,8 +1018,9 @@
</activity>
<activity android:name=".animation.MultiPropertyAnimation"
- android:label="Animation/Multiple Properties"
- android:hardwareAccelerated="false">
+ android:label="Animation/Multiple Properties"
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -988,7 +1028,8 @@
</activity>
<activity android:name=".animation.LayoutAnimations"
- android:label="Animation/Layout Animations">
+ android:label="Animation/Layout Animations"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -996,7 +1037,8 @@
</activity>
<activity android:name=".animation.LayoutAnimationsHideShow"
- android:label="Animation/Hide-Show Animations">
+ android:label="Animation/Hide-Show Animations"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -1004,7 +1046,8 @@
</activity>
<activity android:name=".animation.LayoutAnimationsByDefault"
- android:label="Animation/Default Layout Animations">
+ android:label="Animation/Default Layout Animations"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -1684,7 +1727,8 @@
<activity android:name=".view.Controls3"
android:label="Views/Controls/3. Holo Light Theme"
- android:theme="@android:style/Theme.Holo.Light">
+ android:theme="@android:style/Theme.Holo.Light"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -1693,7 +1737,26 @@
<activity android:name=".view.Controls4"
android:label="Views/Controls/4. Holo Dark Theme"
- android:theme="@android:style/Theme.Holo">
+ android:theme="@android:style/Theme.Holo"
+ android:enabled="@bool/atLeastHoneycomb">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".view.Controls5"
+ android:label="Views/Controls/5. Custom Theme"
+ android:theme="@style/CustomTheme">
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.SAMPLE_CODE" />
+ </intent-filter>
+ </activity>
+
+ <activity android:name=".view.Controls6"
+ android:label="Views/Controls/6. Holo or Old Theme"
+ android:theme="@style/ThemeHolo">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
@@ -1889,7 +1952,8 @@
<activity android:name=".view.DragAndDropDemo"
android:label="Views/Drag and Drop"
- android:hardwareAccelerated="false">
+ android:hardwareAccelerated="false"
+ android:enabled="@bool/atLeastHoneycomb">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
diff --git a/samples/ApiDemos/res/layout/controls_1.xml b/samples/ApiDemos/res/layout/controls_1.xml
index 63a2de1..e280188 100644
--- a/samples/ApiDemos/res/layout/controls_1.xml
+++ b/samples/ApiDemos/res/layout/controls_1.xml
@@ -139,6 +139,14 @@
android:text="@string/listSeparatorTextViewStyle"
android:layout_marginTop="5dip"
/>
+
+ <TextView
+ android:layout_height="wrap_content"
+ android:layout_width="wrap_content"
+ android:layout_marginTop="400dip"
+ android:textAppearance="?android:attr/textAppearanceLarge"
+ android:text="(And all inside of a ScrollView!)"
+ />
</LinearLayout>
diff --git a/samples/ApiDemos/res/values-v11/bools.xml b/samples/ApiDemos/res/values-v11/bools.xml
new file mode 100644
index 0000000..5ea02dd
--- /dev/null
+++ b/samples/ApiDemos/res/values-v11/bools.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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>
+ <!-- True if running under Honeycomb or later. -->
+ <bool name="atLeastHoneycomb">true</bool>
+</resources>
diff --git a/samples/ApiDemos/res/values-v11/styles.xml b/samples/ApiDemos/res/values-v11/styles.xml
new file mode 100644
index 0000000..aa8f2ce
--- /dev/null
+++ b/samples/ApiDemos/res/values-v11/styles.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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>
+ <!-- For API level 11 or later, the Holo theme is available and we prefer that. -->
+ <style name="ThemeHolo" parent="android:Theme.Holo">
+ </style>
+</resources>
diff --git a/samples/ApiDemos/res/values/bools.xml b/samples/ApiDemos/res/values/bools.xml
new file mode 100644
index 0000000..0faffb3
--- /dev/null
+++ b/samples/ApiDemos/res/values/bools.xml
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2011 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>
+ <!-- This resource is true if running under at least Honeycomb's
+ API level. The default value is false; an alternative value
+ for Honeycomb is true. -->
+ <bool name="atLeastHoneycomb">false</bool>
+</resources>
diff --git a/samples/ApiDemos/res/values/styles.xml b/samples/ApiDemos/res/values/styles.xml
index 8cc8312..1a295ba 100644
--- a/samples/ApiDemos/res/values/styles.xml
+++ b/samples/ApiDemos/res/values/styles.xml
@@ -15,6 +15,21 @@
-->
<resources>
+ <!-- A custom theme that is a variation on the light them with a different
+ background color. -->
+ <color name="custom_theme_color">#b0b0ff</color>
+ <style name="CustomTheme" parent="android:Theme.Light">
+ <item name="android:windowBackground">@color/custom_theme_color</item>
+ <item name="android:colorBackground">@color/custom_theme_color</item>
+ </style>
+
+ <!-- This is a theme that will adjust itself depending on the API version.
+ The default definition is the safe one, using a theme that has always
+ been defined. Look at values-11/styles.xml for a variation that is
+ selected when the holographic theme is available. -->
+ <style name="ThemeHolo" parent="android:Theme">
+ </style>
+
<!-- Base application theme is the default theme. -->
<style name="Theme" parent="android:Theme">
</style>
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Controls5.java b/samples/ApiDemos/src/com/example/android/apis/view/Controls5.java
new file mode 100644
index 0000000..dcc515b
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Controls5.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2011 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.example.android.apis.view;
+
+public class Controls5 extends Controls1 {}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/Controls6.java b/samples/ApiDemos/src/com/example/android/apis/view/Controls6.java
new file mode 100644
index 0000000..3002259
--- /dev/null
+++ b/samples/ApiDemos/src/com/example/android/apis/view/Controls6.java
@@ -0,0 +1,19 @@
+/*
+ * Copyright (C) 2011 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.example.android.apis.view;
+
+public class Controls6 extends Controls1 {}
diff --git a/samples/ApiDemos/src/com/example/android/apis/view/_index.html b/samples/ApiDemos/src/com/example/android/apis/view/_index.html
index 0a435c1..e72890a 100644
--- a/samples/ApiDemos/src/com/example/android/apis/view/_index.html
+++ b/samples/ApiDemos/src/com/example/android/apis/view/_index.html
@@ -259,21 +259,31 @@
<h3>Controls</h3>
<dl>
- <dt><a href="Controls1.html">1. Theme Light</a></dt>
+ <dt><a href="Controls1.html">1. Light Theme</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the light theme. </dd>
</dl>
<dl>
- <dt><a href="Controls1.html">2. Theme Dark</a></dt>
+ <dt><a href="Controls1.html">2. Dark Theme</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark theme. </dd>
</dl>
<dl>
- <dt><a href="Controls1.html">3. Theme Holographic Light</a></dt>
+ <dt><a href="Controls1.html">3. Holographic Light Theme</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the light holographic theme. </dd>
</dl>
<dl>
- <dt><a href="Controls1.html">4. Theme Holographic Dark</a></dt>
+ <dt><a href="Controls1.html">4. Holographic Dark Theme</a></dt>
<dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using the dark holographic theme. </dd>
</dl>
+<dl>
+ <dt><a href="Controls1.html">5. Custom Theme</a></dt>
+ <dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using a custom
+ theme based on the light theme. </dd>
+</dl>
+<dl>
+ <dt><a href="Controls1.html">6. Holo or Old Theme</a></dt>
+ <dd>Demonstrates a variety of common form type widgets, such as check boxes and radio buttons using a custom
+ theme that uses either the traditional or holo theme depending on the version of the platform. </dd>
+</dl>
<h3>Auto Complete</h3>
<dl>
diff --git a/tools/emulator/skins/WXGA/background_land.png b/tools/emulator/skins/WXGA/background_land.png
index fe82824..cb10cd8 100755
--- a/tools/emulator/skins/WXGA/background_land.png
+++ b/tools/emulator/skins/WXGA/background_land.png
Binary files differ
diff --git a/tools/emulator/skins/WXGA/background_port.png b/tools/emulator/skins/WXGA/background_port.png
index 0dee95d..76851da 100755
--- a/tools/emulator/skins/WXGA/background_port.png
+++ b/tools/emulator/skins/WXGA/background_port.png
Binary files differ
diff --git a/tools/emulator/skins/WXGA/layout b/tools/emulator/skins/WXGA/layout
index 9d6c8c4..0aaeb1e 100755
--- a/tools/emulator/skins/WXGA/layout
+++ b/tools/emulator/skins/WXGA/layout
@@ -12,389 +12,22 @@
device {
display {
- width 800
- height 1280
+ width 1280
+ height 800
x 0
y 0
}
}
- controls {
- background {
- image controls.png
- }
- buttons {
- soft-left {
- image button.png
- x 56
- y 142
- }
- home {
- image button.png
- x 0
- y 142
- }
- back {
- image button.png
- x 112
- y 142
- }
- dpad-up {
- image arrow_up.png
- x 77
- y 53
- }
- dpad-down {
- image arrow_down.png
- x 77
- y 106
- }
- dpad-left {
- image arrow_left.png
- x 53
- y 53
- }
- dpad-right {
- image arrow_right.png
- x 123
- y 53
- }
- dpad-center {
- image select.png
- x 77
- y 81
- }
- phone-dial {
- image button.png
- x 0
- y 71
- }
- phone-hangup {
- image button.png
- x 168
- y 71
- }
-
- power {
- image button.png
- x 168
- y 0
- }
-
- volume-up {
- image button.png
- x 112
- y 0
- }
-
- volume-down {
- image button.png
- x 56
- y 0
- }
-
- search {
- image button.png
- x 168
- y 142
- }
-
- }
- }
-
- keyboard {
- background {
- image keyboard.png
- }
- buttons {
- 1 {
- image key.png
- x 5
- y 5
- }
- 2 {
- image key.png
- x 42
- y 5
- }
- 3 {
- image key.png
- x 79
- y 5
- }
- 4 {
- image key.png
- x 116
- y 5
- }
- 5 {
- image key.png
- x 153
- y 5
- }
- 6 {
- image key.png
- x 190
- y 5
- }
- 7 {
- image key.png
- x 227
- y 5
- }
- 8 {
- image key.png
- x 264
- y 5
- }
- 9 {
- image key.png
- x 301
- y 5
- }
- 0 {
- image key.png
- x 338
- y 5
- }
-
- q {
- image key.png
- x 5
- y 41
- }
- w {
- image key.png
- x 42
- y 41
- }
- e {
- image key.png
- x 79
- y 41
- }
- r {
- image key.png
- x 116
- y 41
- }
- t {
- image key.png
- x 153
- y 41
- }
- y {
- image key.png
- x 190
- y 41
- }
- u {
- image key.png
- x 227
- y 41
- }
- i {
- image key.png
- x 264
- y 41
- }
- o {
- image key.png
- x 301
- y 41
- }
- p {
- image key.png
- x 338
- y 41
- }
-
- a {
- image key.png
- x 5
- y 77
- }
- s {
- image key.png
- x 42
- y 77
- }
- d {
- image key.png
- x 79
- y 77
- }
- f {
- image key.png
- x 116
- y 77
- }
- g {
- image key.png
- x 153
- y 77
- }
- h {
- image key.png
- x 190
- y 77
- }
- j {
- image key.png
- x 227
- y 77
- }
- k {
- image key.png
- x 264
- y 77
- }
- l {
- image key.png
- x 301
- y 77
- }
- DEL {
- image key.png
- x 338
- y 77
- }
-
- CAP {
- image key.png
- x 5
- y 113
- }
- z {
- image key.png
- x 42
- y 113
- }
- x {
- image key.png
- x 79
- y 113
- }
- c {
- image key.png
- x 116
- y 113
- }
- v {
- image key.png
- x 153
- y 113
- }
- b {
- image key.png
- x 190
- y 113
- }
- n {
- image key.png
- x 227
- y 113
- }
- m {
- image key.png
- x 264
- y 113
- }
- PERIOD {
- image key.png
- x 301
- y 113
- }
- ENTER {
- image key.png
- x 338
- y 113
- }
-
- ALT {
- image key.png
- x 5
- y 149
- }
- SYM {
- image key.png
- x 42
- y 149
- }
- AT {
- image key.png
- x 79
- y 149
- }
- SPACE {
- image spacebar.png
- x 116
- y 149
- }
- SLASH {
- image key.png
- x 264
- y 149
- }
- COMMA {
- image key.png
- x 301
- y 149
- }
- ALT2 {
- image key.png
- x 338
- y 149
- }
-
- }
- }
}
layouts {
- portrait {
- width 1270
- height 1334
- color 0xe0e0e0
- event EV_SW:0:1
-
- part1 {
- name portrait
- x 0
- y 0
- }
-
- part2 {
- name landscape
- x 1400
- y 0
- }
-
- part3 {
- name device
- x 27
- y 27
- }
- part4 {
- name controls
- x 955
- y 367
- }
- part5 {
- name keyboard
- x 874
- y 619
- }
-
- }
landscape {
width 1333
- height 1081
+ height 855
color 0xe0e0e0
- event EV_SW:0:0
-
- dpad-rotation 3
+ event EV_SW:0:1
part1 {
name portrait
@@ -411,22 +44,38 @@
part3 {
name device
x 26
- y 829
- rotation 3
- }
-
- part4 {
- name controls
- x 779
- y 876
- }
-
- part5 {
- name keyboard
- x 338
- y 876
+ y 29
}
}
+
+ portrait {
+ width 853
+ height 1334
+ color 0xe0e0e0
+ event EV_SW:0:0
+
+ dpad-rotation 3
+
+ part1 {
+ name portrait
+ x 0
+ y 0
+ }
+
+ part2 {
+ name landscape
+ x 1400
+ y 0
+ }
+
+ part3 {
+ name device
+ x 27
+ y 1307
+ rotation 3
+ }
+ }
+
}
keyboard {