package com.android.ianc;
import java.util.regex.Pattern;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.Window;
import android.widget.ArrayAdapter;
import android.widget.ListView;
import android.widget.TextView;
import com.android.ianc.MyLetterView.OnTouchingLetterChangedListener;
public class TestList extends Activity implements
OnTouchingLetterChangedListener {
private Window window;
private TextView overlay;
private ListView personList;
private MyLetterView myView;
private OverlayThread overlayThread = new OverlayThread();
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
personList = (ListView) findViewById(R.id.lvShow);
personList.setAdapter(new ArrayAdapter<String>(this,
android.R.layout.simple_list_item_1, sCheeseStrings));
personList.setTextFilterEnabled(true);
myView = (MyLetterView) findViewById(R.id.myView);
myView.setOnTouchingLetterChangedListener(this);
overlay = (TextView) findViewById(R.id.tvLetter);
overlay.setVisibility(View.INVISIBLE);
}
public void onTouchingLetterChanged(String s) {
// TODO Auto-generated method stub
if (alphaIndexer(s) > 0) {
int position = alphaIndexer(s);
personList.setSelection(position);
overlay.setText(s);
overlay.setVisibility(View.VISIBLE);
handler.removeCallbacks(overlayThread);
handler.postDelayed(overlayThread, 1500);
}
}
public static int alphaIndexer(String s) {
int i = 0;
for (; i < sCheeseStrings.length; i++) {
if (sCheeseStrings[i].startsWith(s)) {
break;
}
}
return i;
}
private Handler handler = new Handler() {
};
private class OverlayThread implements Runnable {
public void run() {
overlay.setVisibility(View.GONE);
}
}
private String getAlpha(String str) {
if (str == null) {
return "#";
}
if (str.trim().length() == 0) {
return "#";
}
char c = str.trim().substring(0, 1).charAt(0);
Pattern pattern = Pattern.compile("^[A-Za-z]+{1}");
if (pattern.matcher(c + "").matches()) {
return (c + "").toUpperCase();
} else {
return "#";
}
}
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
没有合适的资源?快使用搜索试试~ 我知道了~
资源推荐
资源详情
资源评论
收起资源包目录
ListView 实现点击侧边A-Z快速查找.zip (42个子文件)
ListView 实现点击侧边A-Z快速查找
TestIntelligent
TestIntelligent
.classpath 280B
assets
src
com
lotus
testintelligent
LetterParser.java 27KB
ContactAdapter.java 5KB
CursorContactsAdapter.java 4KB
IntelligentActivity.java 3KB
ContactInfo.java 183B
res
drawable-mdpi
photo.png 2KB
icon.png 3KB
drawable-ldpi
photo.png 2KB
icon.png 2KB
values
strings.xml 174B
layout
main.xml 567B
dialcontactitem.xml 894B
drawable-hdpi
photo.png 2KB
icon.png 4KB
bin
resources.ap_ 16KB
TestIntelligent.apk 29KB
classes.dex 30KB
com
lotus
testintelligent
ContactAdapter$ViewHolder.class 676B
ContactInfo.class 412B
IntelligentActivity.class 4KB
ContactAdapter.class 6KB
R$string.class 448B
R$layout.class 454B
CursorContactsAdapter$ViewHolder.class 708B
CursorContactsAdapter.class 5KB
R$id.class 514B
ContactAdapter$1.class 3KB
R$attr.class 361B
R$drawable.class 450B
IntelligentActivity$1.class 1KB
R.class 580B
LetterParser.class 19KB
default.properties 364B
.project 851B
AndroidManifest.xml 841B
gen
com
lotus
testintelligent
R.java 1KB
MyLetterView.txt 3KB
main.txt 1KB
TestIntelligent.rar 93KB
说明.zip 17KB
TestList.txt 13KB
共 42 条
- 1
资源评论
firepation
- 粉丝: 1744
- 资源: 871
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功