本文整理汇总了Java中android.support.v4.content.Loader.getId方法的典型用法代码示例。如果您正苦于以下问题:Java Loader.getId方法的具体用法?Java Loader.getId怎么用?Java Loader.getId使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.support.v4.content.Loader
的用法示例。
在下文中一共展示了Loader.getId方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
try {
if (loader.getId() == R.id.nav_energy_use_day) {
data.setNotificationUri(getContentResolver(), OhaEnergyUseContract.CONTENT_URI_DAYS);
this.floatingActionButton.setImageResource(R.drawable.ic_add_alert_white);
} else if (loader.getId() == R.id.nav_energy_use_bill) {
data.setNotificationUri(getContentResolver(), CONTENT_URI_BILL);
this.floatingActionButton.setImageResource(R.drawable.ic_add_white);
}
this.ohaMainAdapter.swapCursor(data, loader.getId());
Animation animation = AnimationUtils.loadAnimation(this, R.anim.fab_button);
this.floatingActionButton.startAnimation(animation);
} finally {
this.swipeRefreshLayout.setRefreshing(false);
}
}
示例2: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(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);
}
}
示例3: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
/**
* Implement onLoadFinished(Loader loader, String s) from NetworkLoader.NetworkLoaderCallback
*
* @param loader Loader instance
* @param s responseString
*/
@Override
public void onLoadFinished(Loader loader, String s) {
switch (loader.getId()) {
case MOVIES_LOADER_ID:
MoviesResult moviesResult = (s == null) ? null : gson.fromJson(s, MoviesResult.class);
if (moviesResult == null || moviesResult.getResults() == null || moviesResult.getResults().isEmpty()) {
// If the first request failed then show error message hiding the content
// Otherwise stop loading further
if (mPage == START_PAGE) {
mContentLoadingUitl.error();
} else {
mAdapter.showLoading(false);
mAdapter.notifyDataSetChanged();
}
} else {
// For the first request change visibility of recyclerview
if (mPage == START_PAGE) {
mContentLoadingUitl.success();
}
this.mMediaList.addAll(moviesResult.getResults());
mAdapter.setMediaList(mMediaList);
}
break;
}
}
示例4: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
super.onLoadFinished(loader, cursor);
if(loader.getId()==SHOW_LOADER_ID) {
cursor.moveToFirst();
TvshowCursorMapper mTvShowMapper = new TvshowCursorMapper();
mTvShowMapper.bindColumns(cursor);
Tvshow newShow = (Tvshow) mTvShowMapper.bind(cursor);
if(needToReload(mShow, newShow)) {
mShow = newShow;
getArguments().putSerializable(EXTRA_SHOW_ITEM, mShow); //saving in arguments
if (mTvShowAsyncTask != null)
mTvShowAsyncTask.cancel(true);
mTvShowAsyncTask = new TvShowAsyncTask().executeOnExecutor(mSerialExecutor,getPosterUri(),mShow);
getActivity().invalidateOptionsMenu();
}
}
}
示例5: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader loader, Cursor cursor) {
if (cursor == null || !cursor.moveToFirst()) {
HTTPLoaderUtil.with(mContext).tryCall(new HTTPLoaderUtil.HTTPBlock() {
@Override
public void run() {
loadFromNetwork(URIBuilderUtils.buildMovieDetailsURL(String.valueOf(mResourceId)), MOVIE_DETAILS_LOADER_ID);
}
}).onNoNetwork(new HTTPLoaderUtil.HTTPBlock() {
@Override
public void run() {
DisplayUtils.setNoNetworkConnectionMessage(mContext, mBinding.textViewErrorMessage);
mContentLoadingUtil.error();
mCallbacks.hideFavBtn();
}
}).execute();
} else {
switch (loader.getId()) {
case LOCAL_MOVIE_DETAILS_LOADER_ID:
mMovieDetail = MovieDetail.fromCursor(cursor);
updateContent();
break;
}
}
}
示例6: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, loader, cursor);
if (mListAdapter == null) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, "adapter is null, view is destroyed?");
return;
}
switch (loader.getId()) {
case Loaders.DRAWER_FILTERS:
updateFromFiltersCursor(cursor);
updateAdapter();
break;
case Loaders.DRAWER_BOOKS:
updateFromBooksCursor(cursor);
updateAdapter();
break;
}
}
示例7: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
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();
}
}
示例8: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
switch (loader.getId()) {
case LOADER_CAN_UPDATE:
onCanUpdateLoadFinished(cursor);
break;
case LOADER_KNOWN_VULN:
onKnownVulnLoadFinished(cursor);
break;
}
populateItems();
notifyDataSetChanged();
}
示例9: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader loader, String s) {
switch (loader.getId()) {
case MOVIE_REVIEWS_LOADER_ID:
MovieReviewsResult movieReviewsResult = (s == null) ? null : gson.fromJson(s, MovieReviewsResult.class);
List<MovieReview> movieReviewList = (movieReviewsResult == null) ? null : movieReviewsResult.getResults();
updateReviewsUI(movieReviewList);
break;
}
}
示例10: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (loader.getId() == channelId) {
if (data != null && isAdded()) {
mAdapter.setCursor(data);
if (emptyListView != null ) {
emptyListView.setVisibility(data.getCount() == 0 ? View.VISIBLE : View.GONE);
}
if (swipeRefreshLayout != null) {
swipeRefreshLayout.setRefreshing(false);
}
}
}
}
示例11: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (loader.getId() == CATEGORIES_LOADER) {
if (data != null && isAdded()) {
mAdapter.setCursor(data);
if (emptyListView != null ) {
emptyListView.setVisibility(data.getCount() == 0 ? View.VISIBLE : View.GONE);
}
}
}
}
示例12: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if (loader.getId() == FAVORITE_LOADER) {
if (data != null && isAdded()) {
if (emptyListView != null ) {
emptyListView.setVisibility(data.getCount() == 0 ? View.VISIBLE : View.GONE);
emptyListView.setText(getString(R.string.empty_favorites_list));
}
mAdapter.setCursor(data);
}
}
}
示例13: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
if(loader.getId() == LOADER_RESULT) {
Utils.logD(LOG_TAG,"onLoadFinished_LOADER_RESULT");
Utils.logD(LOG_TAG,data.toString());
new Thread() {
@Override
public void run() {
bindView(data);
}
}.start();
}
if(loader.getId() == LOADER_QUICK_SEARCH) {
Utils.logD(LOG_TAG,"onLoadFinished_LOADER_QUICK_SEARCH");
new Thread() {
@Override
public void run() {
bindViewQuickSearch(data);
}
}.start();
}
}
示例14: onLoaderReset
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoaderReset(Loader<Cursor> cursorLoader) {
if (BuildConfig.LOG_DEBUG) LogUtils.d(TAG, cursorLoader);
if (mIsViewCreated) {
if (cursorLoader.getId() == Loaders.BOOK_FRAGMENT_NOTES) {
mListAdapter.changeCursor(null);
} else if (cursorLoader.getId() == Loaders.BOOK_FRAGMENT_BOOK) {
/* Nothing holds the cursor. */
}
}
}
示例15: onLoadFinished
import android.support.v4.content.Loader; //导入方法依赖的package包/类
@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
switch (loader.getId()) {
case LOADER_CHEESES:
mCheeseAdapter.setCheeses(data);
break;
}
}