当前位置: 首页>>代码示例>>Java>>正文


Java LoaderCallbacks类代码示例

本文整理汇总了Java中android.support.v4.app.LoaderManager.LoaderCallbacks的典型用法代码示例。如果您正苦于以下问题:Java LoaderCallbacks类的具体用法?Java LoaderCallbacks怎么用?Java LoaderCallbacks使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


LoaderCallbacks类属于android.support.v4.app.LoaderManager包,在下文中一共展示了LoaderCallbacks类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: initLoader

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
public <D> Loader<D> initLoader(int id, Bundle args, LoaderCallbacks<D> callback) {
    if (this.mCreatingLoader) {
        throw new IllegalStateException("Called while creating a loader");
    }
    LoaderInfo info = (LoaderInfo) this.mLoaders.get(id);
    if (DEBUG) {
        Log.v(TAG, "initLoader in " + this + ": args=" + args);
    }
    if (info == null) {
        info = createAndInstallLoader(id, args, callback);
        if (DEBUG) {
            Log.v(TAG, "  Created new loader " + info);
        }
    } else {
        if (DEBUG) {
            Log.v(TAG, "  Re-using existing loader " + info);
        }
        info.mCallbacks = callback;
    }
    if (info.mHaveData && this.mStarted) {
        info.callOnLoadFinished(info.mLoader, info.mData);
    }
    return info.mLoader;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:25,代码来源:LoaderManagerImpl.java

示例2: startDownload

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
private final void startDownload() {
    final Bundle bundle = new Bundle();

    // 認証情報をキャッシュしていないか、確認する.
    final Uri uri = Uri.parse(mAddress);
    final HttpClientLoaderCallbacks.AuthData authData = BasicAuthManager.getInstance().getAuthData(uri.getHost());
    HttpClientLoaderCallbacks.setAuthDataToBundle(bundle, authData);

    // アドレスを設定しておく.
    bundle.putString(ImageFileDownloadLoaderCallbacks.KEY_ADDRESS, mAddress);

    // ファイルをダウンロードする.
    final LoaderCallbacks<ImageFileBase> loaderCallbacks = new ImageFileDownloadLoaderCallbacks(ImagePageFragment.this) {
        @Override
        protected void onAuthorizationRequired(String message) {
            final DialogFragment dialog = BasicAuthorizeDialogFragment.newInstance(message);
            dialog.show(getChildFragmentManager(), TAG_AUTHORIZE);
        }
    };
    getLoaderManager().initLoader(R.id.cached_image_loader, bundle, loaderCallbacks);
}
 
开发者ID:ueryu,项目名称:Android_AlbumViewer,代码行数:22,代码来源:ImagePageFragment.java

示例3: createAndInstallLoader

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
private LoaderInfo createAndInstallLoader(int id, Bundle args, LoaderCallbacks<Object> callback) {
    try {
        this.mCreatingLoader = true;
        LoaderInfo info = createLoader(id, args, callback);
        installLoader(info);
        return info;
    } finally {
        this.mCreatingLoader = false;
    }
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:11,代码来源:LoaderManagerImpl.java

示例4: onLoaderReset

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
@Override
public void onLoaderReset(Loader<Cursor> loader) {
    LoaderManager.LoaderCallbacks<Cursor> parent = getSearchResultFragmentLoaderCallbacks();
    if (parent != null) parent.onLoaderReset(loader);

    //((CursorAdapter) getListAdapter()).swapCursor(null);
    ((CursorAdapter) getListAdapter()).changeCursor(null);
}
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:9,代码来源:AllDataListFragment.java

示例5: onLoadFinished

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
@Override
    public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
        LoaderManager.LoaderCallbacks<Cursor> parent = getSearchResultFragmentLoaderCallbacks();
        if (parent != null) parent.onLoadFinished(loader, data);

        switch (loader.getId()) {
            case ID_LOADER_ALL_DATA_DETAIL:
                // Transactions list loaded.
                AllDataAdapter adapter = (AllDataAdapter) getListAdapter();
//                adapter.swapCursor(data);
                adapter.changeCursor(data);
                if (isResumed()) {
                    setListShown(true);
                    if (data != null && data.getCount() <= 0 && getFloatingActionButton() != null)
                        getFloatingActionButton().show(true);
                } else {
                    setListShownNoAnimation(true);
                }

                // reset the transaction groups (account name collection)
                adapter.resetAccountHeaderIndexes();

                // Show totals
                if (this.mShowFooter) {
                    try {
                        this.updateFooter(data);
                    } catch (Exception e) {
                        Timber.e(e, "displaying footer");
                    }
                }
        }
    }
 
开发者ID:moneymanagerex,项目名称:android-money-manager-ex,代码行数:33,代码来源:AllDataListFragment.java

示例6: startDownload

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
/**
 * ダウンロードを開始する.
 * 
 * @param downloader ダウンローダ.
 */
private void startDownload(final DownloaderBase downloader) {
    final String address = downloader.getAddress(0);
    final Bundle bundle = new Bundle();

    // 認証情報をキャッシュしていないか、確認する.
    final Uri uri = Uri.parse(address);
    final HttpClientLoaderCallbacks.AuthData authData = BasicAuthManager.getInstance().getAuthData(uri.getHost());
    HttpClientLoaderCallbacks.setAuthDataToBundle(bundle, authData);

    // アドレスを設定しておく.
    bundle.putString(ImageFileDownloadLoaderCallbacks.KEY_ADDRESS, address);

    // ファイルをダウンロードする.
    final LoaderCallbacks<ImageFileBase> loaderCallbacks = new ImageFileDownloadLoaderCallbacks(ImageViewerFragment.this) {
        @Override
        protected void onAuthorizationRequired(String message) {
            final DialogFragment dialog = BasicAuthorizeDialogFragment.newInstance(message);
            dialog.show(getChildFragmentManager(), TAG_AUTHORIZE);
        }

        @Override
        protected void onHttpClientLoadFinished(HttpClientLoader<ImageFileBase> loader, ImageFileBase imageFile) {
            super.onHttpClientLoadFinished(loader, imageFile);

            if (imageFile != null) {
                // ViewPagerにページをセットする.
                mViewPager.setAdapter(new AlbumPagerAdapter(getActivity(), downloader));
            }
        }

    };

    getLoaderManager().initLoader(R.id.cached_image_loader, bundle, loaderCallbacks);
}
 
开发者ID:ueryu,项目名称:Android_AlbumViewer,代码行数:40,代码来源:ImageViewerFragment.java

示例7: RepositoriesLoadable

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
RepositoriesLoadable(LoaderManager loaderManager, int loaderId,
        LoaderCallbacks<Result<Repositories>> callbacks) {
    super();
    this.mLoaderManager = Preconditions.checkNotNull(loaderManager);
    this.mLoaderId = loaderId;
    this.mCallbacks = callbacks;
}
 
开发者ID:wuman,项目名称:android-oauth-client,代码行数:8,代码来源:RepositoriesLoadable.java

示例8: TweetsLoadable

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
TweetsLoadable(LoaderManager loaderManager, int loaderId,
        LoaderCallbacks<Result<Timeline>> callbacks) {
    super();
    this.mLoaderManager = Preconditions.checkNotNull(loaderManager);
    this.mLoaderId = loaderId;
    this.mCallbacks = callbacks;
}
 
开发者ID:wuman,项目名称:android-oauth-client,代码行数:8,代码来源:TweetsLoadable.java

示例9: PhotosLoadable

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
PhotosLoadable(LoaderManager loaderManager, int loaderId,
        LoaderCallbacks<Result<ContactsPhotos>> callbacks) {
    super();
    this.mLoaderManager = Preconditions.checkNotNull(loaderManager);
    this.mLoaderId = loaderId;
    this.mCallbacks = callbacks;
}
 
开发者ID:wuman,项目名称:android-oauth-client,代码行数:8,代码来源:PhotosLoadable.java

示例10: LoadableDecorator

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
public LoadableDecorator(LoaderCallbacks<Result<T>> callbacks, int loaderId,
        ListFragment listFragment) {
    super();
    this.mCallbacks = Preconditions.checkNotNull(callbacks);
    this.mLoaderId = loaderId;
    this.mListFragment = Preconditions.checkNotNull(listFragment);
    this.mAdapterView = Preconditions.checkNotNull(listFragment.getListView());

    mListFragment.setListShown(false);
}
 
开发者ID:wuman,项目名称:android-oauth-client,代码行数:11,代码来源:LoadableDecorator.java

示例11: PlurksLoadable

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
PlurksLoadable(LoaderManager loaderManager, int loaderId,
        LoaderCallbacks<Result<Timeline>> callbacks) {
    super();
    this.mLoaderManager = Preconditions.checkNotNull(loaderManager);
    this.mLoaderId = loaderId;
    this.mCallbacks = callbacks;
}
 
开发者ID:wuman,项目名称:android-oauth-client,代码行数:8,代码来源:PlurksLoadable.java

示例12: LiveFragment

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
public LiveFragment() {
    if (HotFix.PREVENT_VERIFY) {
        System.out.println(VerifyLoad.class);
    }
    this.SCROLL_LEFT = 1;
    this.SCROLL_RIGTH = -1;
    this.mLiveList = new ArrayList();
    this.mGotoChildPageIndex = -1;
    this.mRefreshData = new RefreshData(this) {
        final /* synthetic */ LiveFragment this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void refreshData() {
            this.this$0.mRootView.loading(false);
            this.this$0.getData();
        }
    };
    this.mBookLoaderCallback = new LoaderCallbacks<Cursor>(this) {
        final /* synthetic */ LiveFragment this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public Loader<Cursor> onCreateLoader(int id, Bundle args) {
            return new CursorLoader(this.this$0.getContext(), LetvContentProvider.URI_LIVEBOOKTRACE, null, null, null, null);
        }

        public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
            if (cursor != null) {
                Set<String> mBookedPrograms = new HashSet();
                while (cursor.moveToNext()) {
                    try {
                        int idx = cursor.getColumnIndexOrThrow(Field.MD5_ID);
                        if (idx != -1) {
                            mBookedPrograms.add(cursor.getString(idx));
                        }
                    } catch (SQLiteException e) {
                        e.printStackTrace();
                        return;
                    }
                }
                if (this.this$0.mLiveAdapter != null) {
                    this.this$0.mLiveAdapter.setBookedPrograms(mBookedPrograms);
                }
            }
        }

        public void onLoaderReset(Loader<Cursor> loader) {
        }
    };
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:62,代码来源:LiveFragment.java

示例13: LiveSubTypeActivity

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
public LiveSubTypeActivity() {
    if (HotFix.PREVENT_VERIFY) {
        System.out.println(VerifyLoad.class);
    }
    this.mData = new ArrayList();
    this.mLunboData = new ArrayList();
    this.mPrograms = new HashMap();
    this.mCurrentActionType = 1;
    this.mBookLoaderCallback = new LoaderCallbacks<Cursor>(this) {
        final /* synthetic */ LiveSubTypeActivity this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public Loader<Cursor> onCreateLoader(int id, Bundle args) {
            return new CursorLoader(this.this$0, LetvContentProvider.URI_LIVEBOOKTRACE, null, null, null, null);
        }

        public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
            if (cursor != null) {
                Set<String> mBookedPrograms = new HashSet();
                while (cursor.moveToNext()) {
                    try {
                        int idx = cursor.getColumnIndexOrThrow(Field.MD5_ID);
                        if (idx != -1) {
                            mBookedPrograms.add(cursor.getString(idx));
                        }
                    } catch (Exception e) {
                        e.printStackTrace();
                        return;
                    }
                }
                if (this.this$0.mRoomAdapter != null) {
                    this.this$0.mRoomAdapter.setBookedPrograms(mBookedPrograms);
                }
            }
        }

        public void onLoaderReset(Loader<Cursor> loader) {
        }
    };
    this.mRefreshData = new RefreshData(this) {
        final /* synthetic */ LiveSubTypeActivity this$0;

        {
            if (HotFix.PREVENT_VERIFY) {
                System.out.println(VerifyLoad.class);
            }
            this.this$0 = this$0;
        }

        public void refreshData() {
            this.this$0.mRootView.loading(false);
            this.this$0.getData();
        }
    };
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:62,代码来源:LiveSubTypeActivity.java

示例14: LoaderInfo

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
public LoaderInfo(int id, Bundle args, LoaderCallbacks<Object> callbacks) {
    this.mId = id;
    this.mArgs = args;
    this.mCallbacks = callbacks;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:6,代码来源:LoaderManagerImpl.java

示例15: createLoader

import android.support.v4.app.LoaderManager.LoaderCallbacks; //导入依赖的package包/类
private LoaderInfo createLoader(int id, Bundle args, LoaderCallbacks<Object> callback) {
    LoaderInfo info = new LoaderInfo(id, args, callback);
    info.mLoader = callback.onCreateLoader(id, args);
    return info;
}
 
开发者ID:JackChan1999,项目名称:letv,代码行数:6,代码来源:LoaderManagerImpl.java


注:本文中的android.support.v4.app.LoaderManager.LoaderCallbacks类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。