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


Java LoaderManager類代碼示例

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


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

示例1: CategoryController

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
CategoryController(final Activity activity, LoaderManager loaderManager, View itemView) {
    super(itemView);

    this.activity = activity;
    this.loaderManager = loaderManager;

    appCardsAdapter = new AppPreviewAdapter(activity);

    viewAll = (Button) itemView.findViewById(R.id.button);
    viewAll.setOnClickListener(onViewAll);

    heading = (TextView) itemView.findViewById(R.id.name);
    image = (FeatureImage) itemView.findViewById(R.id.category_image);
    background = (FrameLayout) itemView.findViewById(R.id.category_background);

    RecyclerView appCards = (RecyclerView) itemView.findViewById(R.id.app_cards);
    appCards.setAdapter(appCardsAdapter);
    appCards.addItemDecoration(new ItemDecorator(activity));

    displayImageOptions = new DisplayImageOptions.Builder()
            .cacheInMemory(true)
            .imageScaleType(ImageScaleType.NONE)
            .displayer(new FadeInBitmapDisplayer(100, true, true, false))
            .bitmapConfig(Bitmap.Config.RGB_565)
            .build();
}
 
開發者ID:uhuru-mobile,項目名稱:mobile-store,代碼行數:27,代碼來源:CategoryController.java

示例2: onCreate

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
@Override
public void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    Utils.logD(LOG_TAG, "onCreate");

    mSharedPreferences = new PreferencesManagerImp(getActivity().getApplicationContext());
    mLocation = mSharedPreferences.getLocation();
    if (savedInstanceState != null) {
        mRotation = true;
    }
    LoaderProvider loaderProvider = new LoaderProvider(getContext());
    LoaderManager loaderManager = getLoaderManager();
    Geocoder geocoder = new Geocoder(getActivity());
    // loaderManager.enableDebugLogging(true);
    mPresenter = new FindPresenter(mLocation, loaderManager, loaderProvider, geocoder);

    setHasOptionsMenu(true);
    mRecentSearchSuggestions = new SearchRecentSuggestions(getContext(),
            RecentSuggestionsProvider.AUTHORITY, RecentSuggestionsProvider.MODE);
    mCompositeSubscription = new CompositeSubscription();
    mActivityCoordinator = (CoordinatorLayout) getActivity().findViewById(R.id.coordinator);
    mSnackCoordinator = (CoordinatorLayout) getActivity().findViewById(R.id.coordinatorSnackContainer);
}
 
開發者ID:cahergil,項目名稱:Farmacias,代碼行數:24,代碼來源:FindFragment.java

示例3: 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

示例4: 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

示例5: 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

示例6: 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

示例7: search

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
private void search(EditText editText) {
    mEditText = editText;
    // Initialize the Loader with id '1239' and callbacks.
    // If the loader doesn't already exist, one is created. Otherwise,
    // the already created Loader is reused. In either case, the
    // LoaderManager will manage the Loader across the Activity/Fragment
    // lifecycle, will receive any new loads once they have completed,
    // and will report this new data back via callbacks.
    LoaderManager lm = getSupportLoaderManager();

    //close any loader that is already running
    lm.destroyLoader(LOADER_ID);

    //init new loader
    lm.initLoader(LOADER_ID, null, this);
}
 
開發者ID:kevalpatel2106,項目名稱:android-samples,代碼行數:17,代碼來源:MainActivity.java

示例8: testGet

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
@Test
public void testGet() throws Exception {
  //GIVEN
  FragmentActivity activity = Robolectric.buildActivity(FragmentActivity.class).create().get();
  Application application = RuntimeEnvironment.application;
  Scope appScope = Toothpick.openScope(application);
  appScope.installModules(new SmoothieApplicationModule(application));

  Scope activityScope = Toothpick.openScopes(application, activity);
  activityScope.installModules(new SmoothieSupportActivityModule(activity));

  //WHEN
  Activity injectedActivity = activityScope.getInstance(Activity.class);
  FragmentManager fragmentManager = activityScope.getInstance(FragmentManager.class);
  LoaderManager loaderManager = activityScope.getInstance(LoaderManager.class);
  LayoutInflater layoutInflater = activityScope.getInstance(LayoutInflater.class);

  //THEN
  assertThat(injectedActivity, instanceOf(FragmentActivity.class));
  assertThat((FragmentActivity) injectedActivity, sameInstance(activity));
  assertThat(fragmentManager, notNullValue());
  assertThat(loaderManager, notNullValue());
  assertThat(layoutInflater, notNullValue());
}
 
開發者ID:stephanenicolas,項目名稱:toothpick,代碼行數:25,代碼來源:SmoothieSupportActivityModuleTest.java

示例9: onActivityCreated

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

	Activity activity = getActivity();
	if (activity instanceof FloatingActionButtonProvider) {
		actionButton = ((FloatingActionButtonProvider) activity).getActionButton();
		if (actionButton != null) {
			actionButton.setOnClickListener(actionButtonClickListener);
		}
	}

	// Ensure the actionButton is initialized before creating the options menu
	setHasOptionsMenu(true);

	LoaderManager loaderManager = getLoaderManager();
	loaderManager.initLoader(BOOKMARK_STATUS_LOADER_ID, null, bookmarkStatusLoaderCallbacks);
	loaderManager.initLoader(EVENT_DETAILS_LOADER_ID, null, eventDetailsLoaderCallbacks);
}
 
開發者ID:sysdharma,項目名稱:py-eventos-android,代碼行數:20,代碼來源:EventDetailsFragment.java

示例10: 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

示例11: 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

示例12: 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

示例13: getLoaderManager

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
public LoaderManager getLoaderManager() {
    if (mPlugins.isEmpty()) {
        return getOriginal().super_getLoaderManager();
    }

    final ListIterator<FragmentPlugin> iterator = mPlugins.listIterator(mPlugins.size());

    final CallFun0<LoaderManager> superCall = new CallFun0<LoaderManager>(
            "getLoaderManager()") {

        @Override
        public LoaderManager call() {
            if (iterator.hasPrevious()) {
                return iterator.previous().getLoaderManager(this);
            } else {
                return getOriginal().super_getLoaderManager();
            }
        }
    };
    return superCall.call();
}
 
開發者ID:passsy,項目名稱:CompositeAndroid,代碼行數:22,代碼來源:FragmentDelegate.java

示例14: getLoaderManager

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
public android.app.LoaderManager getLoaderManager() {
    if (mPlugins.isEmpty()) {
        return getOriginal().super_getLoaderManager();
    }

    final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size());

    final CallFun0<android.app.LoaderManager> superCall
            = new CallFun0<android.app.LoaderManager>("getLoaderManager()") {

        @Override
        public android.app.LoaderManager call() {
            if (iterator.hasPrevious()) {
                return iterator.previous().getLoaderManager(this);
            } else {
                return getOriginal().super_getLoaderManager();
            }
        }
    };
    return superCall.call();
}
 
開發者ID:passsy,項目名稱:CompositeAndroid,代碼行數:22,代碼來源:ActivityDelegate.java

示例15: getSupportLoaderManager

import android.support.v4.app.LoaderManager; //導入依賴的package包/類
public LoaderManager getSupportLoaderManager() {
    if (mPlugins.isEmpty()) {
        return getOriginal().super_getSupportLoaderManager();
    }

    final ListIterator<ActivityPlugin> iterator = mPlugins.listIterator(mPlugins.size());

    final CallFun0<LoaderManager> superCall = new CallFun0<LoaderManager>(
            "getSupportLoaderManager()") {

        @Override
        public LoaderManager call() {
            if (iterator.hasPrevious()) {
                return iterator.previous().getSupportLoaderManager(this);
            } else {
                return getOriginal().super_getSupportLoaderManager();
            }
        }
    };
    return superCall.call();
}
 
開發者ID:passsy,項目名稱:CompositeAndroid,代碼行數:22,代碼來源:ActivityDelegate.java


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