ABC ListView + PopupMenu sample
Change-Id: I7595c495eb6ff33f5bbc439f229f750c0b219f59
Signed-off-by: Chris Banes <chrisbanes@google.com>
(cherry picked from commit b06a0172d1d3b106ea1ac9f3cba4f866e42fe181)
(cherry picked from commit 966a40b8681279da5337937054306bd8b12f888a)
diff --git a/ui/actionbarcompat/ListPopupMenu/big_icon.png b/ui/actionbarcompat/ListPopupMenu/big_icon.png
new file mode 100644
index 0000000..6968ae8
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/big_icon.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/build.gradle b/ui/actionbarcompat/ListPopupMenu/build.gradle
new file mode 100644
index 0000000..b99b102
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/build.gradle
@@ -0,0 +1,16 @@
+apply plugin: 'android'
+
+dependencies {
+ compile "com.android.support:support-v4:18.0.+"
+ compile "com.android.support:appcompat-v7:18.0.+"
+}
+
+android {
+ compileSdkVersion 17
+ buildToolsVersion "17.0.0"
+
+ defaultConfig {
+ minSdkVersion 7
+ targetSdkVersion 16
+ }
+}
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/AndroidManifest.xml b/ui/actionbarcompat/ListPopupMenu/src/main/AndroidManifest.xml
new file mode 100644
index 0000000..7e9a861
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/AndroidManifest.xml
@@ -0,0 +1,41 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<manifest xmlns:android="http://schemas.android.com/apk/res/android"
+ package="com.example.android.actionbarcompat.listpopupmenu"
+ android:versionCode="1"
+ android:versionName="1.0">
+
+ <!-- ActionBarCompat provides an implementation of Popup Menu from API v7 onwards -->
+ <uses-sdk
+ android:minSdkVersion="7"
+ android:targetSdkVersion="17" />
+
+ <application
+ android:icon="@drawable/ic_launcher"
+ android:label="@string/app_name"
+ android:theme="@style/Theme.AppCompat"
+ android:allowBackup="true">
+
+ <activity android:name=".MainActivity">
+ <!-- Launcher Intent filter -->
+ <intent-filter>
+ <action android:name="android.intent.action.MAIN" />
+ <category android:name="android.intent.category.LAUNCHER" />
+ </intent-filter>
+ </activity>
+ </application>
+
+</manifest>
\ No newline at end of file
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-hdpi/ic_launcher.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-hdpi/ic_launcher.png
new file mode 100644
index 0000000..a7365b9
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-hdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-hdpi/ic_overflow.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-hdpi/ic_overflow.png
new file mode 100644
index 0000000..2abc458
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-hdpi/ic_overflow.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-mdpi/ic_launcher.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-mdpi/ic_launcher.png
new file mode 100644
index 0000000..3fd5593
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-mdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-mdpi/ic_overflow.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-mdpi/ic_overflow.png
new file mode 100644
index 0000000..ba704b6
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-mdpi/ic_overflow.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xhdpi/ic_launcher.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xhdpi/ic_launcher.png
new file mode 100644
index 0000000..204f861
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xhdpi/ic_overflow.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xhdpi/ic_overflow.png
new file mode 100644
index 0000000..a92fb1d
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xhdpi/ic_overflow.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xxhdpi/ic_launcher.png b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xxhdpi/ic_launcher.png
new file mode 100644
index 0000000..ada8266
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/drawable-xxhdpi/ic_launcher.png
Binary files differ
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/layout/activity_main.xml b/ui/actionbarcompat/ListPopupMenu/src/main/res/layout/activity_main.xml
new file mode 100644
index 0000000..bfc7ad0
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/layout/activity_main.xml
@@ -0,0 +1,20 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2013 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.
+-->
+<fragment xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="match_parent"
+ android:name="com.example.android.actionbarcompat.listpopupmenu.PopupListFragment" />
\ No newline at end of file
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/layout/list_item.xml b/ui/actionbarcompat/ListPopupMenu/src/main/res/layout/list_item.xml
new file mode 100644
index 0000000..3eabda0
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/layout/list_item.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
+ android:orientation="horizontal"
+ android:layout_width="match_parent"
+ android:layout_height="?attr/listPreferredItemHeight">
+
+ <TextView
+ android:id="@android:id/text1"
+ android:layout_height="match_parent"
+ android:layout_width="0dp"
+ android:layout_weight="1"
+ android:gravity="center_vertical"
+ android:paddingLeft="8dp"
+ android:paddingRight="8dp"
+ android:maxLines="1"
+ android:ellipsize="end"
+ android:textAppearance="?android:attr/textAppearanceMedium" />
+
+ <ImageView
+ android:id="@+id/button_popup"
+ android:layout_height="match_parent"
+ android:layout_width="56dip"
+ android:background="?attr/selectableItemBackground"
+ android:src="@drawable/ic_overflow"
+ android:contentDescription="@string/content_open_popup"/>
+
+</LinearLayout>
\ No newline at end of file
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/menu/popup.xml b/ui/actionbarcompat/ListPopupMenu/src/main/res/menu/popup.xml
new file mode 100644
index 0000000..0329e9e
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/menu/popup.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2013 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+<menu xmlns:android="http://schemas.android.com/apk/res/android">
+
+ <item
+ android:id="@+id/menu_remove"
+ android:title="@string/menu_remove" />
+
+</menu>
\ No newline at end of file
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/res/values/strings.xml b/ui/actionbarcompat/ListPopupMenu/src/main/res/values/strings.xml
new file mode 100644
index 0000000..36233c9
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/res/values/strings.xml
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!--
+ Copyright 2013 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="app_name">ABC List Popup Menu</string>
+ <string name="menu_remove">Remove</string>
+ <string name="content_open_popup">Open Popup Menu</string>
+
+</resources>
\ No newline at end of file
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/Cheeses.java b/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/Cheeses.java
new file mode 100644
index 0000000..5ef1161
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/Cheeses.java
@@ -0,0 +1,155 @@
+/*
+ * Copyright 2013 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.actionbarcompat.listpopupmenu;
+
+/**
+ * Dummy data.
+ */
+public class Cheeses {
+ public static final String[] CHEESES = {
+ "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"
+ };
+}
\ No newline at end of file
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/MainActivity.java b/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/MainActivity.java
new file mode 100644
index 0000000..7fd05cc
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/MainActivity.java
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2013 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.actionbarcompat.listpopupmenu;
+
+import android.os.Bundle;
+import android.support.v4.view.MenuItemCompat;
+import android.support.v7.app.ActionBarActivity;
+import android.view.Menu;
+import android.view.MenuItem;
+
+/**
+ * This sample shows you how to use {@link android.support.v7.widget.PopupMenu PopupMenu} from
+ * ActionBarCompat to create a list, with each item having a dropdown menu.
+ * <p>
+ * The interesting part of this sample is in {@link PopupListFragment}.
+ *
+ * This Activity extends from {@link ActionBarActivity}, which provides all of the function
+ * necessary to display a compatible Action Bar on devices running Android v2.1+.
+ */
+public class MainActivity extends ActionBarActivity {
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+
+ // Set content view (which contains a PopupListFragment)
+ setContentView(R.layout.activity_main);
+ }
+
+}
diff --git a/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/PopupListFragment.java b/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/PopupListFragment.java
new file mode 100644
index 0000000..754bf22
--- /dev/null
+++ b/ui/actionbarcompat/ListPopupMenu/src/main/src/com/example/android/actionbarcompat/listpopupmenu/PopupListFragment.java
@@ -0,0 +1,134 @@
+/*
+ * Copyright (C) 2013 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.actionbarcompat.listpopupmenu;
+
+import android.os.Bundle;
+import android.support.v4.app.ListFragment;
+import android.support.v7.widget.PopupMenu;
+import android.view.MenuItem;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ArrayAdapter;
+import android.widget.ListView;
+import android.widget.Toast;
+
+import java.util.ArrayList;
+
+/**
+ * This ListFragment displays a list of cheeses, with a clickable view on each item whichs displays
+ * a {@link android.support.v7.widget.PopupMenu PopupMenu} when clicked, allowing the user to
+ * remove the item from the list.
+ */
+public class PopupListFragment extends ListFragment implements View.OnClickListener {
+
+ @Override
+ public void onActivityCreated(Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+
+ // We want to allow modifications to the list so copy the dummy data array into an ArrayList
+ ArrayList<String> items = new ArrayList<String>();
+ for (int i = 0, z = Cheeses.CHEESES.length ; i < z ; i++) {
+ items.add(Cheeses.CHEESES[i]);
+ }
+
+ // Set the ListAdapter
+ setListAdapter(new PopupAdapter(items));
+ }
+
+ @Override
+ public void onListItemClick(ListView listView, View v, int position, long id) {
+ String item = (String) listView.getItemAtPosition(position);
+
+ // Show a toast if the user clicks on an item
+ Toast.makeText(getActivity(), "Item Clicked: " + item, Toast.LENGTH_SHORT).show();
+ }
+
+ @Override
+ public void onClick(final View view) {
+ // We need to post a Runnable to show the popup to make sure that the PopupMenu is
+ // correctly positioned. The reason being that the view may change position before the
+ // PopupMenu is shown.
+ view.post(new Runnable() {
+ @Override
+ public void run() {
+ showPopupMenu(view);
+ }
+ });
+ }
+
+ // BEGIN_INCLUDE(show_popup)
+ private void showPopupMenu(View view) {
+ final PopupAdapter adapter = (PopupAdapter) getListAdapter();
+
+ // Retrieve the clicked item from view's tag
+ final String item = (String) view.getTag();
+
+ // Create a PopupMenu, giving it the clicked view for an anchor
+ PopupMenu popup = new PopupMenu(getActivity(), view);
+
+ // Inflate our menu resource into the PopupMenu's Menu
+ popup.getMenuInflater().inflate(R.menu.popup, popup.getMenu());
+
+ // Set a listener so we are notified if a menu item is clicked
+ popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
+ @Override
+ public boolean onMenuItemClick(MenuItem menuItem) {
+ switch (menuItem.getItemId()) {
+ case R.id.menu_remove:
+ // Remove the item from the adapter
+ adapter.remove(item);
+ return true;
+ }
+ return false;
+ }
+ });
+
+ // Finally show the PopupMenu
+ popup.show();
+ }
+ // END_INCLUDE(show_popup)
+
+ /**
+ * A simple array adapter that creates a list of cheeses.
+ */
+ class PopupAdapter extends ArrayAdapter<String> {
+
+ PopupAdapter(ArrayList<String> items) {
+ super(getActivity(), R.layout.list_item, android.R.id.text1, items);
+ }
+
+ @Override
+ public View getView(int position, View convertView, ViewGroup container) {
+ // Let ArrayAdapter inflate the layout and set the text
+ View view = super.getView(position, convertView, container);
+
+ // BEGIN_INCLUDE(button_popup)
+ // Retrieve the popup button from the inflated view
+ View popupButton = view.findViewById(R.id.button_popup);
+
+ // Set the item as the button's tag so it can be retrieved later
+ popupButton.setTag(getItem(position));
+
+ // Set the fragment instance as the OnClickListener
+ popupButton.setOnClickListener(PopupListFragment.this);
+ // END_INCLUDE(button_popup)
+
+ // Finally return the view to be displayed
+ return view;
+ }
+ }
+
+}