类android.widget.AlphabetIndexer源码实例Demo

下面列出了怎么用android.widget.AlphabetIndexer的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: tindroid   文件: ContactsAdapter.java
ContactsAdapter(Context context, ImageLoader imageLoader, ClickListener clickListener) {

        mClickListener = clickListener;
        mImageLoader = imageLoader;
        mSelected = new HashMap<>();

        setHasStableIds(true);
        mCursor = null;

        // 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, ContactsLoaderCallback.ContactsQuery.SORT_KEY, alphabet);

        // Defines a span for highlighting the part of a display name that matches the search
        // string
        mHighlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHighlight);
    }
 
源代码2 项目: 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, 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);
}
 
/**
 * 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);
}
 
源代码4 项目: 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, 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);
}
 
源代码5 项目: sana.mobile   文件: PatientListFragment.java
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;
}
 
源代码6 项目: openboard   文件: 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);
}
 
源代码7 项目: Android-Keyboard   文件: 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);
}
 
源代码8 项目: TestChat   文件: ContactsFragment.java
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);
}
 
源代码9 项目: 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(), 0, alphabet);
        adapter.setSectionIndexer(mIndexer);
        display.setAdapter(adapter);
        initActionBar();
}
 
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);
}
 
源代码11 项目: Indic-Keyboard   文件: 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);
}
 
源代码12 项目: 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,
            1,
            mAlphabet);
    mAlphaIndexer.setCursor(c);
}
 
源代码13 项目: LiveBlurListView   文件: ApplicationsAdapter.java
public ApplicationsAdapter(Context context, ArrayList<AppInfo> apps) {
	super(context, 0, apps);
	mInflater = LayoutInflater.from(context);
	//mSectionString = context.getResources().getString(R.string.fast_scroll_alphabet);
	alphabetIndexer = new AlphabetIndexer(new IndexCursor(this), 0, "#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;
		}  
	};
}
 
源代码14 项目: 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);
}
 
public AlphabetIndexerCursorAdapter(Bundle savedInstanceState, Context context, Cursor cursor) {
    super(savedInstanceState, context, R.layout.mca__simple_list_item_checkable_1, cursor, FROM, TO, 0);

    // Sets a new cursor as the data set and resets the cache of indices.
    int columnIndex = cursor.getColumnIndex(BuildingsContract.NAME);
    alphabetIndexer = new AlphabetIndexer(cursor, columnIndex, " ABCDEFGHIJKLMNOPQRTSUVWXYZ");
    alphabetIndexer.setCursor(cursor);
}
 
public AlphabetIndexerCursorAdapter(Bundle savedInstanceState, Context context, Cursor cursor) {
    super(savedInstanceState, context, R.layout.mca__simple_list_item_checkable_1, cursor, FROM, TO, 0);

    // Sets a new cursor as the data set and resets the cache of indices.
    int columnIndex = cursor.getColumnIndex(BuildingsContract.NAME);
    alphabetIndexer = new AlphabetIndexer(cursor, columnIndex, " ABCDEFGHIJKLMNOPQRTSUVWXYZ");
    alphabetIndexer.setCursor(cursor);
}
 
public AlphabetIndexerCursorAdapter(Bundle savedInstanceState, Context context, Cursor cursor) {
    super(savedInstanceState, context, R.layout.mca__simple_list_item_checkable_1, cursor, FROM, TO, 0);

    // Sets a new cursor as the data set and resets the cache of indices.
    int columnIndex = cursor.getColumnIndex(BuildingsContract.NAME);
    alphabetIndexer = new AlphabetIndexer(cursor, columnIndex, " ABCDEFGHIJKLMNOPQRTSUVWXYZ");
    alphabetIndexer.setCursor(cursor);
}
 
 类所在包
 类方法
 同包方法