本文整理汇总了Java中android.widget.AlphabetIndexer类的典型用法代码示例。如果您正苦于以下问题:Java AlphabetIndexer类的具体用法?Java AlphabetIndexer怎么用?Java AlphabetIndexer使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AlphabetIndexer类属于android.widget包,在下文中一共展示了AlphabetIndexer类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: QuickConversationAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
public QuickConversationAdapter(final Context context, List<Message> messageList, EmojiconHandler emojiconHandler) {
this.context = context;
this.emojiconHandler = emojiconHandler;
this.contactService = new AppContactService(context);
this.messageDatabaseService = new MessageDatabaseService(context);
this.messageList = messageList;
contactImageLoader = new ImageLoader(context, ImageUtils.getLargestScreenDimension((Activity) context)) {
@Override
protected Bitmap processBitmap(Object data) {
return contactService.downloadContactImage((Activity) context, (Contact) data);
}
};
contactImageLoader.addImageCache(((FragmentActivity) context).getSupportFragmentManager(), 0.1f);
contactImageLoader.setImageFadeIn(false);
channelImageLoader = new ImageLoader(context, ImageUtils.getLargestScreenDimension((Activity) context)) {
@Override
protected Bitmap processBitmap(Object data) {
return contactService.downloadGroupImage((Activity) context, (Channel) data);
}
};
channelImageLoader.addImageCache(((FragmentActivity) context).getSupportFragmentManager(), 0.1f);
channelImageLoader.setImageFadeIn(false);
final String alphabet = context.getString(R.string.alphabet);
mAlphabetIndexer = new AlphabetIndexer(null, 1, alphabet);
highlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHiglight);
}
示例2: ChannelAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
/**
* Instantiates a new Contacts Adapter.
*
* @param context A context that has access to the app's layout.
*/
public ChannelAdapter(Context context) {
super(context, null, 0);
this.context = context;
// Stores inflater for use later
mInflater = LayoutInflater.from(context);
final String alphabet = context.getString(R.string.alphabet);
// Instantiates a new AlphabetIndexer bound to the column used to sort contact names.
// The cursor is left null, because it has not yet been retrieved.
mAlphabetIndexer = new AlphabetIndexer(null, 1, alphabet);
// Defines a span for highlighting the part of a display name that matches the search
// string
highlightTextSpan = new TextAppearanceSpan(getActivity(), R.style.searchTextHiglight);
}
示例3: ContactsAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
/**
* Instantiates a new Contacts Adapter.
*
* @param context A context that has access to the app's layout.
*/
public ContactsAdapter(Context context) {
super(context, null, 0);
// Stores inflater for use later
mInflater = LayoutInflater.from(context);
// Loads a string containing the English alphabet. To fully localize the app, provide a
// strings.xml file in res/values-<x> directories, where <x> is a locale. In the file,
// define a string with android:name="alphabet" and contents set to all of the
// alphabetic characters in the language in their proper sort order, in upper case if
// applicable.
final String alphabet = context.getString(R.string.alphabet);
// Instantiates a new AlphabetIndexer bound to the column used to sort contact names.
// The cursor is left null, because it has not yet been retrieved.
mAlphabetIndexer = new AlphabetIndexer(null, ContactsQuery.SORT_KEY, alphabet);
// Defines a span for highlighting the part of a display name that matches the search
// string
highlightTextSpan = new TextAppearanceSpan(getActivity(), R.style.searchTextHiglight);
}
示例4: ContactsAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
/**
* Instantiates a new Contacts Adapter.
*
* @param context A context that has access to the app's layout.
*/
public ContactsAdapter(Context context) {
super(context, null, 0);
this.context = context;
userIdList = new ArrayList<String>();
// Stores inflater for use later
mInflater = LayoutInflater.from(context);
// Loads a string containing the English alphabet. To fully localize the app, provide a
// strings.xml file in res/values-<x> directories, where <x> is a locale. In the file,
// define a string with android:name="alphabet" and contents set to all of the
// alphabetic characters in the language in their proper sort order, in upper case if
// applicable.
final String alphabet = context.getString(R.string.alphabet);
// Instantiates a new AlphabetIndexer bound to the column used to sort contact names.
// The cursor is left null, because it has not yet been retrieved.
mAlphabetIndexer = new AlphabetIndexer(null, 1, alphabet);
// Defines a span for highlighting the part of a display name that matches the search
// string
highlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHiglight);
}
示例5: ContactsAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
/**
* Instantiates a new Contacts Adapter.
*
* @param context A context that has access to the app's layout.
*/
public ContactsAdapter(Context context) {
super(context, null, 0);
this.context = context;
// Stores inflater for use later
mInflater = LayoutInflater.from(context);
// Loads a string containing the English alphabet. To fully localize the app, provide a
// strings.xml file in res/values-<x> directories, where <x> is a locale. In the file,
// define a string with android:name="alphabet" and contents set to all of the
// alphabetic characters in the language in their proper sort order, in upper case if
// applicable.
final String alphabet = context.getString(R.string.alphabet);
// Instantiates a new AlphabetIndexer bound to the column used to sort contact names.
// The cursor is left null, because it has not yet been retrieved.
mAlphabetIndexer = new AlphabetIndexer(null, 1, alphabet);
// Defines a span for highlighting the part of a display name that matches the search
// string
highlightTextSpan = new TextAppearanceSpan(getActivity(), R.style.searchTextHiglight);
}
示例6: ContactsAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
/**
* Instantiates a new Contacts Adapter.
* @param context A context that has access to the app's layout.
*/
public ContactsAdapter(Context context) {
super(context, null, 0);
// Stores inflater for use later
mInflater = LayoutInflater.from(context);
// Loads a string containing the English alphabet. To fully localize the app, provide a
// strings.xml file in res/values-<x> directories, where <x> is a locale. In the file,
// define a string with android:name="alphabet" and contents set to all of the
// alphabetic characters in the language in their proper sort order, in upper case if
// applicable.
final String alphabet = context.getString(R.string.alphabet);
// Instantiates a new AlphabetIndexer bound to the column used to sort contact names.
// The cursor is left null, because it has not yet been retrieved.
mAlphabetIndexer = new AlphabetIndexer(null, ContactsQuery.SORT_KEY, alphabet);
// Defines a span for highlighting the part of a display name that matches the search
// string
highlightTextSpan = new TextAppearanceSpan(getActivity(), R.style.searchTextHiglight);
}
示例7: getContactArray
import android.widget.AlphabetIndexer; //导入依赖的package包/类
private List<Contact> getContactArray() {
Cursor cursor = getContentResolver().query(URI,
new String[] { "display_name", "sort_key", "phonebook_label" },
null, null, "phonebook_label");
Contact contact;
if (cursor.moveToFirst()) {
do {
contact = new Contact();
String contact_name = cursor.getString(0);
String phonebook_label = cursor.getString(2);
contact.setPhonebookLabel(getPhonebookLabel(phonebook_label));
contact.setPinyinName(PinYin.getPinYin(contact_name));
contact.setName(contact_name);
list.add(contact);
} while (cursor.moveToNext());
}
// 实例化indexer
mIndexer = new AlphabetIndexer(cursor, 2, alphabet);
return list;
}
示例8: index
import android.widget.AlphabetIndexer; //导入依赖的package包/类
public Cursor index(Cursor cursor){
if(cursor != null){
mRowStates = new int[cursor.getCount()];
mAlphaIndexer = new AlphabetIndexer(cursor,
1,
mAlphabet);
mAlphaIndexer.setCursor(cursor);
Arrays.fill(mRowStates, STATE_UNKNOWN);
} else {
mRowStates = new int[0];
mAlphaIndexer = null;
}
if(mRowStates.length > 0)
mRowStates[0] = STATE_LABELED;
return cursor;
}
示例9: updateIndexer
import android.widget.AlphabetIndexer; //导入依赖的package包/类
private void updateIndexer(Cursor cursor) {
if (mIndexer == null) {
mIndexer = getNewIndexer(cursor);
} else {
if (Locale.getDefault().equals(Locale.JAPAN)) {
// if (mIndexer instanceof JapaneseContactListIndexer) {
// ((JapaneseContactListIndexer)mIndexer).setCursor(cursor);
// } else {
mIndexer = getNewIndexer(cursor);
// }
} else {
if (mIndexer instanceof AlphabetIndexer) {
((AlphabetIndexer)mIndexer).setCursor(cursor);
} else {
mIndexer = getNewIndexer(cursor);
}
}
}
}
示例10: updateContactsData
import android.widget.AlphabetIndexer; //导入依赖的package包/类
public void updateContactsData(String belongId) {
mIndexer = new AlphabetIndexer(ChatDB.create().getSortedKeyCursor(), 0, alphabet);
adapter.setSectionIndexer(mIndexer);
User user=UserCacheManager.getInstance().getUser(belongId);
LogUtil.e("这里添加的好友星星如下");
LogUtil.e(user);
adapter.addData(user);
}
示例11: initData
import android.widget.AlphabetIndexer; //导入依赖的package包/类
@Override
public void initData() {
mLinearLayoutManager = new LinearLayoutManager(this);
display.setLayoutManager(mLinearLayoutManager);
display.addItemDecoration(new ListViewDecoration(this));
display.setItemAnimator(new DefaultItemAnimator());
mMyLetterView.setTextView(middle);
adapter = new ContactsAdapter(UserCacheManager.getInstance().getAllContacts(),R.layout.fragment_contacts_list_item);
adapter.setOnCheckedChangeListener(this);
mIndexer = new AlphabetIndexer(ChatDB.create().getSortedKeyCursor(), 0, alphabet);
adapter.setSectionIndexer(mIndexer);
display.setAdapter(adapter);
initActionBar();
}
示例12: MyAdapter
import android.widget.AlphabetIndexer; //导入依赖的package包/类
public MyAdapter(final Context context, final int layout, final Cursor c,
final String[] from, final int[] to) {
super(context, layout, c, from, to, 0 /* flags */);
if (null != c) {
final String alphabet = context.getString(R.string.user_dict_fast_scroll_alphabet);
final int wordColIndex = c.getColumnIndexOrThrow(UserDictionary.Words.WORD);
mIndexer = new AlphabetIndexer(c, wordColIndex, alphabet);
}
setViewBinder(mViewBinder);
}
示例13: swapCursor
import android.widget.AlphabetIndexer; //导入依赖的package包/类
@Override
public Cursor swapCursor(Cursor newCursor) {
Cursor oldCursor = super.swapCursor(newCursor);
// Create an indexer for the first time, indexing on domain.
if (newCursor != null) {
mAlphabetIndexer = new AlphabetIndexer(newCursor, newCursor.getColumnIndex(Secret.DOMAIN), ALPHABET);
}
// Update an existing indexer with the latest cursor.
if (mAlphabetIndexer != null) {
mAlphabetIndexer.setCursor(newCursor);
}
return oldCursor;
}
示例14: swapCursor
import android.widget.AlphabetIndexer; //导入依赖的package包/类
@Override
public Cursor swapCursor(Cursor c) {
if (c != null) {
alphaIndexer = new AlphabetIndexer(c,
c.getColumnIndex(Contacts.DISPLAY_NAME),
" ABCDEFGHIJKLMNOPQRSTUVWXYZ");
}
return super.swapCursor(c);
}
示例15: swapCursor
import android.widget.AlphabetIndexer; //导入依赖的package包/类
@Override
public Cursor swapCursor(Cursor newCursor) {
if(newCursor != null && !newCursor.isClosed()){
indexer = new AlphabetIndexer(newCursor,
newCursor.getColumnIndex(ContactsContract.CommonDataKinds.Phone.DISPLAY_NAME),
" ABCDEFGHIJKLMNOPQRTSUVWXYZ0123456789");
}else{
indexer.setCursor(newCursor);
}
return super.swapCursor(newCursor);
}