am 94703eef: am 10c33528: Extract support lib samples out of ApiDemos and in to their own app.

* commit '94703eef4ce1a5dcfd8ed1a001a41374ec51f94a':
  Extract support lib samples out of ApiDemos and in to their own app.
This commit is contained in:
Dianne Hackborn
2011-05-31 10:54:18 -07:00
committed by Android Git Automerger
56 changed files with 1614 additions and 232 deletions

View File

@@ -10,8 +10,6 @@ LOCAL_SRC_FILES += \
src/com/example/android/apis/app/IRemoteServiceCallback.aidl \
src/com/example/android/apis/app/ISecondary.aidl \
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
LOCAL_PACKAGE_NAME := ApiDemos
LOCAL_SDK_VERSION := current

View File

@@ -38,6 +38,10 @@
<uses-sdk android:minSdkVersion="4" />
<!-- This app has not been optimized for large screens. -->
<supports-screens android:requiresSmallestWidthDp="320"
android:compatibleWidthLimitDp="480" />
<!-- We will request access to the camera, saying we require a camera
of some sort but not one with autofocus capability. -->
<uses-permission android:name="android.permission.CAMERA" />
@@ -357,115 +361,6 @@
</intent-filter>
</activity>
<!-- Fragment Support Samples -->
<activity android:name=".support.app.FragmentAlertDialogSupport"
android:label="@string/fragment_alert_dialog_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentArgumentsSupport"
android:label="@string/fragment_arguments_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentHideShowSupport"
android:label="@string/fragment_hide_show_support"
android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentContextMenuSupport"
android:label="@string/fragment_context_menu_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentDialogSupport"
android:label="@string/fragment_dialog_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentDialogOrActivitySupport"
android:label="@string/fragment_dialog_or_activity_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentLayoutSupport"
android:label="@string/fragment_layout_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentListArraySupport"
android:label="@string/fragment_list_array_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentLayoutSupport$DetailsActivity" />
<activity android:name=".support.app.FragmentMenuSupport"
android:label="@string/fragment_menu_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentRetainInstanceSupport"
android:label="@string/fragment_retain_instance_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentReceiveResultSupport"
android:label="@string/fragment_receive_result_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentStackSupport"
android:label="@string/fragment_stack_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.FragmentPagerSupport"
android:label="@string/fragment_pager_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<!-- Loader Samples -->
<activity android:name=".app.LoaderCursor"
@@ -500,26 +395,6 @@
android:enabled="@bool/atLeastHoneycomb" />
<!-- END_INCLUDE(loader_throttle) -->
<!-- Fragment Support Samples -->
<activity android:name=".support.app.LoaderCursorSupport"
android:label="@string/loader_cursor_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".support.app.LoaderThrottleSupport"
android:label="@string/loader_throttle_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.SAMPLE_CODE" />
</intent-filter>
</activity>
<provider android:name=".support.app.LoaderThrottleSupport$SimpleProvider"
android:authorities="com.example.android.apis.support.app.LoaderThrottle" />
<!-- Intent Samples -->
<activity android:name=".app.Intents" android:label="@string/activity_intents">

View File

@@ -37,8 +37,7 @@ document.write(""+
" <li><a href='src/com/example/android/apis/media/index.html'>Media</a></li>"+
" <li><a href='src/com/example/android/apis/os/index.html'>OS</a></li>"+
" <li><a href='src/com/example/android/apis/text/index.html'>Text</a></li>"+
" <li><a href='src/com/example/android/apis/view/index.html'>Views</a></li></ul>"+
" <li><a href='src/com/example/android/apis/support/index.html'>Static Support Library</a></li>");
" <li><a href='src/com/example/android/apis/view/index.html'>Views</a></li></ul>");
}

View File

@@ -150,42 +150,12 @@
<string name="fragment_stack">App/Fragment/Stack</string>
<string name="new_fragment">New fragment</string>
<string name="fragment_alert_dialog_support">Support/App/Fragment/Alert Dialog</string>
<string name="fragment_arguments_support">Support/App/Fragment/Arguments</string>
<string name="fragment_hide_show_support">Support/App/Fragment/Hide and Show</string>
<string name="fragment_context_menu_support">Support/App/Fragment/Context Menu</string>
<string name="fragment_dialog_support">Support/App/Fragment/Dialog</string>
<string name="fragment_dialog_or_activity_support">Support/App/Fragment/Dialog or Activity</string>
<string name="fragment_layout_support">Support/App/Fragment/Layout</string>
<string name="fragment_list_array_support">Support/App/Fragment/List Array</string>
<string name="fragment_menu_support">Support/App/Fragment/Menu</string>
<string name="fragment_retain_instance_support">Support/App/Fragment/Retain Instance</string>
<string name="fragment_receive_result_support">Support/App/Fragment/Receive Result</string>
<string name="fragment_stack_support">Support/App/Fragment/Stack</string>
<string name="fragment_pager_support">Support/App/Fragment/Pager</string>
<string name="loader_cursor">App/Loader/Cursor</string>
<string name="loader_custom">App/Loader/Custom</string>
<string name="loader_throttle">App/Loader/Throttle</string>
<string name="loader_cursor_support">Support/App/Loader/Cursor</string>
<string name="loader_throttle_support">Support/Loader/Throttle</string>
<string name="activity_menu">App/Activity/Menu</string>
<string name="open_menu">Open menu</string>
<string name="close_menu">Close menu</string>

View File

@@ -0,0 +1,18 @@
LOCAL_PATH:= $(call my-dir)
include $(CLEAR_VARS)
LOCAL_MODULE_TAGS := samples tests
# Only compile source java files in this apk.
LOCAL_SRC_FILES := $(call all-java-files-under, src)
LOCAL_STATIC_JAVA_LIBRARIES += android-support-v4
LOCAL_PACKAGE_NAME := Support4Demos
LOCAL_SDK_VERSION := current
include $(BUILD_PACKAGE)
# Use the folloing include to make our test apk.
include $(call all-makefiles-under,$(LOCAL_PATH))

View File

@@ -0,0 +1,177 @@
<?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.
-->
<!-- 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.supportv4">
<uses-permission android:name="android.permission.READ_CONTACTS" />
<uses-sdk android:minSdkVersion="4" />
<!-- This app has not been optimized for large screens. -->
<supports-screens android:requiresSmallestWidthDp="320"
android:compatibleWidthLimitDp="480" />
<application android:label="@string/activity_sample_code"
android:icon="@drawable/app_sample_code"
android:hardwareAccelerated="true">
<activity android:name="Support4Demos">
<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=".app.SendResult"
android:theme="@style/ThemeDialogWhenLarge">
</activity>
<!-- Fragment Support Samples -->
<activity android:name=".app.FragmentAlertDialogSupport"
android:label="@string/fragment_alert_dialog_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentArgumentsSupport"
android:label="@string/fragment_arguments_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentHideShowSupport"
android:label="@string/fragment_hide_show_support"
android:windowSoftInputMode="stateUnchanged">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentContextMenuSupport"
android:label="@string/fragment_context_menu_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentDialogSupport"
android:label="@string/fragment_dialog_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentDialogOrActivitySupport"
android:label="@string/fragment_dialog_or_activity_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentLayoutSupport"
android:label="@string/fragment_layout_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentListArraySupport"
android:label="@string/fragment_list_array_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentLayoutSupport$DetailsActivity" />
<activity android:name=".app.FragmentMenuSupport"
android:label="@string/fragment_menu_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentRetainInstanceSupport"
android:label="@string/fragment_retain_instance_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentReceiveResultSupport"
android:label="@string/fragment_receive_result_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentStackSupport"
android:label="@string/fragment_stack_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.FragmentPagerSupport"
android:label="@string/fragment_pager_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.LoaderCursorSupport"
android:label="@string/loader_cursor_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<activity android:name=".app.LoaderThrottleSupport"
android:label="@string/loader_throttle_support">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="com.example.android.supportv4.SUPPORT4_SAMPLE_CODE" />
</intent-filter>
</activity>
<provider android:name=".app.LoaderThrottleSupport$SimpleProvider"
android:authorities="com.example.android.apis.supportv4.app.LoaderThrottle" />
</application>
</manifest>

View File

@@ -0,0 +1,26 @@
<p>The Support v4 Demos application contains a variety of small sample
code showing how to use key features of the support library.
This library contains code that you can
build in to your application to access new features and common
utilities while being able to run down to version 1.6 (API 4)
of the platform.
</p>
<script type="text/javascript">
// This is a totally temporary hack to display the following content only
// when the docs are online. This will be changed once the samples get moved.
if (toRoot == "/") {
document.write(""+
"<p>You'll notice that all the samples are included in a single Android "+
"project, so the application code and other resource files for all samples are batched "+
"together. Current samples are only for the fragment and loader in the "+
"application part of the support library:</p>"+
"<ul><li><a href='src/com/example/android/supportv4/app/index.html'>App</a></li></ul>");
}
</script>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -35,7 +35,7 @@
<LinearLayout android:orientation="horizontal" android:padding="4dip"
android:layout_width="match_parent" android:layout_height="wrap_content">
<fragment class="com.example.android.apis.support.app.FragmentArgumentsSupport$MyFragment"
<fragment class="com.example.android.supportv4.app.FragmentArgumentsSupport$MyFragment"
android:id="@+id/embedded"
android:layout_width="0px" android:layout_height="wrap_content"
android:layout_weight="1"
@@ -49,7 +49,7 @@
</LinearLayout>
<fragment class="com.example.android.apis.support.app.FragmentArgumentsSupport$MyFragment"
<fragment class="com.example.android.supportv4.app.FragmentArgumentsSupport$MyFragment"
android:id="@+id/embedded_land"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:label="@string/fragment_arguments_embedded_land" />

View File

@@ -22,7 +22,7 @@
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<fragment class="com.example.android.apis.support.app.FragmentLayoutSupport$TitlesFragment"
<fragment class="com.example.android.supportv4.app.FragmentLayoutSupport$TitlesFragment"
android:id="@+id/titles" android:layout_weight="1"
android:layout_width="0px" android:layout_height="match_parent" />

View File

@@ -36,7 +36,7 @@
android:layout_width="match_parent" android:layout_height="wrap_content">
<!-- BEGIN_INCLUDE(from_attributes) -->
<fragment class="com.example.android.apis.support.app.FragmentArgumentsSupport$MyFragment"
<fragment class="com.example.android.supportv4.app.FragmentArgumentsSupport$MyFragment"
android:id="@+id/embedded"
android:layout_width="0px" android:layout_height="wrap_content"
android:layout_weight="1"

View File

@@ -0,0 +1,38 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/fragment_context_menu_msg" />
<Button android:id="@+id/long_press"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/long_press">
<requestFocus />
</Button>
</LinearLayout>

View File

@@ -0,0 +1,40 @@
<?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.
-->
<!-- Top-level content view for the simple fragment sample. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1"
android:layout_gravity="center_vertical|center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:gravity="top|center_horizontal" />
<Button android:id="@+id/show"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/show">
<requestFocus />
</Button>
</LinearLayout>

View File

@@ -0,0 +1,64 @@
<?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.
-->
<!-- Top-level content view for the simple fragment sample. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:id="@+id/text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_gravity="center_vertical|center_horizontal"
android:gravity="top|center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/fragment_dialog_or_activity_msg" />
<Button android:id="@+id/show_dialog"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/show">
<requestFocus />
</Button>
<View android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="1" />
<TextView
android:id="@+id/inline_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_gravity="center_vertical|center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/fragment_dialog_or_activity_inline" />
<FrameLayout
android:id="@+id/embedded"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_weight="0"
android:layout_gravity="center_vertical|center_horizontal"
android:padding="6dp"
android:background="#ff303030"
android:gravity="top|center_horizontal" />
</LinearLayout>

View File

@@ -34,7 +34,7 @@
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Hide" />
<fragment android:name="com.example.android.apis.support.app.FragmentHideShowSupport$FirstFragment"
<fragment android:name="com.example.android.supportv4.app.FragmentHideShowSupport$FirstFragment"
android:id="@+id/fragment1" android:layout_weight="1"
android:layout_width="0px" android:layout_height="wrap_content" />
@@ -48,7 +48,7 @@
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Hide" />
<fragment android:name="com.example.android.apis.support.app.FragmentHideShowSupport$SecondFragment"
<fragment android:name="com.example.android.supportv4.app.FragmentHideShowSupport$SecondFragment"
android:id="@+id/fragment2" android:layout_weight="1"
android:layout_width="0px" android:layout_height="wrap_content" />

View File

@@ -20,7 +20,7 @@
<!-- BEGIN_INCLUDE(layout) -->
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent">
<fragment class="com.example.android.apis.support.app.FragmentLayoutSupport$TitlesFragment"
<fragment class="com.example.android.supportv4.app.FragmentLayoutSupport$TitlesFragment"
android:id="@+id/titles"
android:layout_width="match_parent" android:layout_height="match_parent" />
</FrameLayout>

View File

@@ -0,0 +1,46 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/fragment_menu_msg" />
<CheckBox android:id="@+id/menu1"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:checked="true"
android:text="@string/fragment1menu">
</CheckBox>
<CheckBox android:id="@+id/menu2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:checked="true"
android:text="@string/fragment2menu">
</CheckBox>
</LinearLayout>

View File

@@ -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.
-->
<!-- Top-level content view for the simple fragment sample. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<android.support.v4.app.FragmentPager
android:id="@+id/pager"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1">
</android.support.v4.app.FragmentPager>
<Button android:id="@+id/new_fragment"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/new_fragment">
<requestFocus />
</Button>
</LinearLayout>

View File

@@ -0,0 +1,52 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@android:drawable/gallery_thumb">
<TextView android:id="@+id/text"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:gravity="center_vertical|center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/hello_world"/>
<!-- The frame layout is here since we will be showing either
the empty view or the list view. -->
<FrameLayout
android:layout_width="match_parent"
android:layout_height="0dip"
android:layout_weight="1" >
<!-- Here is the list. Since we are using a ListActivity, we
have to call it "@android:id/list" so ListActivity will
find it -->
<ListView android:id="@android:id/list"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:drawSelectorOnTop="false"/>
<!-- Here is the view to show if the list is emtpy -->
<TextView android:id="@android:id/empty"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="No items."/>
</FrameLayout>
</LinearLayout>

View File

@@ -0,0 +1,46 @@
<?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.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:padding="8dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/fragment_retain_instance_msg" />
<ProgressBar android:id="@+id/progress_horizontal"
style="?android:attr/progressBarStyleHorizontal"
android:layout_width="200dip"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:padding="6dp"
android:max="500" />
<Button android:id="@+id/restart"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:text="@string/restart">
<requestFocus />
</Button>
</LinearLayout>

View File

@@ -0,0 +1,38 @@
<?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.
-->
<!-- Top-level content view for the simple fragment sample. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<FrameLayout
android:id="@+id/simple_fragment"
android:layout_width="match_parent"
android:layout_height="0px"
android:layout_weight="1">
</FrameLayout>
<Button android:id="@+id/new_fragment"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/new_fragment">
<requestFocus />
</Button>
</LinearLayout>

View File

@@ -0,0 +1,26 @@
<?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.
-->
<!-- Demonstrates basic application screen.
See corresponding Java code com.android.sdk.app.HelloWorld.java. -->
<!-- This screen consists of a single text field that
displays our "Hello, World!" text. -->
<TextView xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/text"
android:layout_width="match_parent" android:layout_height="match_parent"
android:gravity="center_vertical|center_horizontal"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/hello_world"/>

View File

@@ -0,0 +1,38 @@
<?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.
-->
<!-- Content for a fragment with a text editor. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:padding="4dip"
android:layout_width="match_parent" android:layout_height="wrap_content">
<TextView android:id="@+id/msg"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
android:paddingBottom="4dip" />
<EditText android:id="@+id/saved"
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="1"
android:background="@drawable/green"
android:text="@string/initial_text"
android:freezesText="true">
<requestFocus />
</EditText>
</LinearLayout>

View File

@@ -0,0 +1,50 @@
<?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.
-->
<!--
Demonstrates receiving activity results.
See corresponding Java code com.android.sdk.app.ReceiveResult.java.
-->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:padding="4dip"
android:gravity="center_horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
android:paddingBottom="4dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/receive_result_instructions"/>
<TextView android:id="@+id/results"
android:layout_width="match_parent" android:layout_height="10dip"
android:layout_weight="1"
android:paddingBottom="4dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="#000"
android:background="@drawable/green">
</TextView>
<Button android:id="@+id/get"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:layout_weight="0"
android:text="@string/receive_result_result">
<requestFocus />
</Button>
</LinearLayout>

View File

@@ -0,0 +1,45 @@
<?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.
-->
<!-- Demonstrates receiving activity results.
See corresponding Java code com.android.sdk.app.ReceiveResult.java. -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent" android:layout_height="match_parent"
android:orientation="vertical"
android:padding="4dip"
android:gravity="center_horizontal">
<TextView
android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_weight="0"
android:paddingBottom="8dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/pick_result"/>
<Button android:id="@+id/corky"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/corky">
<requestFocus />
</Button>
<Button android:id="@+id/violet"
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="@string/violet">
</Button>
</LinearLayout>

View File

@@ -0,0 +1,29 @@
<?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.
-->
<com.example.android.supportv4.view.CheckableFrameLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@android:id/text1"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:textAppearance="?android:attr/textAppearanceLarge"
android:minHeight="?android:attr/listPreferredItemHeight"
android:gravity="center_vertical"
/>
</com.example.android.supportv4.view.CheckableFrameLayout>

View File

@@ -0,0 +1,60 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- 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.
-->
<menu xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@+id/invisible_item"
android:visible="false"
android:alphabeticShortcut="i"
android:title="Invisible item" />
<item android:id="@+id/a_item"
android:alphabeticShortcut="a"
android:title="Alvin" />
<item android:id="@+id/b_item"
android:alphabeticShortcut="b"
android:title="Bart" />
<item android:id="@+id/c_item"
android:alphabeticShortcut="c"
android:title="Chris" />
<item android:id="@+id/d_item"
android:alphabeticShortcut="d"
android:title="David" />
<item android:id="@+id/e_item"
android:alphabeticShortcut="e"
android:title="Eric" />
<item android:id="@+id/f_item"
android:alphabeticShortcut="f"
android:title="Frank" />
<item android:id="@+id/g_item"
android:alphabeticShortcut="g"
android:title="Gary" />
<item android:id="@+id/h_item"
android:alphabeticShortcut="h"
android:title="Henry" />
<item android:id="@+id/excl_item"
android:alphabeticShortcut="!"
android:title="Exclamation" />
</menu>

View File

@@ -0,0 +1,25 @@
<?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>
<!-- For API level 11 or later, we can use the magical DialogWhenLarge theme. -->
<style name="ThemeDialogWhenLarge" parent="android:style/Theme.Holo.DialogWhenLarge">
</style>
</resources>

View File

@@ -0,0 +1,25 @@
<?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>
<!-- These are the attributes that we want to retrieve for
app/FragmentArguments.java -->
<!-- BEGIN_INCLUDE(fragment_arguments) -->
<declare-styleable name="FragmentArguments">
<attr name="android:label" />
</declare-styleable>
<!-- END_INCLUDE(fragment_arguments) -->
</resources>

View File

@@ -0,0 +1,22 @@
<?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>
<drawable name="red">#7f00</drawable>
<drawable name="blue">#770000ff</drawable>
<drawable name="green">#7700ff00</drawable>
<drawable name="yellow">#77ffff00</drawable>
</resources>

View File

@@ -0,0 +1,86 @@
<?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 xmlns:xliff="urn:oasis:names:tc:xliff:document:1.2">
<string name="activity_sample_code">Support v4 Demos</string>
<string name="hello_world"><b>Hello, <i>World!</i></b></string>
<string name="alert_dialog_two_buttons_title">
Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto
siwuf cakso dodtos anr koop.
</string>
<string name="alert_dialog_ok">OK</string>
<string name="alert_dialog_cancel">Cancel</string>
<string name="initial_text">Initial text.</string>
<string name="pick_result">Pick a result to send, or BACK to cancel.</string>
<string name="corky">Corky</string>
<string name="violet">Violet</string>
<string name="receive_result_instructions">Press the button to get an activity result, which will be displayed here:</string>
<string name="receive_result_result">Get Result</string>
<string name="fragment_alert_dialog_support">Fragment/Alert Dialog</string>
<string name="fragment_arguments_support">Fragment/Arguments</string>
<string name="fragment_arguments_msg">Demonstrates a fragment that takes arguments
as a Bundle at runtime (on the right) or from attributes in a layout (on the left).</string>
<string name="fragment_arguments_embedded">From Attributes</string>
<string name="fragment_arguments_embedded_land">Landscape Only</string>
<string name="fragment_hide_show_support">Fragment/Hide and Show</string>
<string name="fragment_context_menu_support">Fragment/Context Menu</string>
<string name="fragment_context_menu_msg">Fragment populating a context
menu; long press the button to see.</string>
<string name="long_press">Long press me</string>
<string name="fragment_dialog_support">Fragment/Dialog</string>
<string name="show">Show</string>
<string name="fragment_dialog_or_activity_support">Fragment/Dialog or Activity</string>
<string name="fragment_dialog_or_activity_msg">Demonstrates the same fragment
being shown as a dialog and embedded inside of an activity.</string>
<string name="fragment_dialog_or_activity_inline">Fragment embedded inside
of the activity:</string>
<string name="fragment_layout_support">Fragment/Layout</string>
<string name="fragment_list_array_support">Fragment/List Array</string>
<string name="fragment_menu_support">Fragment/Menu</string>
<string name="fragment_menu_msg">Build menus from two fragments, allowing
you to hide them to remove them..</string>
<string name="fragment1menu">Show fragment 1 menu</string>
<string name="fragment2menu">Show fragment 2 menu</string>
<string name="fragment_retain_instance_support">Fragment/Retain Instance</string>
<string name="fragment_retain_instance_msg">Current progress of retained fragment;
restarts if fragment is re-created.</string>
<string name="restart">Restart</string>
<string name="fragment_receive_result_support">Fragment/Receive Result</string>
<string name="fragment_stack_support">Fragment/Stack</string>
<string name="new_fragment">New fragment</string>
<string name="fragment_pager_support">Fragment/Pager</string>
<string name="loader_cursor_support">Loader/Cursor</string>
<string name="loader_throttle_support">Loader/Throttle</string>
</resources>

View File

@@ -0,0 +1,32 @@
<?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 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>
<!-- Older platforms don't have Theme.Holo.DialogWhenLarge; we will define
our own wrapper theme that uses it only when running on the appropriate
platform version. On older platforms, we always use the generic
fullscreen theme, because they don't support some feature that help
in correctly laying out an activity as a dialog. -->
<style name="ThemeDialogWhenLarge" parent="android:style/Theme">
</style>
</resources>

View File

@@ -0,0 +1,223 @@
package com.example.android.supportv4;
public final class Shakespeare {
/**
* Our data, part 1.
*/
public static final String[] TITLES =
{
"Henry IV (1)",
"Henry V",
"Henry VIII",
"Richard II",
"Richard III",
"Merchant of Venice",
"Othello",
"King Lear"
};
/**
* Our data, part 2.
*/
public static final String[] DIALOGUE =
{
"So shaken as we are, so wan with care," +
"Find we a time for frighted peace to pant," +
"And breathe short-winded accents of new broils" +
"To be commenced in strands afar remote." +
"No more the thirsty entrance of this soil" +
"Shall daub her lips with her own children's blood;" +
"Nor more shall trenching war channel her fields," +
"Nor bruise her flowerets with the armed hoofs" +
"Of hostile paces: those opposed eyes," +
"Which, like the meteors of a troubled heaven," +
"All of one nature, of one substance bred," +
"Did lately meet in the intestine shock" +
"And furious close of civil butchery" +
"Shall now, in mutual well-beseeming ranks," +
"March all one way and be no more opposed" +
"Against acquaintance, kindred and allies:" +
"The edge of war, like an ill-sheathed knife," +
"No more shall cut his master. Therefore, friends," +
"As far as to the sepulchre of Christ," +
"Whose soldier now, under whose blessed cross" +
"We are impressed and engaged to fight," +
"Forthwith a power of English shall we levy;" +
"Whose arms were moulded in their mothers' womb" +
"To chase these pagans in those holy fields" +
"Over whose acres walk'd those blessed feet" +
"Which fourteen hundred years ago were nail'd" +
"For our advantage on the bitter cross." +
"But this our purpose now is twelve month old," +
"And bootless 'tis to tell you we will go:" +
"Therefore we meet not now. Then let me hear" +
"Of you, my gentle cousin Westmoreland," +
"What yesternight our council did decree" +
"In forwarding this dear expedience.",
"Hear him but reason in divinity," +
"And all-admiring with an inward wish" +
"You would desire the king were made a prelate:" +
"Hear him debate of commonwealth affairs," +
"You would say it hath been all in all his study:" +
"List his discourse of war, and you shall hear" +
"A fearful battle render'd you in music:" +
"Turn him to any cause of policy," +
"The Gordian knot of it he will unloose," +
"Familiar as his garter: that, when he speaks," +
"The air, a charter'd libertine, is still," +
"And the mute wonder lurketh in men's ears," +
"To steal his sweet and honey'd sentences;" +
"So that the art and practic part of life" +
"Must be the mistress to this theoric:" +
"Which is a wonder how his grace should glean it," +
"Since his addiction was to courses vain," +
"His companies unletter'd, rude and shallow," +
"His hours fill'd up with riots, banquets, sports," +
"And never noted in him any study," +
"Any retirement, any sequestration" +
"From open haunts and popularity.",
"I come no more to make you laugh: things now," +
"That bear a weighty and a serious brow," +
"Sad, high, and working, full of state and woe," +
"Such noble scenes as draw the eye to flow," +
"We now present. Those that can pity, here" +
"May, if they think it well, let fall a tear;" +
"The subject will deserve it. Such as give" +
"Their money out of hope they may believe," +
"May here find truth too. Those that come to see" +
"Only a show or two, and so agree" +
"The play may pass, if they be still and willing," +
"I'll undertake may see away their shilling" +
"Richly in two short hours. Only they" +
"That come to hear a merry bawdy play," +
"A noise of targets, or to see a fellow" +
"In a long motley coat guarded with yellow," +
"Will be deceived; for, gentle hearers, know," +
"To rank our chosen truth with such a show" +
"As fool and fight is, beside forfeiting" +
"Our own brains, and the opinion that we bring," +
"To make that only true we now intend," +
"Will leave us never an understanding friend." +
"Therefore, for goodness' sake, and as you are known" +
"The first and happiest hearers of the town," +
"Be sad, as we would make ye: think ye see" +
"The very persons of our noble story" +
"As they were living; think you see them great," +
"And follow'd with the general throng and sweat" +
"Of thousand friends; then in a moment, see" +
"How soon this mightiness meets misery:" +
"And, if you can be merry then, I'll say" +
"A man may weep upon his wedding-day.",
"First, heaven be the record to my speech!" +
"In the devotion of a subject's love," +
"Tendering the precious safety of my prince," +
"And free from other misbegotten hate," +
"Come I appellant to this princely presence." +
"Now, Thomas Mowbray, do I turn to thee," +
"And mark my greeting well; for what I speak" +
"My body shall make good upon this earth," +
"Or my divine soul answer it in heaven." +
"Thou art a traitor and a miscreant," +
"Too good to be so and too bad to live," +
"Since the more fair and crystal is the sky," +
"The uglier seem the clouds that in it fly." +
"Once more, the more to aggravate the note," +
"With a foul traitor's name stuff I thy throat;" +
"And wish, so please my sovereign, ere I move," +
"What my tongue speaks my right drawn sword may prove.",
"Now is the winter of our discontent" +
"Made glorious summer by this sun of York;" +
"And all the clouds that lour'd upon our house" +
"In the deep bosom of the ocean buried." +
"Now are our brows bound with victorious wreaths;" +
"Our bruised arms hung up for monuments;" +
"Our stern alarums changed to merry meetings," +
"Our dreadful marches to delightful measures." +
"Grim-visaged war hath smooth'd his wrinkled front;" +
"And now, instead of mounting barded steeds" +
"To fright the souls of fearful adversaries," +
"He capers nimbly in a lady's chamber" +
"To the lascivious pleasing of a lute." +
"But I, that am not shaped for sportive tricks," +
"Nor made to court an amorous looking-glass;" +
"I, that am rudely stamp'd, and want love's majesty" +
"To strut before a wanton ambling nymph;" +
"I, that am curtail'd of this fair proportion," +
"Cheated of feature by dissembling nature," +
"Deformed, unfinish'd, sent before my time" +
"Into this breathing world, scarce half made up," +
"And that so lamely and unfashionable" +
"That dogs bark at me as I halt by them;" +
"Why, I, in this weak piping time of peace," +
"Have no delight to pass away the time," +
"Unless to spy my shadow in the sun" +
"And descant on mine own deformity:" +
"And therefore, since I cannot prove a lover," +
"To entertain these fair well-spoken days," +
"I am determined to prove a villain" +
"And hate the idle pleasures of these days." +
"Plots have I laid, inductions dangerous," +
"By drunken prophecies, libels and dreams," +
"To set my brother Clarence and the king" +
"In deadly hate the one against the other:" +
"And if King Edward be as true and just" +
"As I am subtle, false and treacherous," +
"This day should Clarence closely be mew'd up," +
"About a prophecy, which says that 'G'" +
"Of Edward's heirs the murderer shall be." +
"Dive, thoughts, down to my soul: here" +
"Clarence comes.",
"To bait fish withal: if it will feed nothing else," +
"it will feed my revenge. He hath disgraced me, and" +
"hindered me half a million; laughed at my losses," +
"mocked at my gains, scorned my nation, thwarted my" +
"bargains, cooled my friends, heated mine" +
"enemies; and what's his reason? I am a Jew. Hath" +
"not a Jew eyes? hath not a Jew hands, organs," +
"dimensions, senses, affections, passions? fed with" +
"the same food, hurt with the same weapons, subject" +
"to the same diseases, healed by the same means," +
"warmed and cooled by the same winter and summer, as" +
"a Christian is? If you prick us, do we not bleed?" +
"if you tickle us, do we not laugh? if you poison" +
"us, do we not die? and if you wrong us, shall we not" +
"revenge? If we are like you in the rest, we will" +
"resemble you in that. If a Jew wrong a Christian," +
"what is his humility? Revenge. If a Christian" +
"wrong a Jew, what should his sufferance be by" +
"Christian example? Why, revenge. The villany you" +
"teach me, I will execute, and it shall go hard but I" +
"will better the instruction.",
"Virtue! a fig! 'tis in ourselves that we are thus" +
"or thus. Our bodies are our gardens, to the which" +
"our wills are gardeners: so that if we will plant" +
"nettles, or sow lettuce, set hyssop and weed up" +
"thyme, supply it with one gender of herbs, or" +
"distract it with many, either to have it sterile" +
"with idleness, or manured with industry, why, the" +
"power and corrigible authority of this lies in our" +
"wills. If the balance of our lives had not one" +
"scale of reason to poise another of sensuality, the" +
"blood and baseness of our natures would conduct us" +
"to most preposterous conclusions: but we have" +
"reason to cool our raging motions, our carnal" +
"stings, our unbitted lusts, whereof I take this that" +
"you call love to be a sect or scion.",
"Blow, winds, and crack your cheeks! rage! blow!" +
"You cataracts and hurricanoes, spout" +
"Till you have drench'd our steeples, drown'd the cocks!" +
"You sulphurous and thought-executing fires," +
"Vaunt-couriers to oak-cleaving thunderbolts," +
"Singe my white head! And thou, all-shaking thunder," +
"Smite flat the thick rotundity o' the world!" +
"Crack nature's moulds, an germens spill at once," +
"That make ingrateful man!"
};
}

View File

@@ -0,0 +1,149 @@
/*
* 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.supportv4;
import android.app.ListActivity;
import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.view.View;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import java.text.Collator;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class Support4Demos extends ListActivity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = getIntent();
String path = intent.getStringExtra("com.example.android.apis.Path");
if (path == null) {
path = "";
}
setListAdapter(new SimpleAdapter(this, getData(path),
android.R.layout.simple_list_item_1, new String[] { "title" },
new int[] { android.R.id.text1 }));
getListView().setTextFilterEnabled(true);
}
protected List<Map<String, Object>> getData(String prefix) {
List<Map<String, Object>> myData = new ArrayList<Map<String, Object>>();
Intent mainIntent = new Intent(Intent.ACTION_MAIN, null);
mainIntent.addCategory("com.example.android.supportv4.SUPPORT4_SAMPLE_CODE");
PackageManager pm = getPackageManager();
List<ResolveInfo> list = pm.queryIntentActivities(mainIntent, 0);
if (null == list)
return myData;
String[] prefixPath;
String prefixWithSlash = prefix;
if (prefix.equals("")) {
prefixPath = null;
} else {
prefixPath = prefix.split("/");
prefixWithSlash = prefix + "/";
}
int len = list.size();
Map<String, Boolean> entries = new HashMap<String, Boolean>();
for (int i = 0; i < len; i++) {
ResolveInfo info = list.get(i);
CharSequence labelSeq = info.loadLabel(pm);
String label = labelSeq != null
? labelSeq.toString()
: info.activityInfo.name;
if (prefixWithSlash.length() == 0 || label.startsWith(prefixWithSlash)) {
String[] labelPath = label.split("/");
String nextLabel = prefixPath == null ? labelPath[0] : labelPath[prefixPath.length];
if ((prefixPath != null ? prefixPath.length : 0) == labelPath.length - 1) {
addItem(myData, nextLabel, activityIntent(
info.activityInfo.applicationInfo.packageName,
info.activityInfo.name));
} else {
if (entries.get(nextLabel) == null) {
addItem(myData, nextLabel, browseIntent(prefix.equals("") ? nextLabel : prefix + "/" + nextLabel));
entries.put(nextLabel, true);
}
}
}
}
Collections.sort(myData, sDisplayNameComparator);
return myData;
}
private final static Comparator<Map<String, Object>> sDisplayNameComparator =
new Comparator<Map<String, Object>>() {
private final Collator collator = Collator.getInstance();
public int compare(Map<String, Object> map1, Map<String, Object> map2) {
return collator.compare(map1.get("title"), map2.get("title"));
}
};
protected Intent activityIntent(String pkg, String componentName) {
Intent result = new Intent();
result.setClassName(pkg, componentName);
return result;
}
protected Intent browseIntent(String path) {
Intent result = new Intent();
result.setClass(this, Support4Demos.class);
result.putExtra("com.example.android.apis.Path", path);
return result;
}
protected void addItem(List<Map<String, Object>> data, String name, Intent intent) {
Map<String, Object> temp = new HashMap<String, Object>();
temp.put("title", name);
temp.put("intent", intent);
data.add(temp);
}
@Override
@SuppressWarnings("unchecked")
protected void onListItemClick(ListView l, View v, int position, long id) {
Map<String, Object> map = (Map<String, Object>)l.getItemAtPosition(position);
Intent intent = (Intent) map.get("intent");
startActivity(intent);
}
}

View File

@@ -0,0 +1,24 @@
<html>
<head>
<link rel="stylesheet" type="text/css" href="assets/style.css" />
<script type="text/javascript" src="http://www.corp.google.com/style/prettify.js"></script>
<script src="http://www.corp.google.com/eng/techpubs/include/navbar.js" type="text/javascript"></script>
</head>
<body>
<p>
Examples of how to use support library APIs. See:
<ol>
<li> <a href="com.example.android.supportv4.app">sdk.app</a> for examples
of using the application package support APIs.
</ol>
</p>
</body>
</html>

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.Fragment;

View File

@@ -14,22 +14,21 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import com.example.android.supportv4.R;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.util.Log;
import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.LayoutInflater;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.ContextMenu.ContextMenuInfo;
/**
* Demonstration of displaying a context menu from a fragment.

View File

@@ -14,19 +14,18 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.os.Bundle;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentTransaction;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.DialogFragment;
import android.support.v4.app.Fragment;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,10 +14,10 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.apis.Shakespeare;
import com.example.android.supportv4.R;
import com.example.android.supportv4.Shakespeare;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.Shakespeare;
import com.example.android.supportv4.Shakespeare;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.ListFragment;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,10 +14,10 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.apis.Shakespeare;
import com.example.android.supportv4.R;
import com.example.android.supportv4.Shakespeare;
import android.os.Bundle;
import android.support.v4.app.Fragment;

View File

@@ -14,10 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.apis.app.SendResult;
import com.example.android.supportv4.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,9 +14,9 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import com.example.android.apis.R;
import com.example.android.supportv4.R;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
@@ -32,7 +32,6 @@ import android.text.TextUtils;
import android.util.Log;
import android.view.Menu;
import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.widget.ListView;

View File

@@ -14,7 +14,7 @@
* limitations under the License.
*/
package com.example.android.apis.support.app;
package com.example.android.supportv4.app;
//BEGIN_INCLUDE(complete)
import android.support.v4.app.FragmentActivity;

View File

@@ -0,0 +1,81 @@
/*
* 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.
*/
package com.example.android.supportv4.app;
// Need the following import to get access to the app resources, since this
// class is in a sub-package.
import com.example.android.supportv4.R;
import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
/**
* Example of receiving a result from another activity.
*/
public class SendResult extends Activity
{
/**
* Initialization of the Activity after it is first created. Must at least
* call {@link android.app.Activity#setContentView setContentView()} to
* describe what is to be displayed in the screen.
*/
@Override
protected void onCreate(Bundle savedInstanceState)
{
// Be sure to call the super class.
super.onCreate(savedInstanceState);
// See assets/res/any/layout/hello_world.xml for this
// view layout definition, which is being set here as
// the content of our screen.
setContentView(R.layout.send_result);
// Watch for button clicks.
Button button = (Button)findViewById(R.id.corky);
button.setOnClickListener(mCorkyListener);
button = (Button)findViewById(R.id.violet);
button.setOnClickListener(mVioletListener);
}
private OnClickListener mCorkyListener = new OnClickListener()
{
public void onClick(View v)
{
// To send a result, simply call setResult() before your
// activity is finished.
setResult(RESULT_OK, (new Intent()).setAction("Corky!"));
finish();
}
};
private OnClickListener mVioletListener = new OnClickListener()
{
public void onClick(View v)
{
// To send a result, simply call setResult() before your
// activity is finished.
setResult(RESULT_OK, (new Intent()).setAction("Violet!"));
finish();
}
};
}

View File

@@ -1,9 +1,7 @@
<p>This section includes samples showing the use of Android's
static support library. This library contains code that you can
build in to your application to access new features and common
utilities while being able to run down to version 1.6 (API 4)
of the platform.</p>
<p>This section includes samples showing the use of the application
package features of the static support library, in particular fragments
and loaders.</p>
<ul>
<li><a href="#Fragment">Fragment</a></li>
<li><a href="#LoaderManager">LoaderManager</a></li>
@@ -12,53 +10,49 @@ of the platform.</p>
<h3 id="Fragment">Fragment</h3>
<dl>
<dt><a href="app/FragmentAlertDialogSupport.html">Fragment Alert Dialog</a></dt>
<dt><a href="FragmentAlertDialogSupport.html">Fragment Alert Dialog</a></dt>
<dd>Demonstrates how to use a DialogFragment to show and manage an
AlertDialog.</dd>
<dt><a href="app/FragmentArgumentsSupport.html">Fragment Arguments</a></dt>
<dt><a href="FragmentArgumentsSupport.html">Fragment Arguments</a></dt>
<dd>Demonstrates how a fragment can be initialized with arguments,
supplying them either as an argument Bundle at runtime or XML attributes
in a &lt;fragment> tag.</dd>
<dt><a href="app/FragmentContextMenuSupport.html">Fragment Context Menu</a></dt>
<dt><a href="FragmentContextMenuSupport.html">Fragment Context Menu</a></dt>
<dd>Demonstrates how to display and respond to a context menu that is
display from a fragment's view hierarchy.</dd>
<dt><a href="app/FragmentDialogSupport.html">Fragment Dialog</a></dt>
<dt><a href="FragmentDialogSupport.html">Fragment Dialog</a></dt>
<dd>Demonstrates use of DialogFragment to show various types of dialogs.</dd>
<dt><a href="app/FragmentDialogOrActivitySupport.html">Fragment Dialog or Activity</a></dt>
<dt><a href="FragmentDialogOrActivitySupport.html">Fragment Dialog or Activity</a></dt>
<dd>Demonstrates how the same Fragment implementation can be used to provide the UI
for either an Activity or Dialog.</dd>
<dt><a href="app/FragmentHideShowSupport.html">Fragment Hide Show</a></dt>
<dt><a href="FragmentHideShowSupport.html">Fragment Hide Show</a></dt>
<dd>Demonstrates hiding and showing fragments.</dd>
<dt><a href="app/FragmentLayoutSupport.html">Fragment Layout</a></dt>
<dt><a href="FragmentLayoutSupport.html">Fragment Layout</a></dt>
<dd>Demonstrates use of the &lt;fragment&gt; tag to embed a Fragment in
an Activity's content view layout, and making the layout change based on
configuration to achieve different UI flows.</dd>
<dt><a href="app/FragmentListArraySupport.html">Fragment List Array</a></dt>
<dt><a href="FragmentListArraySupport.html">Fragment List Array</a></dt>
<dd>Demonstrates use of ListFragment to show the contents of a simple ArrayAdapter.</dd>
<dt><a href="app/FragmentListCursorLoaderSupport.html">Fragment List Cursor Loader</a></dt>
<dd>Demonstrates use of LoaderManager to perform a query for a Cursor that
populates a ListFragment.</dd>
<dt><a href="app/FragmentMenuSupport.html">Fragment Menu</a></dt>
<dt><a href="FragmentMenuSupport.html">Fragment Menu</a></dt>
<dd>Demonstrates populating custom menu items from a Fragment.</dd>
<dt><a href="app/FragmentReceiveResultSupport.html">Fragment Receive Result</a></dt>
<dt><a href="FragmentReceiveResultSupport.html">Fragment Receive Result</a></dt>
<dd>Demonstrates starting a new Activity from a Fragment, and receiving
a result back from it.</dd>
<dt><a href="app/FragmentRetainInstanceSupport.html">Fragment Retain Instance</a></dt>
<dt><a href="FragmentRetainInstanceSupport.html">Fragment Retain Instance</a></dt>
<dd>Demonstrates a Fragment can be used to easily retain active state across
an Activity's configuration change.</dd>
<dt><a href="app/FragmentStackSupport.html">Fragment Stack</a></dt>
<dt><a href="FragmentStackSupport.html">Fragment Stack</a></dt>
<dd>Demonstrates creating a stack of Fragment instances similar to the
traditional stack of activities.</dd>
@@ -66,11 +60,15 @@ of the platform.</p>
<h3 id="LoaderManager">LoaderManager</h3>
<dl>
<dt><a href="app/LoaderThrottleSupport.html">Loader Throttle</a></dt>
<dt><a href="LoaderCursorSupport.html">Loader Cursor</a></dt>
<dd>Demonstrates use of LoaderManager to perform a query for a Cursor that
populates a ListFragment.</dd>
<dt><a href="LoaderThrottleSupport.html">Loader Throttle</a></dt>
<dd>Complete end-to-end demonstration of a simple content provider that
populates data in a list through a cursor loader. The UI allows the list
to be populated with a series of items, showing how AsyncTaskLoader's
throttling facility can be used to control how much a Loader is refreshed
in this case.</dd>
</dl>

View File

@@ -0,0 +1,49 @@
/*
* 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.supportv4.view;
import android.content.Context;
import android.graphics.drawable.ColorDrawable;
import android.util.AttributeSet;
import android.widget.Checkable;
import android.widget.FrameLayout;
public class CheckableFrameLayout extends FrameLayout implements Checkable {
private boolean mChecked;
public CheckableFrameLayout(Context context) {
super(context);
}
public CheckableFrameLayout(Context context, AttributeSet attrs) {
super(context, attrs);
}
public void setChecked(boolean checked) {
mChecked = checked;
setBackgroundDrawable(checked ? new ColorDrawable(0xff0000a0) : null);
}
public boolean isChecked() {
return mChecked;
}
public void toggle() {
setChecked(!mChecked);
}
}