當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。