/** * The MIT License (MIT) * Copyright (c) 2012-2014 唐虞科技(TangyuSoft) Corporation * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in all * copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE * SOFTWARE. */ package com.tangyu.component.demo; import android.app.Activity; import android.os.Bundle; import android.os.Handler; import android.text.format.DateFormat; import android.view.View; import android.widget.AbsListView.LayoutParams; import android.widget.AdapterView; import android.widget.AdapterView.OnItemClickListener; import android.widget.ArrayAdapter; import com.tangyu.component.R; import com.tangyu.component.Util; import com.tangyu.component.view.HorizontalListView; import java.util.Calendar; import java.util.LinkedList; import java.util.List; /** * The Demo of HorizontalListView. * @author bin */ public class HorizontalListViewDemo extends Activity { private HorizontalListView hListView; public HorizontalListView testGetListView() { return hListView; } Handler handler = new Handler() { public void handleMessage(android.os.Message msg) { switch (msg.what) { case 0: final int position = hListView.getFirstVisiblePosition(); hListView.setSelection(position + 1); sendEmptyMessageDelayed(0, 1500); break; case 1: int firstVisiblePosition = hListView.getFirstVisiblePosition(); mAutoStrings.add(DateFormat.format("kk:mm:ss", Calendar.getInstance()) + ""); mAdapter = new ArrayAdapter<String>(HorizontalListViewDemo.this, R.layout.simple_list_item_1, mAutoStrings); hListView.setAdapter(mAdapter); hListView.requestChildFreeze(hListView.getChildAt(0), firstVisiblePosition); handler.sendEmptyMessageDelayed(1, 500); break; } }; }; private ArrayAdapter<String> mAdapter; @Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); hListView = getHListView(); setContentView(hListView); mAdapter = new ArrayAdapter<String>(this, R.layout.simple_list_item_1, mStrings); hListView.setAdapter(mAdapter); hListView.setOnItemClickListener(new OnItemClickListener() { @Override public void onItemClick(AdapterView<?> arg0, View arg1, int arg2, long arg3) { // TODO Auto-generated method stub final int position = hListView.getFirstVisiblePosition(); Util.toast(HorizontalListViewDemo.this, "first = " + (position + 1) + " cur = " + (arg2 + 1), true); handler.removeMessages(0); } }); } public void onWindowFocusChanged(boolean hasFocus) { super.onWindowFocusChanged(hasFocus); if (hasFocus) { hListView.setSelectionFromLeft(0, 10000); // hListView.setSelectionFromLeft(0, -10000); // hListView.setSelectionFromLeft(0, 100); // hListView.setSelectionFromLeft(1, 120); // ListAdapter apr = hListView.getAdapter(); // hListView.setSelection(apr.getCount() - 1); // hListView.setSelectionFromLeft(apr.getCount() - 1, 10000); // hListView.setSelectionFromLeft(apr.getCount() - 1, -10000); // hListView.setSelectionFromLeft(apr.getCount() - 1, 100); // hListView.setSelectionFromLeft(apr.getCount() - 1, -100); // hListView.setSelectionFromLeft(1, -100); // hListView.setSelectionFromLeft(1, -100); // hListView.setSelectionFromLeft(apr.getCount() - 2, 100); // hListView.setSelectionFromLeft(apr.getCount() - 2, -100); // hListView.setSelectionFromLeft(apr.getCount() - 2, 0); // hListView.setSelectionFromLeft(apr.getCount() - 1, 0); // handler.sendEmptyMessageDelayed(1, 3000); } }; HorizontalListView getHListView() { HorizontalListView listView = new HorizontalListView(this, null); listView.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT)); listView.setBackgroundColor(0xFF33B5E5); return listView; } public List<String> mAutoStrings; public final String[] mStringShorts = {"1 : Beyaz Peynir", "2 : Harbourne Blue", }; public final String[] mStrings = {"1 : Beyaz Peynir", "2 : Harbourne Blue", "3 : Doolin", "4 : Cougar Gold", "5 : Blue Castello", "6 : Appenzell", }; { mAutoStrings = new LinkedList<String>(); for (String e : mStrings) { mAutoStrings.add(e); } } public final String[] mStringMores = {"1 : Beyaz Peynir", "2 : Harbourne Blue", "3 : Doolin", "4 : Cougar Gold", "5 : Blue Castello", "6 : Appenzell", "7 : Rouleau De Beaulieu", "8 : Ubriaco", "9 : Evansdale Farmhouse Brie", "10 : Mimolette", "11 : Dreux a la Feuille", "12 : Le Roule", "13 : Seriously Strong Cheddar", "14 : Bosworth", "15 : Cream Havarti", "16 : Ile d'Yeu", "17 : Mont D'or Lyonnais", "18 : Hubbardston Blue Cow", "19 : Ardrahan", "20 : Duroblando", "21 : Provolone (Australian)", "22 : Queso Fresco (Adobera)", "23 : Mozzarella (Australian)", "24 : Fiore Sardo", "25 : Brick", "26 : Maribo", "27 : Danablu (Danish Blue)", "28 : Provolone", "29 : Crottin de Chavignol", "30 : Pant ys Gawn", "31 : Anejo Enchilado", "32 : Schloss", "33 : Bishop Kennedy", "34 : Sirene", "35 : Brebis du Lavort", "36 : Llanboidy", "37 : Exmoor Blue", "38 : Yarg Cornish", "39 : Canadian Cheddar", "40 : Boulette d'Avesnes", "41 : Cypress Grove Chevre", "42 : Queso Majorero", "43 : Gruyere", "44 : Jindi Brie", "45 : Ossau-Iraty", "46 : Langres", "47 : Fondant de Brebis", "48 : Pasteurized Processed", "49 : L'Ecir de l'Aubrac", "50 : Monastery Cheeses", "51 : Sainte Maure", "52 : Rollot", "53 : Swaledale", "54 : Coeur de Camembert au Calvados", "55 : Beauvoorde", "56 : Leafield", "57 : Bavarian Bergkase", "58 : Caprice des Dieux", "59 : Pecorino Romano", "60 : Myzithra", "61 : Feta (Australian)", "62 : Caciotta", "63 : Afuega'l Pitu", "64 : Bleu de Laqueuille", "65 : Maytag Blue", "66 : Bleu de Septmoncel", "67 : Lairobell", "68 : Dauphin", "69 : Coverdale", "70 : Mozzarella di Bufala", "71 : Herve", "72 : Autun", "73 : Bresse Bleu", "74 : Bierkase", "75 : Postel", "76 : Buxton Blue", "77 : Castelo Branco", "78 : Tomme de Chevre", "79 : Queso Jalapeno", "80 : Matocq", "81 : Regal de la Dombes", "82 : Idaho Goatster", "83 : Lanark Blue", "84 : Acorn", "85 : Trappe (Veritable)", "86 : Romans Part Dieu", "87 : Casciotta di Urbino", "88 : Bryndza", "89 : Perail de Brebis", "90 : Galette du Paludier", "91 : Gouda", "92 : Mahoe Aged Gouda", "93 : Chaource", "94 : Bleu Des Causses", "95 : Kadchgall", "96 : Feta", "97 : Orkney Extra Mature Cheddar", "98 : Mozzarella Fresh, in water", "99 : Liptauer", "100 : Murol", "101 : Aromes au Gene de Marc", "102 : Petit Pardou", "103 : Cooleney", "104 : Saint-Paulin", "105 : Gorgonzola", "106 : Queso del Montsec", "107 : Pate de Fromage", "108 : Kaseri", "109 : Fontina Val d'Aosta", "110 : Spenwood", "111 : Fromage Corse", "112 : Fynbo", "113 : Brebis du Puyfaucon", "114 : Bonchester", "115 : Weichkaese", "116 : Fromage de Montagne de Savoie", "117 : Rabacal", "118 : Scamorza", "119 : Dunbarra", "120 : Friesekaas", "121 : Abbaye du Mont des Cats", "122 : Sourire Lozerien", "123 : Shropshire Blue", "124 : Klosterkaese", "125 : Leerdammer", "126 : Tetilla", "127 : Grana Padano", "128 : Castelleno", "129 : Aubisque Pyrenees", "130 : Bra", "131 : Bleu de Gex", "132 : Toscanello", "133 : Leicester", "134 : Graddost", "135 : Gammelost", "136 : Saaland Pfarr", "137 : Broccio Demi-Affine", "138 : Cornish Pepper", "139 : Leyden", "140 : Oszczypek", "141 : Tillamook Cheddar", "142 : Fourme de Montbrison", "143 : Peekskill Pyramid", "144 : Saint-Marcellin", "145 : Sancerre", "146 : Baguette Laonnaise", "147 : Greve", "148 : Niolo", "149 : Ami du Chambertin", "150 : Pyramide", "151 : Cerney", "152 : Neufchatel (Australian)", "153 : King Island Cape Wickham Brie", "154 : Maasdam", "155 : Trois Cornes De Vendee", "156 : Poivre d'Ane", "157 : Caciocavallo", "158 : Tupi", "159 : Kashta", "160 : Curworthy", "161 : Bakers", "162 : Toma", "163 : Chevrotin des Aravis", "164 : Friesla", "165 : Sweet Style Swiss", "166 : Bocconcini", "167 : Alverca", "168 : Gastanberra", "169 : Trou du Cru", "170 : Buchette d'Anjou", "171 : Barry's Bay Cheddar", "172 : Chabichou", "173 : Galette Lyonnaise", "174 : Tomme des Chouans", "175 : Meyer Vintage Gouda", "176 : Edelpilz", "177 : Capricorn Goat", "178 : Colby", "179 : Macconais", "180 : Port Nicholson", "181 : Chaumes", "182 : Castellano", "183 : Reggianito", "184 : Fromage a Raclette", "185 : Blue", "186 : Lou Palou", "187 : Golden Cross", "188 : Four Herb Gouda", "189 : Celtic Promise", "190 : Pave d'Affinois", "191 : Tomme Brulee", "192 : Port-Salut", "193 : Quercy Petit", "194 : Gospel Green", "195 : Queso Iberico", "196 : Cottage Cheese (Australian)", "197 : Dessertnyj Belyj", "198 : Mascarpone Torta", "199 : Tilsit", "200 : Fribourgeois", "201 : Sveciaost", "202 : Cuajada", "203 : Waimata Farmhouse Blue", "204 : Wensleydale", "205 : Panela", "206 : Berkswell", "207 : Curd", "208 : Lebbene", "209 : Queso del Tietar", "210 : Shelburne Cheddar", "211 : Cendre d'Olivet", "212 : Blue Rathgore", "213 : Mahon", "214 : Cheddar", "215 : Rigotte", "216 : Ossau Fermier", "217 : Cold Pack", "218 : Mycella", "219 : Taleggio", "220 : Selles sur Cher", "221 : Podhalanski", "222 : Coeur de Chevre", "223 : Camembert de Normandie", "224 : La Vache Qui Rit", "225 : Quartirolo Lombardo", "226 : Havarti", "227 : Dolcelatte", "228 : Manchego", "229 : String", "230 : Fourme de Haute Loire", "231 : Paneer", "232 : Crowley", "233 : Gubbeen", "234 : Evora De L'Alentejo", "235 : Woodside Cabecou", "236 : Lancashire", "237 : Airedale", "238 : Ackawi", "239 : Brillat-Savarin", "240 : Olivet Cendre", "241 : Anneau du Vic-Bilh", "242 : Fresh Ricotta", "243 : Sbrinz", "244 : Stinking Bishop", "245 : Chabichou du Poitou", "246 : Delice des Fiouves", "247 : Briquette du Forez", "248 : Yorkshire Blue", "249 : Plateau de Herve", "250 : Isle of Mull", "251 : Tyn Grug", "252 : Lavistown", "253 : Requeson", "254 : Cotherstone", "255 : Somerset Brie", "256 : Xynotyro", "257 : Bel Paese", "258 : Mozzarella Rolls", "259 : Saint-Nectaire", "260 : Sottocenare al Tartufo", "261 : Basket Cheese", "262 : Llanglofan Farmhouse", "263 : Menonita", "264 : Fresh Mozzarella", "265 : Samso", "266 : Castigliano", "267 : Metton (Cancoillotte)", "268 : Baladi", "269 : Schabzieger", "270 : Vasterbottenost", "271 : Crema Agria", "272 : Limburger", "273 : Dorset Blue Vinney", "274 : Doppelrhamstufel", "275 : Gjetost", "276 : Vendomois", "277 : Allgauer Emmentaler", "278 : Pont l'Eveque", "279 : Geitost", "280 : Knockalara", "281 : Breakfast Cheese", "282 : Northumberland", "283 : Telemea", "284 : Gornyaltajski", "285 : Greuilh", "286 : Ricotta (Australian)", "287 : Le Brin", "288 : Emental Grand Cru", "289 : Mamirolle", "290 : Brin d' Amour", "291 : Petit Morin", "292 : St. Agur Blue Cheese", "293 : L'Aveyronnais", "294 : Grana", "295 : Devon Blue", "296 : Grataron d' Areches", "297 : Esbareich", "298 : Parmesan (Parmigiano)", "299 : Meira", "300 : Frying Cheese", "301 : Royalp Tilsit", "302 : Laguiole", "303 : Sardo Egyptian", "304 : Olivet au Foin", "305 : Pas de l'Escalette", "306 : Tasmania Highland Chevre Log", "307 : Haloumi-Style Cheese", "308 : Loddiswell Avondale", "309 : Nantais", "310 : Herrgardsost", "311 : Lajta", "312 : Kenafa", "313 : Cairnsmore", "314 : Roule", "315 : Emmental", "316 : Brie de Melun", "317 : Hereford Hop", "318 : Jarlsberg", "319 : Cure Nantais", "320 : Herriot Farmhouse", "321 : Tala", "322 : Reblochon", "323 : Mine-Gabhar", "324 : Croghan", "325 : Bouyssou", "326 : Wellington", "327 : Tete de Moine", "328 : Valencay", "329 : Passendale", "330 : Blarney", "331 : Grabetto", "332 : Saga", "333 : Cabecou", "334 : Margotin", "335 : Taupiniere", "336 : Ricotta", "337 : Bruder Basil", "338 : Serra da Estrela", "339 : Gris de Lille", "340 : Fourme d' Ambert", "341 : Cream Cheese", "342 : Guerbigny", "343 : Manouri", "344 : Adelost", "345 : Saanenkaese", "346 : Castelmagno", "347 : Stilton", "348 : Graviera", "349 : Mihalic Peynir", "350 : Mozzarella", "351 : Parmigiano Reggiano", "352 : Brin d'Amour", "353 : Kernhem", "354 : Lincolnshire Poacher", "355 : Queso Quesadilla", "356 : Timboon Brie", "357 : Kefalotyri", "358 : Oxford Blue", "359 : Zanetti Grana Padano", "360 : Epoisses de Bourgogne", "361 : Nokkelost", "362 : Aragon", "363 : Chontaleno", "364 : Fougerus", "365 : Cachaille", "366 : Fin-de-Siecle", "367 : Pecorino", "368 : Hushallsost", "369 : Tomme de Romans", "370 : Cathelain", "371 : Crowdie", "372 : Queso Para Frier", "373 : Olivet Bleu", "374 : P'tit Berrichon", "375 : Testouri", "376 : Queso Fresco", "377 : Gaperon a l'Ail", "378 : Cotija", "379 : Figue", "380 : Lappi", "381 : Richelieu", "382 : Folded", "383 : Fleur du Maquis", "384 : Kikorangi", "385 : Calenzana", "386 : Durrus", "387 : Maroilles", "388 : Selva", "389 : Creme Fraiche", "390 : King River Gold", "391 : Teifi", "392 : Gowrie", "393 : Ridder", "394 : Babybel", "395 : Filetta", "396 : Fresh Truffles", "397 : Caboc", "398 : Gloucester", "399 : Petit-Suisse", "400 : Pressato", "401 : Boule Du Roves", "402 : Jermi Tortes", "403 : Burgos", "404 : Manur", "405 : Brin", "406 : Chabis de Gatine", "407 : Fontal", "408 : Abertam", "409 : Cambazola", "410 : Raclette", "411 : Bath Cheese", "412 : Vulscombe", "413 : Washed Rind Cheese (Australian)", "414 : Coulommiers", "415 : Esrom", "416 : Plymouth Cheese", "417 : Torta del Casar", "418 : Munster", "419 : American Cheese", "420 : Salers", "421 : Orla", "422 : Tamie", "423 : Avaxtskyr", "424 : Kugelkase", "425 : Grafton Village Cheddar", "426 : Civray", "427 : Lingot Saint Bousquet d'Orb", "428 : Butte", "429 : Etorki", "430 : Brie de Meaux", "431 : Le Fium Orbo", "432 : Penbryn", "433 : Heidi Gruyere", "434 : Braudostur", "435 : Edam", "436 : Ardi Gasna", "437 : Menallack Farmhouse", "438 : Laruns", "439 : Wigmore", "440 : Corleggy", "441 : Tyning", "442 : Boursault", "443 : Galloway Goat's Milk Gems", "444 : Fresh Jack", "445 : Double Gloucester", "446 : Rustinu", "447 : Pecorino in Walnut Leaves", "448 : Danbo", "449 : Flower Marie", "450 : Zamorano", "451 : Roquefort", "452 : Rocamadour", "453 : Bocconcini (Australian)", "454 : Prastost", "455 : Brebis du Lochois", "456 : Longhorn", "457 : Mini Baby Bells", "458 : Goutu", "459 : Mothais a la Feuille", "460 : Friesian", "461 : Crayeux de Roncq", "462 : Olde York", "463 : Morbier Cru de Montagne", "464 : Halloumi", "465 : Prince-Jean", "466 : Explorateur", "467 : Beenleigh Blue", "468 : Marble Cheddar", "469 : Garrotxa", "470 : Blue Vein (Australian)", "471 : Asadero", "472 : Sonoma Jack", "473 : Soumaintrain", "474 : Tronchon", "475 : Canestrato", "476 : Quark (Australian)", "477 : Monterey Jack Dry", "478 : Naboulsi", "479 : Patefine Fort", "480 : Bandal", "481 : Fromage Frais", "482 : Little Rydings", "483 : Crottin du Chavignol", "484 : Vignotte", "485 : Serat", "486 : Gabriel", "487 : Processed Cheddar", "488 : Rubens", "489 : Polkolbin", "490 : Finn", "491 : Mascarpone", "492 : Frinault", "493 : Texas Goat Cheese", "494 : Caerphilly", "495 : Jubilee Blue", "496 : Smoked Gouda", "497 : Baylough", "498 : Tourmalet", "499 : Pave d'Auge", "500 : Finlandia Swiss", "501 : Dunsyre Blue", "502 : Lou Pevre", "503 : Remedou", "504 : Pyengana Cheddar", "505 : Abbaye de Belloc", "506 : Cashel Blue", "507 : Bergader", "508 : Gratte-Paille", "509 : Gippsland Blue", "510 : Zanetti Parmigiano Reggiano", "511 : Hipi Iti", "512 : Raschera", "513 : Venaco", "514 : Mascarpone (Australian)", "515 : Pouligny-Saint-Pierre", "516 : Kervella Affine", "517 : Lyonnais", "518 : Dry Jack", "519 : Pannerone", "520 : Pelardon des Corbieres", "521 : Mixte", "522 : Loch Arthur Farmhouse", "523 : Whitestone Farmhouse", "524 : Iberico", "525 : Meredith Blue", "526 : Cabrales", "527 : Vieux Corse", "528 : Montasio", "529 : Cheshire", "530 : Baby Swiss", "531 : Blue Vein Cheeses", "532 : Red Leicester", "533 : Neufchatel", "534 : Coolea", "535 : Swiss", "536 : Waterloo", "537 : Crescenza", "538 : Buffalo", "539 : Morbier", "540 : Duddleswell", "541 : Queso Blanco", "542 : Xanadu", "543 : Marbled Cheeses", "544 : Halloumy (Australian)", "545 : Ricotta Salata", "546 : Tommes", "547 : Balaton", "548 : Mascares", "549 : Piora", "550 : Fruit Cream Cheese", "551 : Queso Blanco con Frutas --Pina y Mango", "552 : Maredsous", "553 : Truffe", "554 : Butterkase", "555 : Pourly", "556 : Anthoriro", "557 : Juustoleipa", "558 : Pithtviers au Foin", "559 : San Simon", "560 : Briquette de Brebis", "561 : Ulloa", "562 : Ragusano", "563 : Mondseer", "564 : Picos de Europa", "565 : Formaggio di capra", "566 : Brinza (Burduf Brinza)", "567 : Boeren Leidenkaas", "568 : Siraz", "569 : Dutch Mimolette (Commissiekaas)", "570 : La Taupiniere", "571 : Sardo", "572 : Yarra Valley Pyramid", "573 : Malvern", "574 : Monterey Jack", "575 : Aisy Cendre", "576 : Cantal", "577 : Sussex Slipcote", "578 : Capriole Banon", "579 : Abondance", "580 : Pave du Berry", "581 : Brie", "582 : Asiago", "583 : Denhany Dorset Drum", "584 : Banon", "585 : Fontainebleau", "586 : Chevres", "587 : Quatre-Vents", "588 : Syrian (Armenian String)", "589 : Touree de L'Aubier", "590 : Vacherin-Fribourgeois", "591 : Basing", "592 : Daralagjazsky", "593 : Sage Derby", "594 : Folded cheese with mint", "595 : Flor de Guia", "596 : Comte", "597 : Milleens", "598 : Double Worcester", "599 : Pelardon des Cevennes", "600 : Idiazabal", "601 : Sharpam", "602 : Mesost", "603 : Sraffordshire Organic", "604 : Grand Vatel", "605 : Cheddar Clothbound", "606 : Jibneh Arabieh", "607 : Charolais", "608 : Picodon de Chevre", "609 : Brusselae Kaas (Fromage de Bruxelles)", "610 : Devon Garland", "611 : Emlett", "612 : Dunlop", "613 : Beer Cheese", "614 : Cwmtawe Pecorino", "615 : Tymsboro", "616 : Romano", "617 : Oaxaca", "618 : Derby", "619 : Tomme d'Abondance", "620 : Livarot", "621 : Queso de Murcia", "622 : Molbo", "623 : Broccio", "624 : Il Boschetto al Tartufo", "625 : Airag", "626 : Bougon", "627 : Roncal", "628 : Penamellera", "629 : Turunmaa", "630 : Affidelice au Chablis", "631 : Sap Sago", "632 : Queso Media Luna", "633 : Button (Innes)", "634 : Brousse du Rove", "635 : Pave de Chirac", "636 : Ambert", "637 : Coquetdale", "638 : Armenian String", "639 : Danish Fontina", "640 : White Stilton", "641 : Pencarreg", "642 : Bleu d'Auvergne", "643 : Crema Mexicana", "644 : Le Lacandou", "645 : Bergere Bleue", "646 : Carre de l'Est", "647 : Beaufort", "648 : Cottage Cheese", "649 : Quark", "650 : Oschtjepka", "651 : Boursin", "652 : Tibet", "653 : Tomme de Savoie", "654 : Palet de Babligny", }; }