當前位置: 首頁>>代碼示例>>Java>>正文


Java LoaderCallbacks類代碼示例

本文整理匯總了Java中android.app.LoaderManager.LoaderCallbacks的典型用法代碼示例。如果您正苦於以下問題:Java LoaderCallbacks類的具體用法?Java LoaderCallbacks怎麽用?Java LoaderCallbacks使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


LoaderCallbacks類屬於android.app.LoaderManager包,在下文中一共展示了LoaderCallbacks類的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: onActivityCreated

import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    final Context context = getActivity();

    mAdapter = new DocumentStackAdapter();
    mListView.setAdapter(mAdapter);

    final RootsCache roots = DocumentsApplication.getRootsCache(context);
    final State state = ((BaseActivity) getActivity()).getDisplayState();

    mCallbacks = new LoaderCallbacks<List<DocumentStack>>() {
        @Override
        public Loader<List<DocumentStack>> onCreateLoader(int id, Bundle args) {
            return new RecentsCreateLoader(context, roots, state);
        }

        @Override
        public void onLoadFinished(
                Loader<List<DocumentStack>> loader, List<DocumentStack> data) {
            mAdapter.swapStacks(data);

            if (isResumed()) {
                setListShown(true);
            } else {
                setListShownNoAnimation(true);
            }
            // When launched into empty recents, show drawer
            if (mAdapter.isEmpty() && !state.stackTouched) {
                ((BaseActivity) context).setRootsDrawerOpen(true);
            }
        }

        @Override
        public void onLoaderReset(Loader<List<DocumentStack>> loader) {
            mAdapter.swapStacks(null);
        }
    };

    setListAdapter(mAdapter);
    setListShown(false);
    getLoaderManager().restartLoader(LOADER_RECENTS, getArguments(), mCallbacks);
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:45,代碼來源:RecentsCreateFragment.java

示例2: onActivityCreated

import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if(null != savedInstanceState) {
        group_size = savedInstanceState.getInt(GROUP_SIZE, 0);
        expandedIds = (ArrayList<Long>) savedInstanceState.getSerializable(GROUP_IDS);
    }

    final Context context = getActivity();
    final RootsCache roots = DocumentsApplication.getRootsCache(context);
    final State state = ((BaseActivity) context).getDisplayState();

    mCallbacks = new LoaderCallbacks<Collection<RootInfo>>() {
        @Override
        public Loader<Collection<RootInfo>> onCreateLoader(int id, Bundle args) {
            return new RootsLoader(context, roots, state);
        }

        @Override
        public void onLoadFinished(
                Loader<Collection<RootInfo>> loader, Collection<RootInfo> result) {
            if (!isAdded()) return;

            final Intent includeApps = getArguments().getParcelable(EXTRA_INCLUDE_APPS);

            if (mAdapter == null) {
                mAdapter = new RootsExpandableAdapter(context, result, includeApps);
                Parcelable state = mList.onSaveInstanceState();
                mList.setAdapter(mAdapter);
                mList.onRestoreInstanceState(state);
            } else {
                mAdapter.setData(result);
            }

            int groupCount = mAdapter.getGroupCount();
            if(group_size != 0 && group_size == groupCount){
                if (expandedIds != null) {
                    restoreExpandedState(expandedIds);
                }
            } else {
                group_size = groupCount;
                for (int i = 0; i < group_size; i++) {
                    mList.expandGroup(i);
                }
                expandedIds = getExpandedIds();
                mList.setOnGroupExpandListener(mOnGroupExpandListener);
                mList.setOnGroupCollapseListener(mOnGroupCollapseListener);
            }
        }

        @Override
        public void onLoaderReset(Loader<Collection<RootInfo>> loader) {
            mAdapter = null;
            mList.setAdapter((RootsExpandableAdapter)null);
        }
    };
}
 
開發者ID:kranthi0987,項目名稱:easyfilemanager,代碼行數:58,代碼來源:RootsFragment.java

示例3: initialiseExistingFormList

import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
private void initialiseExistingFormList() {
    FormAdapter adapter = new FormAdapter(this.getApplicationContext(), null, this);
    setListAdapter(adapter);
    getLoaderManager().initLoader(0, null, (LoaderCallbacks<Cursor>) this);
}
 
開發者ID:benetech,項目名稱:Secure-App-Generator,代碼行數:6,代碼來源:MainActivity.java

示例4: execute

import android.app.LoaderManager.LoaderCallbacks; //導入依賴的package包/類
@Override
public void execute(final Query request, final QueryListener listener) {
	final LoaderCallbacks<?> callbacks = new QueryLoaderCallbacks(listener);
	execute(request, callbacks);
}
 
開發者ID:cfmobile,項目名稱:arca-android,代碼行數:6,代碼來源:ModernRequestDispatcher.java


注:本文中的android.app.LoaderManager.LoaderCallbacks類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。