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


Java LoaderManager.getLoader方法代码示例

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


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

示例1: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(int listPosition, boolean markSeen, boolean showProgress) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    ConversationsLoaderCallbacks callbacks =
            new ConversationsLoaderCallbacks(getContext(), listView,
                    listPosition, cursorAdapter, markSeen, showProgress);

    LoaderManager manager = getLoaderManager();
    Loader<?> loader = manager.getLoader(loaderId);
    if (loader == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:20,代码来源:SMSConversationsListFragment.java

示例2: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(String itemsFilter, boolean deleteItems, int listPosition) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    JournalItemsLoaderCallbacks callbacks =
            new JournalItemsLoaderCallbacks(getContext(), cursorAdapter,
                    itemsFilter, deleteItems, listView, listPosition);
    LoaderManager manager = getLoaderManager();
    if (manager.getLoader(loaderId) == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:JournalFragment.java

示例3: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(int threadId, int unreadCount, int listPosition) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    ConversationLoaderCallbacks callbacks =
            new ConversationLoaderCallbacks(getContext(),
                    threadId, unreadCount, listView, listPosition, cursorAdapter);

    LoaderManager manager = getLoaderManager();
    if (manager.getLoader(loaderId) == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:19,代码来源:SMSConversationFragment.java

示例4: loadListViewItems

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void loadListViewItems(String itemsFilter, boolean deleteItems, int listPosition) {
    if (!isAdded()) {
        return;
    }
    int loaderId = 0;
    ContactsLoaderCallbacks callbacks =
            new ContactsLoaderCallbacks(getContext(), contactType, cursorAdapter,
                    itemsFilter, deleteItems, listView, listPosition);
    LoaderManager manager = getLoaderManager();
    if (manager.getLoader(loaderId) == null) {
        // init and run the items loader
        manager.initLoader(loaderId, null, callbacks);
    } else {
        // restart loader
        manager.restartLoader(loaderId, null, callbacks);
    }
}
 
开发者ID:kaliturin,项目名称:BlackList,代码行数:18,代码来源:ContactsFragment.java

示例5: startSearch

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, String tags, int page){
	noResults.setVisibility(View.GONE);
	Bundle args = new Bundle();
	args.putString(SearchActivity.TERMS, terms);
	args.putString(SearchActivity.TAGS, tags);
	args.putInt(SearchActivity.PAGE, page);
	LoaderManager lm = getLoaderManager();
	Loader l = lm.getLoader(page);
	if (l == null){
		lm.initLoader(page, args, this);
	}
	//Check if the terms and tags are different from what the loader has and restart if they're different
	else {
		RequestSearchAsyncLoader s = (RequestSearchAsyncLoader)l;
		if (!s.getTerms().equalsIgnoreCase(searchTerms) || !s.getTags().equalsIgnoreCase(tags)){
			lm.restartLoader(page, args, this);
		}
		else {
			lm.initLoader(page, args, this);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:23,代码来源:RequestSearchFragment.java

示例6: startSearch

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, int page){
	noResults.setVisibility(View.GONE);
	Bundle args = new Bundle();
	args.putString(SearchActivity.TERMS, terms);
	args.putInt(SearchActivity.PAGE, page);
	LoaderManager lm = getLoaderManager();
	Loader l = lm.getLoader(page);
	if (l == null){
		lm.initLoader(page, args, this);
	}
	//Check if the terms and tags are different from what the loader has and restart if they're different
	else {
		UserSearchAsyncLoader s = (UserSearchAsyncLoader)l;
		if (!s.getTerms().equalsIgnoreCase(searchTerms)){
			lm.restartLoader(page, args, this);
		}
		else {
			lm.initLoader(page, args, this);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:22,代码来源:UserSearchFragment.java

示例7: startSearch

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
private void startSearch(String terms, String tags, int page){
	noResults.setVisibility(View.GONE);
	Bundle args = new Bundle();
	args.putString(SearchActivity.TERMS, terms);
	args.putString(SearchActivity.TAGS, tags);
	args.putInt(SearchActivity.PAGE, page);
	LoaderManager lm = getLoaderManager();
	Loader l = lm.getLoader(page);
	if (l == null){
		lm.initLoader(page, args, this);
	}
	//Check if the terms and tags are different from what the loader has and restart if they're different
	else {
		TorrentSearchAsyncLoader s = (TorrentSearchAsyncLoader)l;
		if (!s.getTerms().equalsIgnoreCase(searchTerms) || !s.getTags().equalsIgnoreCase(tags)){
			lm.restartLoader(page, args, this);
		}
		else {
			lm.initLoader(page, args, this);
		}
	}
}
 
开发者ID:stuxo,项目名称:PTHAndroid,代码行数:23,代码来源:TorrentSearchFragment.java

示例8: initStartedLoaders

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
/**
 * Initialize already started loaders.
 */
void initStartedLoaders() {
  LoaderManager lm = operatorContext.loaderManager;
  SparseArray<LoaderCookies> listenersMap = this.listenersMap;

  int count = listenersMap.size();
  for (int i = 0; i < count; i++) {
    int loaderId = listenersMap.keyAt(i);
    Loader<?> loader = lm.getLoader(loaderId);
    if (loader != null && loader.isStarted()) {
      LoaderCookies cookies = listenersMap.valueAt(i);
      boolean notInit = (cookies.options & LoaderCookies.ALREADY_INIT) == 0;
      if (notInit) {
        Utils.initLoader(
            operatorContext,
            loaderId,
            STUB_PROVIDER,
            (cookies.options & LoaderCookies.DESTROY_ON_FINISH) == LoaderCookies.DESTROY_ON_FINISH,
            this
        );
      }
    }
  }
}
 
开发者ID:stanfy,项目名称:enroscar-async,代码行数:27,代码来源:LoaderDescription.java

示例9: onCreate

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
	super.onCreate(savedInstanceState);
	
	Activity activity = getActivity();
	
	AccountManager manager = AccountManager.get(activity);

	if (!User.isLoggedIn(manager)) {
		activity.setResult(Activity.RESULT_CANCELED);
		activity.finish();
	}
	
	LoaderManager loaders = getLoaderManager();
	if (loaders.getLoader(LOAD_AUTH_TOKEN) != null) {
		loaders.initLoader(LOAD_AUTH_TOKEN, null, mLoadAuthTokenCallbacks);
	}
}
 
开发者ID:almajeas,项目名称:RHITMobile-Android,代码行数:19,代码来源:AuthenticatedFragment.java

示例10: onActivityCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
public void onActivityCreated(final Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    PlansAdapter adapter = new PlansAdapter(getActivity(), now);
    setListAdapter(adapter);
    getListView().setOnItemLongClickListener(this);

    LoaderManager lm = getLoaderManager();
    if (lm.getLoader(uid) != null) {
        getLoaderManager().initLoader(uid, null, this);
    } else if (doDummy && now < 0L) {
        doDummy = false;
        getLoaderManager().initLoader(UID_DUMMY, null, this);
    }
}
 
开发者ID:felixb,项目名称:callmeter,代码行数:19,代码来源:PlansFragment.java

示例11: reLaunchOperations

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
public void reLaunchOperations(int loaderId) {

        AppCompatActivity activity = (AppCompatActivity)this.getContext();
        if (activity != null) {

            LoaderManager supportLoaderManager = activity.getSupportLoaderManager();
            if (supportLoaderManager.getLoader(loaderId) != null) {
                this.launchOperation();
            }
        }
    }
 
开发者ID:hipay,项目名称:hipay-fullservice-sdk-android,代码行数:12,代码来源:AbstractClient.java

示例12: onViewCreated

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    final FragmentActivity activity = getActivity();
    AbsListView list = ButterKnife.findById(view,android.R.id.list);
    list.setEmptyView(view.findViewById(android.R.id.empty));
    adapter = new MyPointsAdapter(activity, null);
    (list).setAdapter(adapter);
    LoaderManager loaderManager = activity.getSupportLoaderManager();
    if (loaderManager.getLoader(POINT_HISTORY_ID) == null) {
        loaderManager.initLoader(POINT_HISTORY_ID, null, this);
    } else {
        loaderManager.restartLoader(POINT_HISTORY_ID, null, this);
    }

    /**
     * убрал условие запроса не чаще, чем раз в PointsManger.isExpired(context)
     * пользователь не всегда догадыватеся сам обновить историю
     * полагает, что баллы не начислены и пишет в техподдержку
     */
    PointsManager.refreshPointHistory((BaseActivity) activity, new Response.Listener<Object>() {
        @Override
        public void onResponse(Object o) {
            processTitleBalance();
            processStatus();
            processPoints();
            processPointUnits();
        }
    }, null);

    processTitleBalance();
    processStatus();
    processPoints();
    processPointUnits();
}
 
开发者ID:active-citizen,项目名称:android.java,代码行数:36,代码来源:MyPointsFragment.java

示例13: attachProgressCallback

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
public static <TData, TProgress> void attachProgressCallback(LoaderManager loaderManager, int id, @NonNull ProgressPromiseLoaderCallbacks<TData, TProgress> loaderCallbacks) {
    final Loader<Result<TData>> loader = loaderManager.getLoader(id);
    if (loader == null) {
        return;
    }

    @SuppressWarnings("unchecked") final ProgressPromiseLoader<TData, TProgress> promiseLoader = (ProgressPromiseLoader<TData, TProgress>) loader;
    promiseLoader.attachLoaderCallbacks(loaderCallbacks);
}
 
开发者ID:loilo-inc,项目名称:loilo-promise,代码行数:10,代码来源:ProgressPromiseLoader.java

示例14: detachProgressCallback

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
public static <TData, TProgress> void detachProgressCallback(LoaderManager loaderManager, int id, @NonNull ProgressPromiseLoaderCallbacks<TData, TProgress> loaderCallbacks) {
    final Loader<Result<TData>> loader = loaderManager.getLoader(id);
    if (loader == null) {
        return;
    }

    @SuppressWarnings("unchecked") final ProgressPromiseLoader<TData, TProgress> promiseLoader = (ProgressPromiseLoader<TData, TProgress>) loader;
    promiseLoader.detachLoaderCallbacks(loaderCallbacks);
}
 
开发者ID:loilo-inc,项目名称:loilo-promise,代码行数:10,代码来源:ProgressPromiseLoader.java

示例15: cancelLoader

import android.support.v4.app.LoaderManager; //导入方法依赖的package包/类
public static void cancelLoader(LoaderManager loaderManager, int id) {
    final Loader<?> loader = loaderManager.getLoader(id);
    if (loader == null) {
        return;
    }
    loader.cancelLoad();
}
 
开发者ID:loilo-inc,项目名称:loilo-promise,代码行数:8,代码来源:PromiseLoader.java


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