Skip to content
This repository has been archived by the owner on Nov 8, 2023. It is now read-only.

Commit

Permalink
Merge "Making StackWidget sample code stand alone as opposed to bundl…
Browse files Browse the repository at this point in the history
…ed with HoneycombGallery" into honeycomb
  • Loading branch information
Adam Cohen authored and Android (Google) Code Review committed Feb 11, 2011
2 parents e412a0f + 1ff28c7 commit 0d9ac4f
Show file tree
Hide file tree
Showing 22 changed files with 329 additions and 246 deletions.
14 changes: 0 additions & 14 deletions samples/HoneycombGallery/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -47,19 +47,5 @@
<activity android:name=".CameraSample"
android:label="@string/camera_sample"
android:screenOrientation="landscape" />

<!-- StackView widget sample code -->
<receiver android:name=".widget.WidgetProvider"
android:label="@string/app_widget_name">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/widget_info" />
</receiver>
<service android:name=".widget.WidgetService"
android:exported="true"
android:permission="android.permission.BIND_REMOTEVIEWS" />

</application>
</manifest>
4 changes: 2 additions & 2 deletions samples/HoneycombGallery/_index.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@
<li>The new <a href="../../../reference/android/animation/package-summary.html"><code>android.animation</code></a>
framework</li>
<li>Custom notifications</li>
<li><a href="../../../reference/android/widget/StackView.html"><code>StackView</code></a>
and other adapter-based app widgets</li>
<li>For information on how to implement <a href="../../../reference/android/widget/StackView.html"><code>StackView</code></a>
and other adapter-based app widgets, see <a href="../StackWidget/index.html">StackView App Widget</a></li>
</ul>

<p>The image gallery shows how all these pieces can work together in one application.</p>
Expand Down
Binary file not shown.
19 changes: 0 additions & 19 deletions samples/HoneycombGallery/res/drawable/widget_item_background.xml

This file was deleted.

25 changes: 0 additions & 25 deletions samples/HoneycombGallery/res/layout/widget_item.xml

This file was deleted.

23 changes: 0 additions & 23 deletions samples/HoneycombGallery/res/xml/widget_info.xml

This file was deleted.

This file was deleted.

16 changes: 16 additions & 0 deletions samples/StackWidget/Android.mk
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)

LOCAL_MODULE_TAGS := tests

# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)

LOCAL_PACKAGE_NAME := StackWidget

LOCAL_SDK_VERSION := current

include $(BUILD_PACKAGE)

# Use the following include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))
39 changes: 39 additions & 0 deletions samples/StackWidget/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?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.
-->

<!-- Declare the contents of this Android application. The namespace
attribute brings in the Android platform namespace, and the package
supplies a unique name for the application. When writing your
own application, the package name must be changed from "com.example.*"
to come from a domain that you own or have control over. -->

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.android.stackwidget">
<uses-sdk android:targetSdkVersion="11" android:minSdkVersion="11"/>
<application android:label="StackWidget">
<receiver android:name="StackWidgetProvider">
<intent-filter>
<action android:name="android.appwidget.action.APPWIDGET_UPDATE" />
</intent-filter>
<meta-data android:name="android.appwidget.provider"
android:resource="@xml/stackwidgetinfo" />
</receiver>

<service android:name="StackWidgetService"
android:permission="android.permission.BIND_REMOTEVIEWS"
android:exported="false" />
</application>
</manifest>
31 changes: 31 additions & 0 deletions samples/StackWidget/_index.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
<p>
This sample shows how to construct a simple collection widget. This particular example shows how
to create a widget containing a <a href="../../../reference/android/widget/StackView.html"><code>StackView</code></a>
; however, only minimal changes are required to include
a <a href="../../../reference/android/widget/ListView.html"><code>ListView</code></a>,
<a href="../../../reference/android/widget/GridView.html"><code>GridView</code></a> or
<a href="../../../reference/android/widget/AdapterViewFlipper.html"><code>AdapterViewFlipper</code></a> instead.
</p>
<p>
The sample demonstrates the following:
</p>
<ul>
<li>
The pattern for creating and wiring a <a href="../../../reference/android/widget/RemoteViewsService.html"><code>RemoteViewsService</code></a>
and <a href="../../../reference/android/widget/RemoteViewsService.RemoteViewsFactory.html"><code>RemoteViewsFactory</code></a> which
serve the function of an adapter for the widget collection.
</li>
<li>
The pattern for setting an intent template and fill-in intents in order to
provide children of the collection with click behaviour.
</li>
<li>
How to make a widget with a <a href="../../../reference/android/widget/StackView.html"><code>StackView</code></a>
(or <a href="../../../reference/android/widget/AdapterViewFlipper.html"><code>AdapterViewFlipper</code></a>) auto-advance.
</li>
<li>
How to set a widget preview image.
</li>
</ul>
<img alt="The widget."
src="../images/StackWidget.png"/>
Binary file added samples/StackWidget/res/drawable-hdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/StackWidget/res/drawable-ldpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added samples/StackWidget/res/drawable-mdpi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
18 changes: 18 additions & 0 deletions samples/StackWidget/res/drawable-nodpi/widget_item_background.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?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.
-->
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle">
<gradient android:startColor="#ff666666" android:endColor="#ff333333" android:angle="270" />
</shape>
24 changes: 24 additions & 0 deletions samples/StackWidget/res/layout/widget_item.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
<?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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/widget_item"
android:layout_width="120dp"
android:layout_height="120dp"
android:gravity="center"
android:background="@drawable/widget_item_background"
android:textColor="#ffffff"
android:textStyle="bold"
android:textSize="44sp" />
Loading

0 comments on commit 0d9ac4f

Please sign in to comment.