Java Code Examples for android.support.v4.content.Loader#getId()
The following examples show how to use
android.support.v4.content.Loader#getId() .
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: RecordsListFragment.java From android-auto-call-recorder with MIT License | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { Log.d(TAG, "onLoadingFinished"); // CursorLogger.newInstance().log(data); switch (loader.getId()) { case 0: Log.d(TAG, "onLoadFinished: loading MORE"); if (onLoadingMore) { mergeCursor(data); } else { reloadCursor(data); } break; default: throw new IllegalArgumentException("no loader id handled!"); } }
Example 2
Source File: MyDownloadingFragment.java From letv with Apache License 2.0 | 6 votes |
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (loader.getId() == 1) { if (this.mListView.getVisibility() == 8) { this.mListView.setVisibility(0); } if (this.mDownloadAdapter != null) { this.mDownloadAdapter.changeCursor(data); } if (this.myDownloadActivity != null) { this.myDownloadActivity.updateStoreSpace(); } checkAdapterEmpty(data); if (!(this.mDownloadAdapter == null || !this.mDownloadAdapter.isEmpty() || this.myDownloadActivity == null || this.myDownloadActivity.isFinishing())) { this.myDownloadActivity.updateEditViewState(); } int mNewDownloadingNum = this.mDownloadAdapter.getCount(); if (this.mOldDownloadingNum != mNewDownloadingNum) { this.myDownloadActivity.showDownloadingNum(mNewDownloadingNum); } this.mOldDownloadingNum = mNewDownloadingNum; traversalAllDownloading(); } }
Example 3
Source File: NfcProvisioningFragment.java From android-NfcProvisioning with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Map<String, String>> loader, Map<String, String> values) { if (loader.getId() == LOADER_PROVISIONING_VALUES) { mProvisioningValues = values; //noinspection deprecation mEditPackageName.setText(values.get( DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_PACKAGE_NAME)); if (Build.VERSION.SDK_INT >= 23) { ComponentName name = ComponentName.unflattenFromString(values.get( DevicePolicyManager.EXTRA_PROVISIONING_DEVICE_ADMIN_COMPONENT_NAME)); mEditClassName.setText(name.getClassName()); } mEditLocale.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_LOCALE)); mEditTimezone.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_TIME_ZONE)); mEditWifiSsid.setText(values.get(DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SSID)); mEditWifiSecurityType.setText(values.get( DevicePolicyManager.EXTRA_PROVISIONING_WIFI_SECURITY_TYPE)); mEditWifiPassword.setText(values.get( DevicePolicyManager.EXTRA_PROVISIONING_WIFI_PASSWORD)); } }
Example 4
Source File: ClassifyFragment.java From android-galaxyzoo with GNU General Public License v3.0 | 6 votes |
@Override public void onLoadFinished(final Loader<Cursor> cursorLoader, final Cursor cursor) { if (cursorLoader.getId() != ClassifyFragment.LOADER_ID_NEXT_ID) { return; } mCursor = cursor; mGetNextInProgress = false; updateFromCursor(); // Avoid this being called twice, which seems to be an Android bug, // and which could cause us to get a different item ID if our virtual "next" item changes to // another item: // See http://stackoverflow.com/questions/14719814/onloadfinished-called-twice // and https://code.google.com/p/android/issues/detail?id=63179 getLoaderManager().destroyLoader(ClassifyFragment.LOADER_ID_NEXT_ID); }
Example 5
Source File: BooksPagerFragment.java From barterli_android with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (loader.getId() == Loaders.SEARCH_BOOKS_ON_PAGER) { mAdapter.swapCursor(cursor); if (cursor.getCount() > 0) { mBookDetailPager.setCurrentItem(mBookPosition); /* * Viewpager doesn't call on page selected() on the listener if the * set item is 0. This is to workaround that */ if (mBookPosition == 0 && cursor.getCount() > 0) { onPageSelected(mBookPosition); } } } }
Example 6
Source File: WhatsNewViewBinder.java From fdroidclient with GNU General Public License v3.0 | 6 votes |
@Override public void onLoadFinished(@NonNull Loader<Cursor> loader, Cursor cursor) { if (loader.getId() != LOADER_ID) { return; } whatsNewAdapter.setAppsCursor(cursor); if (whatsNewAdapter.getItemCount() == 0) { emptyState.setVisibility(View.VISIBLE); appList.setVisibility(View.GONE); explainEmptyStateToUser(); } else { emptyState.setVisibility(View.GONE); appList.setVisibility(View.VISIBLE); } }
Example 7
Source File: SimpleOAuth2ImplicitActivity.java From android-oauth-client with Apache License 2.0 | 6 votes |
@Override public void onLoadFinished(Loader<Result<Credential>> loader, Result<Credential> result) { if (loader.getId() == LOADER_GET_TOKEN) { message.setText(result.success ? result.data.getAccessToken() : ""); } else { message.setText(""); } if (result.success) { if (loader.getId() == LOADER_GET_TOKEN) { setButtonText(R.string.delete_token); } else { setButtonText(R.string.get_token); } } else { setButtonText(R.string.get_token); Crouton.makeText(getActivity(), result.errorMessage, Style.ALERT).show(); } getActivity().setProgressBarIndeterminateVisibility(false); button.setEnabled(true); }
Example 8
Source File: NavigationDrawerFragment.java From Woodmin with Apache License 2.0 | 6 votes |
@Override public void onLoaderReset(Loader<Cursor> cursorLoader) { Log.d(LOG_TAG, "onLoaderReset"); switch (cursorLoader.getId()) { case SHOP_LOADER: { TextView shopName = (TextView) mDrawerListView.findViewById(R.id.name); shopName.setText(""); TextView resume = (TextView) mDrawerListView.findViewById(R.id.resume); resume.setText(""); } break; default: break; } mAdapter.notifyDataSetChanged(); }
Example 9
Source File: CitiesFragment.java From sms-ticket with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Object> loader, Object data) { if (!isAdded()) { return; } if (loader.getId() == Constants.LOADER_CITIES) { mAdapter = new CitiesAdapter(c, (List<CitiesAdapter.Item>)data); vList.setAdapter(mAdapter); } }
Example 10
Source File: ProductsFragment.java From Woodmin with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { switch (cursorLoader.getId()) { case PRODUCT_LOADER: if(mSwipeLayout != null && !mLoading){ mSwipeLayout.setRefreshing(false); } mAdapter.changeCursor(cursor); break; default: break; } }
Example 11
Source File: CategoriesViewBinder.java From fdroidclient with GNU General Public License v3.0 | 5 votes |
/** * Reads all categories from the cursor and stores them in memory to provide to the {@link CategoryAdapter}. * * It does this so it is easier to deal with localized/unlocalized categories without having * to store the localized version in the database. It is not expected that the list of categories * will grow so large as to make this a performance concern. If it does in the future, the * {@link CategoryAdapter} can be reverted to wrap the cursor again, and localized category * names can be stored in the database (allowing sorting in their localized form). */ @Override public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) { if (loader.getId() != LOADER_ID || cursor == null) { return; } List<String> categoryNames = new ArrayList<>(cursor.getCount()); cursor.moveToFirst(); while (!cursor.isAfterLast()) { categoryNames.add(cursor.getString(cursor.getColumnIndex(Schema.CategoryTable.Cols.NAME))); cursor.moveToNext(); } Collections.sort(categoryNames, new Comparator<String>() { @Override public int compare(String categoryOne, String categoryTwo) { String localizedCategoryOne = CategoryController.translateCategory(activity, categoryOne); String localizedCategoryTwo = CategoryController.translateCategory(activity, categoryTwo); return localizedCategoryOne.compareTo(localizedCategoryTwo); } }); categoryAdapter.setCategories(categoryNames); if (categoryAdapter.getItemCount() == 0) { emptyState.setVisibility(View.VISIBLE); categoriesList.setVisibility(View.GONE); } else { emptyState.setVisibility(View.GONE); categoriesList.setVisibility(View.VISIBLE); } }
Example 12
Source File: MyBooksFragment.java From barterli_android with Apache License 2.0 | 5 votes |
@Override public void onLoaderReset(final Loader<Cursor> loader) { if (loader.getId() == Loaders.GET_MY_BOOKS) { mProfileBooksAdapter.swapCursor(null); mGridProfileBooks.setAdapter(null); } }
Example 13
Source File: SnapshotVmDetailGeneralFragment.java From moVirt with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (!data.moveToNext()) { Log.e(TAG, "Error loading data: id=" + loader.getId()); return; } switch (loader.getId()) { case SNAPSHOT_VMS_LOADER: vm = EntityMapper.forEntity(SnapshotVm.class).fromCursor(data); renderVm(vm); if (getLoaderManager().getLoader(CLUSTER_LOADER) == null) { getLoaderManager().initLoader(CLUSTER_LOADER, null, this); } break; case CLUSTER_LOADER: cluster = EntityMapper.forEntity(Cluster.class).fromCursor(data); renderCluster(cluster); if (cluster.getDataCenterId() == null) { renderDataCenter(null); } else if (getLoaderManager().getLoader(DATA_CENTER_LOADER) == null) { getLoaderManager().initLoader(DATA_CENTER_LOADER, null, this); } break; case DATA_CENTER_LOADER: DataCenter dataCenter = EntityMapper.forEntity(DataCenter.class).fromCursor(data); renderDataCenter(dataCenter); break; default: break; } }
Example 14
Source File: CustomersFragment.java From Woodmin with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { switch (cursorLoader.getId()) { case CUSTOMER_LOADER: if(mSwipeLayout != null){ mSwipeLayout.setRefreshing(false); } mAdapter.changeCursor(cursor); break; default: break; } }
Example 15
Source File: CustomersFragment.java From Woodmin with Apache License 2.0 | 5 votes |
@Override public void onLoaderReset(Loader<Cursor> cursorLoader) { Log.d(LOG_TAG, "onLoaderReset"); switch (cursorLoader.getId()) { case CUSTOMER_LOADER: mAdapter.notifyDataSetChanged(); break; default: break; } }
Example 16
Source File: ProductsFragment.java From Woodmin with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> cursorLoader, Cursor cursor) { switch (cursorLoader.getId()) { case PRODUCT_LOADER: if(mSwipeLayout != null && !mLoading){ mSwipeLayout.setRefreshing(false); } mAdapter.changeCursor(cursor); break; default: break; } }
Example 17
Source File: MainActivity.java From android-samples with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (loader.getId() == LOADER_ID) { // The asynchronous load is complete and the data // is now available for use. Only now can we associate // the queried Cursor with the SimpleCursorAdapter. if (mAdapter != null) mAdapter.swapCursor(data); } }
Example 18
Source File: MainActivity.java From ToDay with MIT License | 5 votes |
@Override public void onLoadFinished(Loader<Cursor> loader, Cursor data) { switch (loader.getId()) { case LOADER_CALENDARS: if (data != null && data.moveToFirst()) { mCalendarSelectionView.swapCursor(new CalendarCursor(data), mExcludedCalendarIds); } break; case LOADER_LOCAL_CALENDAR: if (data == null || data.getCount() == 0) { createLocalCalendar(); } break; } }
Example 19
Source File: AboutMeFragment.java From barterli_android with Apache License 2.0 | 5 votes |
@Override public void onLoadFinished(final Loader<Cursor> loader, final Cursor cursor) { if (loader.getId() == Loaders.USER_DETAILS_ABOUT_ME) { Logger.d(TAG, "Cursor Loaded with count: %d", cursor.getCount()); if (cursor.getCount() != 0) { cursor.moveToFirst(); mAboutMeTextView.setText(cursor.getString(cursor .getColumnIndex(DatabaseColumns.DESCRIPTION))); mPreferredLocationTextView .setText(String.format(mLocationFormat, cursor.getString(cursor .getColumnIndex(DatabaseColumns.NAME)), cursor .getString(cursor .getColumnIndex(DatabaseColumns.ADDRESS)))); if (mLoggedInUser) { mLabelReferralCount.setVisibility(View.VISIBLE); mReferralCountTextView.setVisibility(View.VISIBLE); mReferralCountTextView .setText(SharedPreferenceHelper .getString(R.string.pref_referrer_count)); mAboutMeTextView.setText(SharedPreferenceHelper .getString(R.string.pref_description)); mLogoutButton.setVisibility(View.VISIBLE); } else { mLabelReferralCount.setVisibility(View.GONE); mReferralCountTextView.setVisibility(View.GONE); mReferralCountTextView.setText(null); mLogoutButton.setVisibility(View.GONE); } } } }
Example 20
Source File: AlbumHalfFragment.java From letv with Apache License 2.0 | 4 votes |
public void onLoadFinished(Loader<Cursor> loader, Cursor data) { if (loader.getId() == LOADER_MANAGER_ID) { onDownLoadFinished(); } }