Add new SupportDesignDemos sample app
- I've moved the design stuff from Support7Demos Change-Id: Ibb62a1692550419fea25d297aca5c0c7da0b0dbd
This commit is contained in:
@@ -352,14 +352,5 @@
|
||||
android:label="@string/palette"
|
||||
android:theme="@style/Theme.AppCompat" />
|
||||
|
||||
<activity android:name=".widget.FloatingActionButtonUsage"
|
||||
android:label="@string/design_fab"
|
||||
android:theme="@style/Theme.FAB">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.example.android.supportv7.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
|
||||
@@ -174,8 +174,4 @@
|
||||
<string name="sorted_list_activity">Sorted List</string>
|
||||
<string name="add_new_item">Add New Item</string>
|
||||
|
||||
<string name="design_fab">Design/Floating Action Button</string>
|
||||
<string name="fab_size_normal">Normal size</string>
|
||||
<string name="fab_size_mini">Mini size</string>
|
||||
|
||||
</resources>
|
||||
|
||||
@@ -33,10 +33,4 @@
|
||||
<item name="android:minHeight">35dp</item>
|
||||
</style>
|
||||
|
||||
<style name="Theme.FAB" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">#ff00bcd4</item>
|
||||
<item name="colorPrimaryDark">#00838f</item>
|
||||
<item name="colorAccent">#ff0000</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
37
samples/SupportDesignDemos/Android.mk
Normal file
37
samples/SupportDesignDemos/Android.mk
Normal file
@@ -0,0 +1,37 @@
|
||||
# Copyright (C) 2015 The Android Open Source Project
|
||||
#
|
||||
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||
# you may not use this file except in compliance with the License.
|
||||
# You may obtain a copy of the License at
|
||||
#
|
||||
# http://www.apache.org/licenses/LICENSE-2.0
|
||||
#
|
||||
# Unless required by applicable law or agreed to in writing, software
|
||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
LOCAL_PATH:= $(call my-dir)
|
||||
|
||||
# Build the samples.
|
||||
# We need to add some special AAPT flags to generate R classes
|
||||
# for resources that are included from the libraries.
|
||||
include $(CLEAR_VARS)
|
||||
LOCAL_PACKAGE_NAME := SupportDesignDemos
|
||||
LOCAL_MODULE_TAGS := samples
|
||||
LOCAL_SDK_VERSION := current
|
||||
LOCAL_SRC_FILES := $(call all-java-files-under, src)
|
||||
LOCAL_STATIC_JAVA_LIBRARIES := \
|
||||
android-support-v4 \
|
||||
android-support-v7-appcompat \
|
||||
android-support-design
|
||||
LOCAL_RESOURCE_DIR = \
|
||||
$(LOCAL_PATH)/res \
|
||||
frameworks/support/v7/appcompat/res \
|
||||
frameworks/support/design/res
|
||||
LOCAL_AAPT_FLAGS := \
|
||||
--auto-add-overlay \
|
||||
--extra-packages android.support.v7.appcompat \
|
||||
--extra-packages android.support.design
|
||||
include $(BUILD_PACKAGE)
|
||||
58
samples/SupportDesignDemos/AndroidManifest.xml
Normal file
58
samples/SupportDesignDemos/AndroidManifest.xml
Normal file
@@ -0,0 +1,58 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 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.support.design">
|
||||
|
||||
<uses-sdk android:minSdkVersion="7" android:targetSdkVersion="21" />
|
||||
|
||||
<application android:label="@string/activity_sample_code"
|
||||
android:supportsRtl="true"
|
||||
android:icon="@drawable/app_sample_code">
|
||||
|
||||
<activity android:name="SupportDesignDemos">
|
||||
<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=".widget.FloatingActionButtonUsage"
|
||||
android:label="@string/design_fab"
|
||||
android:theme="@style/Theme.FAB">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.example.android.support.design.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
<activity android:name=".widget.TabLayoutUsage"
|
||||
android:label="@string/design_tabs_basic"
|
||||
android:theme="@style/Theme.Design">
|
||||
<intent-filter>
|
||||
<action android:name="android.intent.action.MAIN" />
|
||||
<category android:name="com.example.android.support.design.SAMPLE_CODE" />
|
||||
</intent-filter>
|
||||
</activity>
|
||||
|
||||
</application>
|
||||
</manifest>
|
||||
BIN
samples/SupportDesignDemos/res/drawable-hdpi/app_sample_code.png
Executable file
BIN
samples/SupportDesignDemos/res/drawable-hdpi/app_sample_code.png
Executable file
Binary file not shown.
|
After Width: | Height: | Size: 3.5 KiB |
BIN
samples/SupportDesignDemos/res/drawable-mdpi/app_sample_code.png
Normal file
BIN
samples/SupportDesignDemos/res/drawable-mdpi/app_sample_code.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
41
samples/SupportDesignDemos/res/layout/design_tabs.xml
Normal file
41
samples/SupportDesignDemos/res/layout/design_tabs.xml
Normal file
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:contentInsetStart="72dp"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:tabContentStart="72dp"/>
|
||||
|
||||
</LinearLayout>
|
||||
110
samples/SupportDesignDemos/res/layout/design_tabs_viewpager.xml
Normal file
110
samples/SupportDesignDemos/res/layout/design_tabs_viewpager.xml
Normal file
@@ -0,0 +1,110 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.Toolbar
|
||||
android:id="@+id/toolbar"
|
||||
android:layout_height="?attr/actionBarSize"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:contentInsetStart="72dp"
|
||||
app:popupTheme="@style/ThemeOverlay.AppCompat.Light"/>
|
||||
|
||||
<android.support.design.widget.TabLayout
|
||||
android:id="@+id/tabs"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent"
|
||||
android:background="?attr/colorPrimary"
|
||||
android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
|
||||
app:tabMode="scrollable"
|
||||
app:tabContentStart="72dp"/>
|
||||
|
||||
<android.support.v4.view.ViewPager
|
||||
android:id="@+id/tabs_viewpager"
|
||||
android:layout_height="0px"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_weight="1"/>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="16dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_add_tab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Add Tab"/>
|
||||
|
||||
<Button
|
||||
android:id="@+id/btn_remove_tab"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Remove Tab"/>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radiogroup_tab_mode"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="8dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_tab_fixed"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Fixed"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_tab_scrollable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Scrollable"/>
|
||||
</RadioGroup>
|
||||
|
||||
<RadioGroup
|
||||
android:id="@+id/radiogroup_tab_gravity"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:padding="8dp">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_tab_g_center"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Center"/>
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/rb_tab_g_fill"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Fill"/>
|
||||
|
||||
</RadioGroup>
|
||||
|
||||
</LinearLayout>
|
||||
25
samples/SupportDesignDemos/res/values/strings.xml
Normal file
25
samples/SupportDesignDemos/res/values/strings.xml
Normal file
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Copyright (C) 2015 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
|
||||
<resources>
|
||||
<string name="activity_sample_code">Support Design Demos</string>
|
||||
|
||||
<string name="design_fab">Floating Action Button/Basic</string>
|
||||
<string name="design_tabs_basic">TabLayout/Usage</string>
|
||||
<string name="fab_size_normal">Normal size</string>
|
||||
<string name="fab_size_mini">Mini size</string>
|
||||
|
||||
</resources>
|
||||
33
samples/SupportDesignDemos/res/values/styles.xml
Normal file
33
samples/SupportDesignDemos/res/values/styles.xml
Normal file
@@ -0,0 +1,33 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2015 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>
|
||||
|
||||
<style name="Theme.Design" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">#607D8B</item>
|
||||
<item name="colorPrimaryDark">#455A64</item>
|
||||
<item name="colorAccent">#FFAB40</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="Theme.FAB" parent="Theme.AppCompat.Light.NoActionBar">
|
||||
<item name="colorPrimary">#ff00bcd4</item>
|
||||
<item name="colorPrimaryDark">#00838f</item>
|
||||
<item name="colorAccent">#ff0000</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
@@ -0,0 +1,154 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.support.design;
|
||||
|
||||
public class Cheeses {
|
||||
|
||||
public static final String[] sCheeseStrings = {
|
||||
"Abbaye de Belloc", "Abbaye du Mont des Cats", "Abertam", "Abondance", "Ackawi",
|
||||
"Acorn", "Adelost", "Affidelice au Chablis", "Afuega'l Pitu", "Airag", "Airedale",
|
||||
"Aisy Cendre", "Allgauer Emmentaler", "Alverca", "Ambert", "American Cheese",
|
||||
"Ami du Chambertin", "Anejo Enchilado", "Anneau du Vic-Bilh", "Anthoriro", "Appenzell",
|
||||
"Aragon", "Ardi Gasna", "Ardrahan", "Armenian String", "Aromes au Gene de Marc",
|
||||
"Asadero", "Asiago", "Aubisque Pyrenees", "Autun", "Avaxtskyr", "Baby Swiss",
|
||||
"Babybel", "Baguette Laonnaise", "Bakers", "Baladi", "Balaton", "Bandal", "Banon",
|
||||
"Barry's Bay Cheddar", "Basing", "Basket Cheese", "Bath Cheese", "Bavarian Bergkase",
|
||||
"Baylough", "Beaufort", "Beauvoorde", "Beenleigh Blue", "Beer Cheese", "Bel Paese",
|
||||
"Bergader", "Bergere Bleue", "Berkswell", "Beyaz Peynir", "Bierkase", "Bishop Kennedy",
|
||||
"Blarney", "Bleu d'Auvergne", "Bleu de Gex", "Bleu de Laqueuille",
|
||||
"Bleu de Septmoncel", "Bleu Des Causses", "Blue", "Blue Castello", "Blue Rathgore",
|
||||
"Blue Vein (Australian)", "Blue Vein Cheeses", "Bocconcini", "Bocconcini (Australian)",
|
||||
"Boeren Leidenkaas", "Bonchester", "Bosworth", "Bougon", "Boule Du Roves",
|
||||
"Boulette d'Avesnes", "Boursault", "Boursin", "Bouyssou", "Bra", "Braudostur",
|
||||
"Breakfast Cheese", "Brebis du Lavort", "Brebis du Lochois", "Brebis du Puyfaucon",
|
||||
"Bresse Bleu", "Brick", "Brie", "Brie de Meaux", "Brie de Melun", "Brillat-Savarin",
|
||||
"Brin", "Brin d' Amour", "Brin d'Amour", "Brinza (Burduf Brinza)",
|
||||
"Briquette de Brebis", "Briquette du Forez", "Broccio", "Broccio Demi-Affine",
|
||||
"Brousse du Rove", "Bruder Basil", "Brusselae Kaas (Fromage de Bruxelles)", "Bryndza",
|
||||
"Buchette d'Anjou", "Buffalo", "Burgos", "Butte", "Butterkase", "Button (Innes)",
|
||||
"Buxton Blue", "Cabecou", "Caboc", "Cabrales", "Cachaille", "Caciocavallo", "Caciotta",
|
||||
"Caerphilly", "Cairnsmore", "Calenzana", "Cambazola", "Camembert de Normandie",
|
||||
"Canadian Cheddar", "Canestrato", "Cantal", "Caprice des Dieux", "Capricorn Goat",
|
||||
"Capriole Banon", "Carre de l'Est", "Casciotta di Urbino", "Cashel Blue", "Castellano",
|
||||
"Castelleno", "Castelmagno", "Castelo Branco", "Castigliano", "Cathelain",
|
||||
"Celtic Promise", "Cendre d'Olivet", "Cerney", "Chabichou", "Chabichou du Poitou",
|
||||
"Chabis de Gatine", "Chaource", "Charolais", "Chaumes", "Cheddar",
|
||||
"Cheddar Clothbound", "Cheshire", "Chevres", "Chevrotin des Aravis", "Chontaleno",
|
||||
"Civray", "Coeur de Camembert au Calvados", "Coeur de Chevre", "Colby", "Cold Pack",
|
||||
"Comte", "Coolea", "Cooleney", "Coquetdale", "Corleggy", "Cornish Pepper",
|
||||
"Cotherstone", "Cotija", "Cottage Cheese", "Cottage Cheese (Australian)",
|
||||
"Cougar Gold", "Coulommiers", "Coverdale", "Crayeux de Roncq", "Cream Cheese",
|
||||
"Cream Havarti", "Crema Agria", "Crema Mexicana", "Creme Fraiche", "Crescenza",
|
||||
"Croghan", "Crottin de Chavignol", "Crottin du Chavignol", "Crowdie", "Crowley",
|
||||
"Cuajada", "Curd", "Cure Nantais", "Curworthy", "Cwmtawe Pecorino",
|
||||
"Cypress Grove Chevre", "Danablu (Danish Blue)", "Danbo", "Danish Fontina",
|
||||
"Daralagjazsky", "Dauphin", "Delice des Fiouves", "Denhany Dorset Drum", "Derby",
|
||||
"Dessertnyj Belyj", "Devon Blue", "Devon Garland", "Dolcelatte", "Doolin",
|
||||
"Doppelrhamstufel", "Dorset Blue Vinney", "Double Gloucester", "Double Worcester",
|
||||
"Dreux a la Feuille", "Dry Jack", "Duddleswell", "Dunbarra", "Dunlop", "Dunsyre Blue",
|
||||
"Duroblando", "Durrus", "Dutch Mimolette (Commissiekaas)", "Edam", "Edelpilz",
|
||||
"Emental Grand Cru", "Emlett", "Emmental", "Epoisses de Bourgogne", "Esbareich",
|
||||
"Esrom", "Etorki", "Evansdale Farmhouse Brie", "Evora De L'Alentejo", "Exmoor Blue",
|
||||
"Explorateur", "Feta", "Feta (Australian)", "Figue", "Filetta", "Fin-de-Siecle",
|
||||
"Finlandia Swiss", "Finn", "Fiore Sardo", "Fleur du Maquis", "Flor de Guia",
|
||||
"Flower Marie", "Folded", "Folded cheese with mint", "Fondant de Brebis",
|
||||
"Fontainebleau", "Fontal", "Fontina Val d'Aosta", "Formaggio di capra", "Fougerus",
|
||||
"Four Herb Gouda", "Fourme d' Ambert", "Fourme de Haute Loire", "Fourme de Montbrison",
|
||||
"Fresh Jack", "Fresh Mozzarella", "Fresh Ricotta", "Fresh Truffles", "Fribourgeois",
|
||||
"Friesekaas", "Friesian", "Friesla", "Frinault", "Fromage a Raclette", "Fromage Corse",
|
||||
"Fromage de Montagne de Savoie", "Fromage Frais", "Fruit Cream Cheese",
|
||||
"Frying Cheese", "Fynbo", "Gabriel", "Galette du Paludier", "Galette Lyonnaise",
|
||||
"Galloway Goat's Milk Gems", "Gammelost", "Gaperon a l'Ail", "Garrotxa", "Gastanberra",
|
||||
"Geitost", "Gippsland Blue", "Gjetost", "Gloucester", "Golden Cross", "Gorgonzola",
|
||||
"Gornyaltajski", "Gospel Green", "Gouda", "Goutu", "Gowrie", "Grabetto", "Graddost",
|
||||
"Grafton Village Cheddar", "Grana", "Grana Padano", "Grand Vatel",
|
||||
"Grataron d' Areches", "Gratte-Paille", "Graviera", "Greuilh", "Greve",
|
||||
"Gris de Lille", "Gruyere", "Gubbeen", "Guerbigny", "Halloumi",
|
||||
"Halloumy (Australian)", "Haloumi-Style Cheese", "Harbourne Blue", "Havarti",
|
||||
"Heidi Gruyere", "Hereford Hop", "Herrgardsost", "Herriot Farmhouse", "Herve",
|
||||
"Hipi Iti", "Hubbardston Blue Cow", "Hushallsost", "Iberico", "Idaho Goatster",
|
||||
"Idiazabal", "Il Boschetto al Tartufo", "Ile d'Yeu", "Isle of Mull", "Jarlsberg",
|
||||
"Jermi Tortes", "Jibneh Arabieh", "Jindi Brie", "Jubilee Blue", "Juustoleipa",
|
||||
"Kadchgall", "Kaseri", "Kashta", "Kefalotyri", "Kenafa", "Kernhem", "Kervella Affine",
|
||||
"Kikorangi", "King Island Cape Wickham Brie", "King River Gold", "Klosterkaese",
|
||||
"Knockalara", "Kugelkase", "L'Aveyronnais", "L'Ecir de l'Aubrac", "La Taupiniere",
|
||||
"La Vache Qui Rit", "Laguiole", "Lairobell", "Lajta", "Lanark Blue", "Lancashire",
|
||||
"Langres", "Lappi", "Laruns", "Lavistown", "Le Brin", "Le Fium Orbo", "Le Lacandou",
|
||||
"Le Roule", "Leafield", "Lebbene", "Leerdammer", "Leicester", "Leyden", "Limburger",
|
||||
"Lincolnshire Poacher", "Lingot Saint Bousquet d'Orb", "Liptauer", "Little Rydings",
|
||||
"Livarot", "Llanboidy", "Llanglofan Farmhouse", "Loch Arthur Farmhouse",
|
||||
"Loddiswell Avondale", "Longhorn", "Lou Palou", "Lou Pevre", "Lyonnais", "Maasdam",
|
||||
"Macconais", "Mahoe Aged Gouda", "Mahon", "Malvern", "Mamirolle", "Manchego",
|
||||
"Manouri", "Manur", "Marble Cheddar", "Marbled Cheeses", "Maredsous", "Margotin",
|
||||
"Maribo", "Maroilles", "Mascares", "Mascarpone", "Mascarpone (Australian)",
|
||||
"Mascarpone Torta", "Matocq", "Maytag Blue", "Meira", "Menallack Farmhouse",
|
||||
"Menonita", "Meredith Blue", "Mesost", "Metton (Cancoillotte)", "Meyer Vintage Gouda",
|
||||
"Mihalic Peynir", "Milleens", "Mimolette", "Mine-Gabhar", "Mini Baby Bells", "Mixte",
|
||||
"Molbo", "Monastery Cheeses", "Mondseer", "Mont D'or Lyonnais", "Montasio",
|
||||
"Monterey Jack", "Monterey Jack Dry", "Morbier", "Morbier Cru de Montagne",
|
||||
"Mothais a la Feuille", "Mozzarella", "Mozzarella (Australian)",
|
||||
"Mozzarella di Bufala", "Mozzarella Fresh, in water", "Mozzarella Rolls", "Munster",
|
||||
"Murol", "Mycella", "Myzithra", "Naboulsi", "Nantais", "Neufchatel",
|
||||
"Neufchatel (Australian)", "Niolo", "Nokkelost", "Northumberland", "Oaxaca",
|
||||
"Olde York", "Olivet au Foin", "Olivet Bleu", "Olivet Cendre",
|
||||
"Orkney Extra Mature Cheddar", "Orla", "Oschtjepka", "Ossau Fermier", "Ossau-Iraty",
|
||||
"Oszczypek", "Oxford Blue", "P'tit Berrichon", "Palet de Babligny", "Paneer", "Panela",
|
||||
"Pannerone", "Pant ys Gawn", "Parmesan (Parmigiano)", "Parmigiano Reggiano",
|
||||
"Pas de l'Escalette", "Passendale", "Pasteurized Processed", "Pate de Fromage",
|
||||
"Patefine Fort", "Pave d'Affinois", "Pave d'Auge", "Pave de Chirac", "Pave du Berry",
|
||||
"Pecorino", "Pecorino in Walnut Leaves", "Pecorino Romano", "Peekskill Pyramid",
|
||||
"Pelardon des Cevennes", "Pelardon des Corbieres", "Penamellera", "Penbryn",
|
||||
"Pencarreg", "Perail de Brebis", "Petit Morin", "Petit Pardou", "Petit-Suisse",
|
||||
"Picodon de Chevre", "Picos de Europa", "Piora", "Pithtviers au Foin",
|
||||
"Plateau de Herve", "Plymouth Cheese", "Podhalanski", "Poivre d'Ane", "Polkolbin",
|
||||
"Pont l'Eveque", "Port Nicholson", "Port-Salut", "Postel", "Pouligny-Saint-Pierre",
|
||||
"Pourly", "Prastost", "Pressato", "Prince-Jean", "Processed Cheddar", "Provolone",
|
||||
"Provolone (Australian)", "Pyengana Cheddar", "Pyramide", "Quark",
|
||||
"Quark (Australian)", "Quartirolo Lombardo", "Quatre-Vents", "Quercy Petit",
|
||||
"Queso Blanco", "Queso Blanco con Frutas --Pina y Mango", "Queso de Murcia",
|
||||
"Queso del Montsec", "Queso del Tietar", "Queso Fresco", "Queso Fresco (Adobera)",
|
||||
"Queso Iberico", "Queso Jalapeno", "Queso Majorero", "Queso Media Luna",
|
||||
"Queso Para Frier", "Queso Quesadilla", "Rabacal", "Raclette", "Ragusano", "Raschera",
|
||||
"Reblochon", "Red Leicester", "Regal de la Dombes", "Reggianito", "Remedou",
|
||||
"Requeson", "Richelieu", "Ricotta", "Ricotta (Australian)", "Ricotta Salata", "Ridder",
|
||||
"Rigotte", "Rocamadour", "Rollot", "Romano", "Romans Part Dieu", "Roncal", "Roquefort",
|
||||
"Roule", "Rouleau De Beaulieu", "Royalp Tilsit", "Rubens", "Rustinu", "Saaland Pfarr",
|
||||
"Saanenkaese", "Saga", "Sage Derby", "Sainte Maure", "Saint-Marcellin",
|
||||
"Saint-Nectaire", "Saint-Paulin", "Salers", "Samso", "San Simon", "Sancerre",
|
||||
"Sap Sago", "Sardo", "Sardo Egyptian", "Sbrinz", "Scamorza", "Schabzieger", "Schloss",
|
||||
"Selles sur Cher", "Selva", "Serat", "Seriously Strong Cheddar", "Serra da Estrela",
|
||||
"Sharpam", "Shelburne Cheddar", "Shropshire Blue", "Siraz", "Sirene", "Smoked Gouda",
|
||||
"Somerset Brie", "Sonoma Jack", "Sottocenare al Tartufo", "Soumaintrain",
|
||||
"Sourire Lozerien", "Spenwood", "Sraffordshire Organic", "St. Agur Blue Cheese",
|
||||
"Stilton", "Stinking Bishop", "String", "Sussex Slipcote", "Sveciaost", "Swaledale",
|
||||
"Sweet Style Swiss", "Swiss", "Syrian (Armenian String)", "Tala", "Taleggio", "Tamie",
|
||||
"Tasmania Highland Chevre Log", "Taupiniere", "Teifi", "Telemea", "Testouri",
|
||||
"Tete de Moine", "Tetilla", "Texas Goat Cheese", "Tibet", "Tillamook Cheddar",
|
||||
"Tilsit", "Timboon Brie", "Toma", "Tomme Brulee", "Tomme d'Abondance",
|
||||
"Tomme de Chevre", "Tomme de Romans", "Tomme de Savoie", "Tomme des Chouans", "Tommes",
|
||||
"Torta del Casar", "Toscanello", "Touree de L'Aubier", "Tourmalet",
|
||||
"Trappe (Veritable)", "Trois Cornes De Vendee", "Tronchon", "Trou du Cru", "Truffe",
|
||||
"Tupi", "Turunmaa", "Tymsboro", "Tyn Grug", "Tyning", "Ubriaco", "Ulloa",
|
||||
"Vacherin-Fribourgeois", "Valencay", "Vasterbottenost", "Venaco", "Vendomois",
|
||||
"Vieux Corse", "Vignotte", "Vulscombe", "Waimata Farmhouse Blue",
|
||||
"Washed Rind Cheese (Australian)", "Waterloo", "Weichkaese", "Wellington",
|
||||
"Wensleydale", "White Stilton", "Whitestone Farmhouse", "Wigmore", "Woodside Cabecou",
|
||||
"Xanadu", "Xynotyro", "Yarg Cornish", "Yarra Valley Pyramid", "Yorkshire Blue",
|
||||
"Zamorano", "Zanetti Grana Padano", "Zanetti Parmigiano Reggiano"
|
||||
};
|
||||
|
||||
}
|
||||
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.support.design;
|
||||
|
||||
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!"
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,151 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.support.design;
|
||||
|
||||
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 SupportDesignDemos 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.support.design.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();
|
||||
|
||||
@Override
|
||||
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, SupportDesignDemos.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);
|
||||
}
|
||||
}
|
||||
@@ -14,9 +14,9 @@
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.example.android.supportv7.widget;
|
||||
package com.example.android.support.design.widget;
|
||||
|
||||
import com.example.android.supportv7.R;
|
||||
import com.example.android.support.design.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
@@ -0,0 +1,215 @@
|
||||
/*
|
||||
* Copyright (C) 2015 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.support.design.widget;
|
||||
|
||||
import com.example.android.support.design.Cheeses;
|
||||
import com.example.android.support.design.R;
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.design.widget.TabLayout;
|
||||
import android.support.v4.view.PagerAdapter;
|
||||
import android.support.v4.view.ViewPager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.support.v7.widget.Toolbar;
|
||||
import android.view.Gravity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.RadioGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* This demonstrates idiomatic usage of TabLayout with a ViewPager
|
||||
*/
|
||||
public class TabLayoutUsage extends AppCompatActivity {
|
||||
|
||||
private TabLayout mTabLayout;
|
||||
private ViewPager mViewPager;
|
||||
private CheesePagerAdapter mPagerAdapter;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
setContentView(R.layout.design_tabs_viewpager);
|
||||
|
||||
// Retrieve the Toolbar from our content view, and set it as the action bar
|
||||
Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
|
||||
setSupportActionBar(toolbar);
|
||||
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
|
||||
|
||||
mTabLayout = (TabLayout) findViewById(R.id.tabs);
|
||||
|
||||
mViewPager = (ViewPager) findViewById(R.id.tabs_viewpager);
|
||||
mPagerAdapter = new CheesePagerAdapter();
|
||||
mViewPager.setAdapter(mPagerAdapter);
|
||||
mViewPager.setOnPageChangeListener(mTabLayout.createOnPageChangeListener());
|
||||
mTabLayout.setOnTabSelectedListener(mTabListener);
|
||||
|
||||
setupButtons();
|
||||
setupRadioGroup();
|
||||
}
|
||||
|
||||
private void setupButtons() {
|
||||
findViewById(R.id.btn_add_tab).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
addRandomTab();
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.btn_remove_tab).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
if (mTabLayout.getTabCount() >= 1) {
|
||||
mTabLayout.removeTabAt(mTabLayout.getTabCount() - 1);
|
||||
mPagerAdapter.removeTab();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private void addRandomTab() {
|
||||
Random r = new Random();
|
||||
String cheese = Cheeses.sCheeseStrings[r.nextInt(Cheeses.sCheeseStrings.length)];
|
||||
mTabLayout.addTab(mTabLayout.newTab().setText(cheese));
|
||||
mPagerAdapter.addTab(cheese);
|
||||
}
|
||||
|
||||
private void setupRadioGroup() {
|
||||
// Setup the initially checked item
|
||||
switch (mTabLayout.getTabMode()) {
|
||||
case TabLayout.MODE_SCROLLABLE:
|
||||
((RadioButton) findViewById(R.id.rb_tab_scrollable)).setChecked(true);
|
||||
break;
|
||||
case TabLayout.MODE_FIXED:
|
||||
((RadioButton) findViewById(R.id.rb_tab_fixed)).setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
RadioGroup rg = (RadioGroup) findViewById(R.id.radiogroup_tab_mode);
|
||||
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup radioGroup, int id) {
|
||||
switch (id) {
|
||||
case R.id.rb_tab_fixed:
|
||||
mTabLayout.setTabMode(TabLayout.MODE_FIXED);
|
||||
break;
|
||||
case R.id.rb_tab_scrollable:
|
||||
mTabLayout.setTabMode(TabLayout.MODE_SCROLLABLE);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
// Setup the initially checked item
|
||||
switch (mTabLayout.getTabGravity()) {
|
||||
case TabLayout.GRAVITY_CENTER:
|
||||
((RadioButton) findViewById(R.id.rb_tab_g_center)).setChecked(true);
|
||||
break;
|
||||
case TabLayout.GRAVITY_FILL:
|
||||
((RadioButton) findViewById(R.id.rb_tab_g_fill)).setChecked(true);
|
||||
break;
|
||||
}
|
||||
|
||||
rg = (RadioGroup) findViewById(R.id.radiogroup_tab_gravity);
|
||||
rg.setOnCheckedChangeListener(new RadioGroup.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(RadioGroup radioGroup, int id) {
|
||||
switch (id) {
|
||||
case R.id.rb_tab_g_center:
|
||||
mTabLayout.setTabGravity(TabLayout.GRAVITY_CENTER);
|
||||
break;
|
||||
case R.id.rb_tab_g_fill:
|
||||
mTabLayout.setTabGravity(TabLayout.GRAVITY_FILL);
|
||||
break;
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private final TabLayout.OnTabSelectedListener
|
||||
mTabListener = new TabLayout.OnTabSelectedListener() {
|
||||
@Override
|
||||
public void onTabSelected(TabLayout.Tab tab) {
|
||||
mViewPager.setCurrentItem(tab.getPosition());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabUnselected(TabLayout.Tab tab) {
|
||||
// no-op
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTabReselected(TabLayout.Tab tab) {
|
||||
// no-op
|
||||
}
|
||||
};
|
||||
|
||||
private static class CheesePagerAdapter extends PagerAdapter {
|
||||
|
||||
private final ArrayList<CharSequence> mCheeses = new ArrayList<>();
|
||||
|
||||
public void addTab(String title) {
|
||||
mCheeses.add(title);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
|
||||
public void removeTab() {
|
||||
if (!mCheeses.isEmpty()) {
|
||||
mCheeses.remove(mCheeses.size() - 1);
|
||||
notifyDataSetChanged();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mCheeses.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object instantiateItem(ViewGroup container, int position) {
|
||||
TextView tv = new TextView(container.getContext());
|
||||
tv.setText(getPageTitle(position));
|
||||
tv.setGravity(Gravity.CENTER);
|
||||
tv.setTextAppearance(tv.getContext(), R.style.TextAppearance_AppCompat_Title);
|
||||
|
||||
container.addView(tv, ViewGroup.LayoutParams.MATCH_PARENT,
|
||||
ViewGroup.LayoutParams.MATCH_PARENT);
|
||||
|
||||
return tv;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isViewFromObject(View view, Object object) {
|
||||
return view == object;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CharSequence getPageTitle(int position) {
|
||||
return mCheeses.get(position);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroyItem(ViewGroup container, int position, Object object) {
|
||||
container.removeView((View) object);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user