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); }
/** * 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); // 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); }
/** * 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); }
/** * 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); }
/** * 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); }
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; }
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; }
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); } } } }
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); }
@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); }
@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; }
@Override public Cursor swapCursor(Cursor c) { if (c != null) { alphaIndexer = new AlphabetIndexer(c, c.getColumnIndex(Contacts.DISPLAY_NAME), " ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } return super.swapCursor(c); }
@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); }
public ChooserItemsCursorAdapter(Context context) { super(context); mInflater = LayoutInflater.from(context); final String alphabet = context.getString(R.string.alphabet); mAlphabetIndexer = new AlphabetIndexer(null, 0, alphabet); // highlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHiglight); }
public SimpleItemCursorAdapter(Context context) { super(context, null, 0); mInflater = LayoutInflater.from(context); final String alphabet = context.getString(R.string.alphabet); mAlphabetIndexer = new AlphabetIndexer(null, 0, alphabet); highlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHiglight); }
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, 0, alphabet); dbHelper = DataBaseHelper.getInstance(context); // highlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHiglight); }
public EventsCursorAdapter(Context context) { super(context, null, 0); this.context = context; mInflater = LayoutInflater.from(context); final String alphabet = context.getString(R.string.alphabet); mAlphabetIndexer = new AlphabetIndexer(null, 0, alphabet); highlightTextSpan = new TextAppearanceSpan(context, R.style.searchTextHiglight); imageLoader = new BitmapLoaderAsyncTask(context, null, true, true); }
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); }
@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, new String[] { "display_name", "sort_key" }, null, null, "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, 1, alphabet); adapter.setIndexer(indexer); if (contacts.size() > 0) { setupContactsListView(); setAlpabetListener(); } }
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; } }; }
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); }
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); // } }
public SpeciesGroupListCursorAdapter(Context context, Cursor c, int flags) { super(context, c, flags); mAlphabetIndexer = new AlphabetIndexer(c, c.getColumnIndex(FieldGuideDatabase.SPECIES_GROUP), " ABCDEFGHIJKLMNOPQRTSUVWXYZ"); mAlphabetIndexer.setCursor(c); }
public SpeciesCursorAdapter(Context context, Cursor c, int flags) { super(context, c, flags); mAlphabetIndexer = new AlphabetIndexer(c, c.getColumnIndex(FieldGuideDatabase.SPECIES_GROUP), " ABCDEFGHIJKLMNOPQRTSUVWXYZ"); mAlphabetIndexer.setCursor(c); }
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(); } }
public MangaItemListCursorAdapter(Context context, int layout, Cursor c, String[] from, int[] to, int flags) { super(context, layout, c, from, to, flags); mInflater = LayoutInflater.from(context); imageLoader = ImageCacheManager.getInstance().getImageLoader(); if (c != null) { mAlphaIndexer = new AlphabetIndexer(c, c.getColumnIndex(Manga.TITLE_COLUMN_NAME), " -0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } }
public Cursor swapCursor(Cursor c) { Cursor mCursor = getCursor(); if (mCursor != null) { mCursor.close(); } // Create our indexer if (c != null) { mAlphaIndexer = new AlphabetIndexer(c, c.getColumnIndex(Manga.TITLE_COLUMN_NAME), " -0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ"); } notifyDataSetChanged(); return super.swapCursor(c); }