android.widget.AlphabetIndexer的实例源码

项目:Applozic-Android-Chat-Sample    文件QuickConversationAdapter.java   
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);
}
项目:Applozic-Android-Chat-Sample    文件ChannelFragment.java   
/**
 * 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,alphabet);

    // Defines a span for highlighting the part of a display name that matches the search
    // string
    highlightTextSpan = new TextAppearanceSpan(getActivity(),R.style.searchTextHiglight);
}
项目:Applozic-Android-Chat-Sample    文件ContactsListFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,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,ContactsQuery.soRT_KEY,R.style.searchTextHiglight);
}
项目:Applozic-Android-Chat-Sample    文件ContactSelectionFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,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,alphabet);

    // Defines a span for highlighting the part of a display name that matches the search
    // string
    highlightTextSpan = new TextAppearanceSpan(context,R.style.searchTextHiglight);
}
项目:Applozic-Android-Chat-Sample    文件AppContactFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,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,R.style.searchTextHiglight);
}
项目:margarita    文件ContactFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,R.style.searchTextHiglight);
}
项目:ContactPicker    文件MainActivity.java   
private List<Contact> getContactArray() {
    Cursor cursor = getContentResolver().query(URI,new String[] { "display_name","sort_key","phonebook_label" },"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;
}
项目:Applozic-Android-SDK    文件QuickConversationAdapter.java   
public QuickConversationAdapter(final Context context,R.style.searchTextHiglight);
}
项目:Applozic-Android-SDK    文件ChannelFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ChannelAdapter(Context context) {
    super(context,R.style.searchTextHiglight);
}
项目:Applozic-Android-SDK    文件ContactsListFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,R.style.searchTextHiglight);
}
项目:Applozic-Android-SDK    文件ContactSelectionFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,R.style.searchTextHiglight);
}
项目:Applozic-Android-SDK    文件AppContactFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 *
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,R.style.searchTextHiglight);
}
项目:CampusFeedv2    文件ContactsListFragment.java   
/**
 * Instantiates a new Contacts Adapter.
 * @param context A context that has access to the app's layout.
 */
public ContactsAdapter(Context context) {
    super(context,R.style.searchTextHiglight);
}
项目:sana.mobile    文件PatientListFragment.java   
public Cursor index(Cursor cursor){
    if(cursor != null){
        mRowStates = new int[cursor.getCount()];
        mAlphaIndexer = new AlphabetIndexer(cursor,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;
}
项目:flingtap-done    文件ContactsListActivity.java   
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);
                    }
                }
            }
        }
项目:TestChat    文件ContactsFragment.java   
public void updateContactsData(String belongId) {
        mIndexer = new AlphabetIndexer(ChatDB.create().getSortedKeyCursor(),alphabet);
        adapter.setSectionIndexer(mIndexer);
        User user=UserCacheManager.getInstance().getUser(belongId);
        LogUtil.e("这里添加的好友星星如下");
        LogUtil.e(user);
        adapter.addData(user);
}
项目:TestChat    文件SelectedFriendsActivity.java   
@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(),alphabet);
        adapter.setSectionIndexer(mIndexer);
        display.setAdapter(adapter);
        initactionBar();
}
项目:AOSP-Kayboard-7.1.2    文件UserDictionarySettings.java   
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);
}
项目:pass-mobile-android    文件SecretsAdapter.java   
@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;
}
项目:SDC    文件ContactsListFragment.java   
@Override
public Cursor swapCursor(Cursor c) {
    if (c != null) {
        alphaIndexer = new AlphabetIndexer(c,c.getColumnIndex(Contacts.disPLAY_NAME)," ABCDEFGHIJKLMnopQRSTUVWXYZ");
    }

    return super.swapCursor(c);
}
项目:GeoSMS-Release    文件ContactsCursorAdapter.java   
@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);
}
项目:cards-app    文件ChooserItemsCursorAdapter.java   
public ChooserItemsCursorAdapter(Context context) {
        super(context);

        mInflater = LayoutInflater.from(context);
        final String alphabet = context.getString(R.string.alphabet);
        mAlphabetIndexer = new AlphabetIndexer(null,alphabet);

//      highlightTextSpan = new TextAppearanceSpan(context,R.style.searchTextHiglight);
    }
项目:cards-app    文件SimpleItemCursorAdapter.java   
public SimpleItemCursorAdapter(Context context) {
    super(context,0);

    mInflater = LayoutInflater.from(context);
    final String alphabet = context.getString(R.string.alphabet);
    mAlphabetIndexer = new AlphabetIndexer(null,R.style.searchTextHiglight);

}
项目:cards-app    文件ChooserItemsInfoCursorAdapter.java   
public ChooserItemsInfoCursorAdapter(Context context,String comType) {
        super(context);
        this.comType = comType;
        mInflater = LayoutInflater.from(context);
        final String alphabet = context.getString(R.string.alphabet);
        mAlphabetIndexer = new AlphabetIndexer(null,alphabet);
        dbHelper = DataBaseHelper.getInstance(context);
//      highlightTextSpan = new TextAppearanceSpan(context,R.style.searchTextHiglight);
    }
项目:cards-app    文件EventsCursorAdapter.java   
public EventsCursorAdapter(Context context) {
    super(context,0);

    this.context = context;

    mInflater = LayoutInflater.from(context);
    final String alphabet = context.getString(R.string.alphabet);
    mAlphabetIndexer = new AlphabetIndexer(null,R.style.searchTextHiglight);
    imageLoader = new BitmapLoaderAsyncTask(context,true,true);
}
项目:sana.mobile    文件PatientListFragment.java   
private void init(Cursor c) {
    if (c == null) {
        return;
    }
    //mWrapper = new PatientWrapper(c);
    //c.setNotificationUri(context.getContentResolver(),Patients.CONTENT_URI);
    mRowStates = new int[c.getCount()];
    Arrays.fill(mRowStates,STATE_UNKNowN);
    if(mRowStates.length > 0)
        mRowStates[0] = STATE_LABELED;
    mAlphaIndexer = new AlphabetIndexer(c,mAlphabet);
    mAlphaIndexer.setCursor(c);
}
项目:test4android    文件MainActivity.java   
@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.com_example_contact_activity_main);
    adapter = new ContactAdapter(this,R.layout.com_example_contact_item,contacts);
    titleLayout = (LinearLayout) findViewById(R.id.title_layout);
    sectionToastLayout = (RelativeLayout) findViewById(R.id.section_toast_layout);
    title = (TextView) findViewById(R.id.title);
    sectionToastText = (TextView) findViewById(R.id.section_toast_text);
    alphabetButton = (Button) findViewById(R.id.alphabetButton);
    contactsListView = (ListView) findViewById(R.id.contacts_list_view);
    Uri uri = ContactsContract.CommonDataKinds.Phone.CONTENT_URI;
    Cursor cursor = getContentResolver().query(uri,"sort_key" },"sort_key");
    if (cursor.movetoFirst()) {
        do {
            String name = cursor.getString(0);
            String sortKey = getSortKey(cursor.getString(1));
            Contact contact = new Contact();
            contact.setName(name);
            contact.setSortKey(sortKey);
            contacts.add(contact);
        } while (cursor.movetoNext());
    }
    startManagingCursor(cursor);
    indexer = new AlphabetIndexer(cursor,alphabet);
    adapter.setIndexer(indexer);
    if (contacts.size() > 0) {
        setupContactsListView();
        setAlpabetListener();
    }
}
项目:LiveBlurListView    文件ApplicationsAdapter.java   
public ApplicationsAdapter(Context context,ArrayList<AppInfo> apps) {
    super(context,apps);
    mInflater = LayoutInflater.from(context);
    //mSectionString = context.getResources().getString(R.string.fast_scroll_alphabet);
    alphabetIndexer = new AlphabetIndexer(new IndexCursor(this),"#ABCDEFGHIJKLMnopQRSTUVWXYZ");
    final int maxMemory = (int) (Runtime.getRuntime().maxMemory() / 1024);  
    final int cacheSize = maxMemory / 8;  

    mMemoryCache = new LruCache<String,Bitmap>(cacheSize) {  
        @Override  
        protected int sizeOf(String key,Bitmap bitmap) {  
            return bitmap.getByteCount()/1024;
        }  
    };
}
项目:haxsync    文件ContactListFragment.java   
public Cursor swapCursor(Cursor c) {
    // Create our indexer
    if (c != null) {
        mAlphaIndexer = new AlphabetIndexer(c,c.getColumnIndex(RawContacts.disPLAY_NAME_PRIMARY)," ABCDEFGHIJKLMnopQRSTUVWXYZ");
    }
    return super.swapCursor(c);
}
项目:flingtap-done    文件ContactsListActivity.java   
private SectionIndexer getNewIndexer(Cursor cursor) {
//            if (Locale.getDefault().equals(Locale.JAPAN)) {
//                return new JapaneseContactListIndexer(cursor,SORT_STRING_INDEX);
//            } else {
                return new AlphabetIndexer(cursor,NAME_COLUMN_INDEX,mAlphabet);
//            }
        }
项目:mv-fieldguide-android    文件SpeciesGroupListCursorAdapter.java   
public SpeciesGroupListCursorAdapter(Context context,Cursor c,int flags) {
    super(context,flags);

    mAlphabetIndexer = new AlphabetIndexer(c,c.getColumnIndex(FieldGuideDatabase.SPECIES_GROUP)," ABCDEFGHIJKLMnopQRTSUVWXYZ");
    mAlphabetIndexer.setCursor(c);
}
项目:mv-fieldguide-android    文件SpeciesGroupListFragment.java   
public SpeciesCursorAdapter(Context context," ABCDEFGHIJKLMnopQRTSUVWXYZ");
    mAlphabetIndexer.setCursor(c);
}
项目:eManga    文件MangaItemlistadapter.java   
public void reload(){
    if(itMangas != null){
        itMangas.closeQuietly();
    }

    try{
        itMangas = databaseHelper.getMangaRunDao().iterator(mangaQuery);
        mMangas = (AndroidDatabaseResults) itMangas.getRawResults();
        mAlphabetIndexer = new AlphabetIndexer(mMangas.getRawCursor(),mMangas.findColumn(Manga.TITLE_COLUMN_NAME),sections);
    } catch (sqlException e){
        e.printstacktrace();
    }
}
项目:eManga    文件MangaItemListCursorAdapter.java   
public MangaItemListCursorAdapter(Context context,int layout,String[] from,int[] to,flags);

    mInflater = LayoutInflater.from(context);

    imageLoader = ImageCacheManager.getInstance().getimageLoader();

    if (c != null) {
        mAlphaIndexer = new AlphabetIndexer(c,c.getColumnIndex(Manga.TITLE_COLUMN_NAME)," -0123456789ABCDEFGHIJKLMnopQRSTUVWXYZ");
    }

}
项目:eManga    文件MangaItemListCursorAdapter.java   
public Cursor swapCursor(Cursor c) {
    Cursor mCursor = getCursor();
    if (mCursor != null) {
        mCursor.close();
    }
    // Create our indexer
    if (c != null) {
        mAlphaIndexer = new AlphabetIndexer(c," -0123456789ABCDEFGHIJKLMnopQRSTUVWXYZ");
    }
    notifyDataSetChanged();
    return super.swapCursor(c);
}

相关文章

买水果
比较全面的redis工具类
gson 反序列化到多态子类
java 版本的 mb_strwidth
JAVA 反转字符串的最快方法,大概比StringBuffer.reverse()性...
com.google.gson.internal.bind.ArrayTypeAdapter的实例源码...