androidx.cursoradapter.widget.CursorAdapter Java Examples
The following examples show how to use
androidx.cursoradapter.widget.CursorAdapter.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MediaStoreAdapter.java From libcommon with Apache License 2.0 | 6 votes |
/** * コンストラクタ * @param context * @param id_layout * @param refreshNow true: すぐにデータ取得要求する, false: refreshを呼ぶまでデータ取得しない */ public MediaStoreAdapter(@NonNull final Context context, @LayoutRes final int id_layout, final boolean refreshNow) { super(context, null, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); mContext = context; mInflater = LayoutInflater.from(context); mQueryHandler = new MyAsyncQueryHandler(context.getContentResolver(), this); // getMemoryClass return the available memory amounts for app as mega bytes(API >= 5) mLayoutId = id_layout; mThumbnailCache = new ThumbnailCache(context); mNeedValidate = true; if (refreshNow) { refresh(); } }
Example #2
Source File: SuperSearch.java From intra42 with Apache License 2.0 | 5 votes |
public static SimpleCursorAdapter setSearchSuggestionAdapter(Context context) { final String[] from = new String[]{"name"}; final int[] to = new int[]{android.R.id.text1}; SimpleCursorAdapter searchAdapter = new SimpleCursorAdapter(context, android.R.layout.simple_list_item_1, null, from, to, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); final MatrixCursor c = new MatrixCursor(new String[]{BaseColumns._ID, "name"}); for (int i = 0; i < SuperSearch.suggestions.length; i++) { c.addRow(new Object[]{i, SuperSearch.suggestions[i]}); } searchAdapter.changeCursor(c); return searchAdapter; }
Example #3
Source File: LogcatActivity.java From matlog with GNU General Public License v3.0 | 5 votes |
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_logcat); LogLine.isScrubberEnabled = PreferenceHelper.isScrubberEnabled(this); handleShortcuts(getIntent().getStringExtra("shortcut_action")); mHandler = new Handler(Looper.getMainLooper()); findViewById(R.id.fab).setOnClickListener(v -> DialogHelper.stopRecordingLog(LogcatActivity.this)); ((RecyclerView) findViewById(R.id.list)).setLayoutManager(new LinearLayoutManager(this)); ((RecyclerView) findViewById(R.id.list)).setItemAnimator(null); Toolbar toolbar = findViewById(R.id.toolbar_actionbar); toolbar.setOverflowIcon(AppCompatResources.getDrawable(this, R.drawable.ic_more_vert_24dp)); setSupportActionBar(toolbar); mCollapsedMode = !PreferenceHelper.getExpandedByDefaultPreference(this); mFilterPattern = PreferenceHelper.getFilterPatternPreference(this); log.d("initial collapsed mode is %s", mCollapsedMode); mSearchSuggestionsAdapter = new SimpleCursorAdapter(this, R.layout.list_item_dropdown, null, new String[]{"suggestion"}, new int[]{android.R.id.text1}, CursorAdapter.FLAG_REGISTER_CONTENT_OBSERVER); setUpAdapter(); updateBackgroundColor(); runUpdatesIfNecessaryAndShowWelcomeMessage(); }
Example #4
Source File: BlockedContactsActivity.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor data) { if (getListAdapter() != null) { ((CursorAdapter) getListAdapter()).changeCursor(data); } }
Example #5
Source File: BlockedContactsActivity.java From mollyim-android with GNU General Public License v3.0 | 4 votes |
@Override public void onLoaderReset(@NonNull Loader<Cursor> loader) { if (getListAdapter() != null) { ((CursorAdapter) getListAdapter()).changeCursor(null); } }