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.
+
+
+
diff --git a/samples/Support4Demos/res/drawable-hdpi/alert_dialog_icon.png b/samples/Support4Demos/res/drawable-hdpi/alert_dialog_icon.png
new file mode 100755
index 000000000..fe54477c9
Binary files /dev/null and b/samples/Support4Demos/res/drawable-hdpi/alert_dialog_icon.png differ
diff --git a/samples/Support4Demos/res/drawable-hdpi/app_sample_code.png b/samples/Support4Demos/res/drawable-hdpi/app_sample_code.png
new file mode 100755
index 000000000..66a198496
Binary files /dev/null and b/samples/Support4Demos/res/drawable-hdpi/app_sample_code.png differ
diff --git a/samples/Support4Demos/res/drawable-mdpi/alert_dialog_icon.png b/samples/Support4Demos/res/drawable-mdpi/alert_dialog_icon.png
new file mode 100644
index 000000000..0a7de0476
Binary files /dev/null and b/samples/Support4Demos/res/drawable-mdpi/alert_dialog_icon.png differ
diff --git a/samples/Support4Demos/res/drawable-mdpi/app_sample_code.png b/samples/Support4Demos/res/drawable-mdpi/app_sample_code.png
new file mode 100644
index 000000000..5ae7701a8
Binary files /dev/null and b/samples/Support4Demos/res/drawable-mdpi/app_sample_code.png differ
diff --git a/samples/ApiDemos/res/layout-land/fragment_arguments_support.xml b/samples/Support4Demos/res/layout-land/fragment_arguments_support.xml
similarity index 92%
rename from samples/ApiDemos/res/layout-land/fragment_arguments_support.xml
rename to samples/Support4Demos/res/layout-land/fragment_arguments_support.xml
index 9aa8dafbd..b0b89fbcb 100644
--- a/samples/ApiDemos/res/layout-land/fragment_arguments_support.xml
+++ b/samples/Support4Demos/res/layout-land/fragment_arguments_support.xml
@@ -35,7 +35,7 @@
-
-
diff --git a/samples/ApiDemos/res/layout-land/fragment_layout_support.xml b/samples/Support4Demos/res/layout-land/fragment_layout_support.xml
similarity index 93%
rename from samples/ApiDemos/res/layout-land/fragment_layout_support.xml
rename to samples/Support4Demos/res/layout-land/fragment_layout_support.xml
index de31341ec..85de600f8 100644
--- a/samples/ApiDemos/res/layout-land/fragment_layout_support.xml
+++ b/samples/Support4Demos/res/layout-land/fragment_layout_support.xml
@@ -22,7 +22,7 @@
android:orientation="horizontal"
android:layout_width="match_parent" android:layout_height="match_parent">
-
diff --git a/samples/ApiDemos/res/layout/fragment_arguments_support.xml b/samples/Support4Demos/res/layout/fragment_arguments_support.xml
similarity index 95%
rename from samples/ApiDemos/res/layout/fragment_arguments_support.xml
rename to samples/Support4Demos/res/layout/fragment_arguments_support.xml
index b218f82cb..466583e3e 100644
--- a/samples/ApiDemos/res/layout/fragment_arguments_support.xml
+++ b/samples/Support4Demos/res/layout/fragment_arguments_support.xml
@@ -36,7 +36,7 @@
android:layout_width="match_parent" android:layout_height="wrap_content">
-
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/fragment_dialog.xml b/samples/Support4Demos/res/layout/fragment_dialog.xml
new file mode 100644
index 000000000..f9dec5990
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_dialog.xml
@@ -0,0 +1,40 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/fragment_dialog_or_activity.xml b/samples/Support4Demos/res/layout/fragment_dialog_or_activity.xml
new file mode 100644
index 000000000..295f01787
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_dialog_or_activity.xml
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/ApiDemos/res/layout/fragment_hide_show_support.xml b/samples/Support4Demos/res/layout/fragment_hide_show_support.xml
similarity index 91%
rename from samples/ApiDemos/res/layout/fragment_hide_show_support.xml
rename to samples/Support4Demos/res/layout/fragment_hide_show_support.xml
index e4245bd26..604cf42d8 100644
--- a/samples/ApiDemos/res/layout/fragment_hide_show_support.xml
+++ b/samples/Support4Demos/res/layout/fragment_hide_show_support.xml
@@ -34,7 +34,7 @@
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Hide" />
-
@@ -48,7 +48,7 @@
android:layout_width="wrap_content" android:layout_height="wrap_content"
android:text="Hide" />
-
diff --git a/samples/ApiDemos/res/layout/fragment_layout_support.xml b/samples/Support4Demos/res/layout/fragment_layout_support.xml
similarity index 92%
rename from samples/ApiDemos/res/layout/fragment_layout_support.xml
rename to samples/Support4Demos/res/layout/fragment_layout_support.xml
index 08c40bf57..5910b784d 100644
--- a/samples/ApiDemos/res/layout/fragment_layout_support.xml
+++ b/samples/Support4Demos/res/layout/fragment_layout_support.xml
@@ -20,7 +20,7 @@
-
diff --git a/samples/Support4Demos/res/layout/fragment_menu.xml b/samples/Support4Demos/res/layout/fragment_menu.xml
new file mode 100644
index 000000000..7f0278cf2
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_menu.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/fragment_pager.xml b/samples/Support4Demos/res/layout/fragment_pager.xml
new file mode 100644
index 000000000..3867f46f4
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_pager.xml
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/fragment_pager_list.xml b/samples/Support4Demos/res/layout/fragment_pager_list.xml
new file mode 100644
index 000000000..bbe7b1d64
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_pager_list.xml
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/fragment_retain_instance.xml b/samples/Support4Demos/res/layout/fragment_retain_instance.xml
new file mode 100644
index 000000000..0dc39853f
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_retain_instance.xml
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/fragment_stack.xml b/samples/Support4Demos/res/layout/fragment_stack.xml
new file mode 100644
index 000000000..1d12496ac
--- /dev/null
+++ b/samples/Support4Demos/res/layout/fragment_stack.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/hello_world.xml b/samples/Support4Demos/res/layout/hello_world.xml
new file mode 100644
index 000000000..3d90a3351
--- /dev/null
+++ b/samples/Support4Demos/res/layout/hello_world.xml
@@ -0,0 +1,26 @@
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/labeled_text_edit.xml b/samples/Support4Demos/res/layout/labeled_text_edit.xml
new file mode 100644
index 000000000..27568afbb
--- /dev/null
+++ b/samples/Support4Demos/res/layout/labeled_text_edit.xml
@@ -0,0 +1,38 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/receive_result.xml b/samples/Support4Demos/res/layout/receive_result.xml
new file mode 100644
index 000000000..5deb2ac4a
--- /dev/null
+++ b/samples/Support4Demos/res/layout/receive_result.xml
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/send_result.xml b/samples/Support4Demos/res/layout/send_result.xml
new file mode 100644
index 000000000..bdd927c60
--- /dev/null
+++ b/samples/Support4Demos/res/layout/send_result.xml
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/layout/simple_list_item_checkable_1.xml b/samples/Support4Demos/res/layout/simple_list_item_checkable_1.xml
new file mode 100644
index 000000000..84017a67c
--- /dev/null
+++ b/samples/Support4Demos/res/layout/simple_list_item_checkable_1.xml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/menu/shortcuts.xml b/samples/Support4Demos/res/menu/shortcuts.xml
new file mode 100644
index 000000000..b5e938a5a
--- /dev/null
+++ b/samples/Support4Demos/res/menu/shortcuts.xml
@@ -0,0 +1,60 @@
+
+
+
+
diff --git a/samples/Support4Demos/res/values-v11/styles.xml b/samples/Support4Demos/res/values-v11/styles.xml
new file mode 100644
index 000000000..04c6f3f72
--- /dev/null
+++ b/samples/Support4Demos/res/values-v11/styles.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/values/attrs.xml b/samples/Support4Demos/res/values/attrs.xml
new file mode 100644
index 000000000..ce7c910e5
--- /dev/null
+++ b/samples/Support4Demos/res/values/attrs.xml
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/res/values/colors.xml b/samples/Support4Demos/res/values/colors.xml
new file mode 100644
index 000000000..a52502efa
--- /dev/null
+++ b/samples/Support4Demos/res/values/colors.xml
@@ -0,0 +1,22 @@
+
+
+
+
+ #7f00
+ #770000ff
+ #7700ff00
+ #77ffff00
+
diff --git a/samples/Support4Demos/res/values/strings.xml b/samples/Support4Demos/res/values/strings.xml
new file mode 100644
index 000000000..25fe88088
--- /dev/null
+++ b/samples/Support4Demos/res/values/strings.xml
@@ -0,0 +1,86 @@
+
+
+
+
+ Support v4 Demos
+
+ Hello, World!
+
+ Lorem ipsum dolor sit aie consectetur adipiscing\nPlloaso mako nuto
+ siwuf cakso dodtos anr koop.
+
+ OK
+ Cancel
+
+ Initial text.
+
+ Pick a result to send, or BACK to cancel.
+ Corky
+ Violet
+ Press the button to get an activity result, which will be displayed here:
+ Get Result
+
+ Fragment/Alert Dialog
+
+ Fragment/Arguments
+ Demonstrates a fragment that takes arguments
+ as a Bundle at runtime (on the right) or from attributes in a layout (on the left).
+ From Attributes
+ Landscape Only
+
+ Fragment/Hide and Show
+
+ Fragment/Context Menu
+ Fragment populating a context
+ menu; long press the button to see.
+ Long press me
+
+ Fragment/Dialog
+ Show
+
+ Fragment/Dialog or Activity
+ Demonstrates the same fragment
+ being shown as a dialog and embedded inside of an activity.
+ Fragment embedded inside
+ of the activity:
+
+ Fragment/Layout
+
+ Fragment/List Array
+
+ Fragment/Menu
+ Build menus from two fragments, allowing
+ you to hide them to remove them..
+ Show fragment 1 menu
+ Show fragment 2 menu
+
+ Fragment/Retain Instance
+ Current progress of retained fragment;
+ restarts if fragment is re-created.
+ Restart
+
+ Fragment/Receive Result
+
+ Fragment/Stack
+ New fragment
+
+ Fragment/Pager
+
+ Loader/Cursor
+
+ Loader/Throttle
+
+
diff --git a/samples/Support4Demos/res/values/styles.xml b/samples/Support4Demos/res/values/styles.xml
new file mode 100644
index 000000000..97cdb6f89
--- /dev/null
+++ b/samples/Support4Demos/res/values/styles.xml
@@ -0,0 +1,32 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java b/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java
new file mode 100644
index 000000000..17608d43f
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/Shakespeare.java
@@ -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!"
+ };
+}
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/Support4Demos.java b/samples/Support4Demos/src/com/example/android/supportv4/Support4Demos.java
new file mode 100644
index 000000000..af445db0d
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/Support4Demos.java
@@ -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
+
+
+
+
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentAlertDialogSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentAlertDialogSupport.java
similarity index 97%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentAlertDialogSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentAlertDialogSupport.java
index d7f6ae93f..f35e0215f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentAlertDialogSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentAlertDialogSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentArgumentsSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentArgumentsSupport.java
similarity index 97%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentArgumentsSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentArgumentsSupport.java
index 1ff71859b..8def8af3c 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentArgumentsSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentArgumentsSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentContextMenuSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentContextMenuSupport.java
similarity index 97%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentContextMenuSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentContextMenuSupport.java
index a934145ac..e52e732b3 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentContextMenuSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentContextMenuSupport.java
@@ -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.
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentDialogOrActivitySupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentDialogOrActivitySupport.java
similarity index 97%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentDialogOrActivitySupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentDialogOrActivitySupport.java
index fe677aaff..06b27303f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentDialogOrActivitySupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentDialogOrActivitySupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentDialogSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentDialogSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentDialogSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentDialogSupport.java
index 666151df6..b387bfc79 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentDialogSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentDialogSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentHideShowSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentHideShowSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentHideShowSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentHideShowSupport.java
index d34716016..e0fcbdb82 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentHideShowSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentHideShowSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentLayoutSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentLayoutSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentLayoutSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentLayoutSupport.java
index e1c63ae03..972f55c8c 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentLayoutSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentLayoutSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentListArraySupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentListArraySupport.java
similarity index 95%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentListArraySupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentListArraySupport.java
index 2bcc018ee..7efae2ca9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentListArraySupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentListArraySupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentMenuSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentMenuSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentMenuSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentMenuSupport.java
index 5ac309a1b..37a132d9d 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentMenuSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentMenuSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
similarity index 96%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
index 46d29ace5..a3d89bbae 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentPagerSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentPagerSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentReceiveResultSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java
similarity index 97%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentReceiveResultSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java
index f430e69fe..d360cf9d9 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentReceiveResultSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentReceiveResultSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentRetainInstanceSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentRetainInstanceSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentRetainInstanceSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentRetainInstanceSupport.java
index dbf0cfb88..0ff34ddb2 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentRetainInstanceSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentRetainInstanceSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentStackSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentStackSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/FragmentStackSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/FragmentStackSupport.java
index 404721b3f..c4d05fa9f 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/FragmentStackSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentStackSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/LoaderCursorSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCursorSupport.java
similarity index 98%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/LoaderCursorSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCursorSupport.java
index 491ae0edb..07b9309a1 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/LoaderCursorSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderCursorSupport.java
@@ -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;
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/app/LoaderThrottleSupport.java b/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderThrottleSupport.java
similarity index 99%
rename from samples/ApiDemos/src/com/example/android/apis/support/app/LoaderThrottleSupport.java
rename to samples/Support4Demos/src/com/example/android/supportv4/app/LoaderThrottleSupport.java
index e8f4af57b..669300805 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/app/LoaderThrottleSupport.java
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/LoaderThrottleSupport.java
@@ -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;
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/app/SendResult.java b/samples/Support4Demos/src/com/example/android/supportv4/app/SendResult.java
new file mode 100644
index 000000000..71795050c
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/SendResult.java
@@ -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();
+ }
+ };
+}
+
diff --git a/samples/ApiDemos/src/com/example/android/apis/support/_index.html b/samples/Support4Demos/src/com/example/android/supportv4/app/_index.html
similarity index 59%
rename from samples/ApiDemos/src/com/example/android/apis/support/_index.html
rename to samples/Support4Demos/src/com/example/android/supportv4/app/_index.html
index 806a57196..c9e0aea43 100644
--- a/samples/ApiDemos/src/com/example/android/apis/support/_index.html
+++ b/samples/Support4Demos/src/com/example/android/supportv4/app/_index.html
@@ -1,9 +1,7 @@
-
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.
+
This section includes samples showing the use of the application
+package features of the static support library, in particular fragments
+and loaders.
Demonstrates how a fragment can be initialized with arguments,
supplying them either as an argument Bundle at runtime or XML attributes
in a <fragment> tag.
Demonstrates use of the <fragment> 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.
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.
-
\ No newline at end of file
+
\ No newline at end of file
diff --git a/samples/Support4Demos/src/com/example/android/supportv4/view/CheckableFrameLayout.java b/samples/Support4Demos/src/com/example/android/supportv4/view/CheckableFrameLayout.java
new file mode 100644
index 000000000..c559cf607
--- /dev/null
+++ b/samples/Support4Demos/src/com/example/android/supportv4/view/CheckableFrameLayout.java
@@ -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);
+ }
+
+}