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


Java LoaderManager类代码示例

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


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

示例1: onCreate

import android.app.LoaderManager; //导入依赖的package包/类
@Override
protected void onCreate(Bundle savedInstanceState) {
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(this);
    String themes = sharedPrefs.getString(
            getString(R.string.settings_themes_key),
            getString(R.string.settings_themes_default));
    switch (themes) {
        case "dark":
            setTheme(R.style.AppTheme);
            break;
        case "light":
            setTheme(R.style.AppTheme_Light);
    }
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    LoaderManager loaderManager = getLoaderManager();
    loaderManager.initLoader(0, null, this);
    MapFragment mapFragment = (MapFragment) getFragmentManager().findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

}
 
开发者ID:rahul051296,项目名称:quake-alert-android-app,代码行数:22,代码来源:MapsActivity.java

示例2: onMapReady

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onMapReady(GoogleMap googleMap) {
    mMap = googleMap;
    mMap.setIndoorEnabled(true);
    mMap.setMyLocationEnabled(false);
    mMap.setOnMarkerClickListener(this);
    mMap.setOnIndoorStateChangeListener(this);
    mMap.setOnMapClickListener(this);
    UiSettings mapUiSettings = mMap.getUiSettings();
    mapUiSettings.setZoomControlsEnabled(false);
    mapUiSettings.setMapToolbarEnabled(false);

    // load all markers
    LoaderManager lm = getLoaderManager();
    lm.initLoader(TOKEN_LOADER_MARKERS, null, mMarkerLoader).forceLoad();

    // load the tile overlays
    lm.initLoader(TOKEN_LOADER_TILES, null, mTileLoader).forceLoad();

    setupMap(true);
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:22,代码来源:MapFragment.java

示例3: onActivityCreated

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    messageHelper = MessageHelper.getInstance(getActivity());

    initializeMessageList();

    // This needs to be done before initializing the cursor loader below
    initializeSortSettings();

    loaderJustInitialized = true;
    LoaderManager loaderManager = getLoaderManager();
    int len = accountUuids.length;
    cursors = new Cursor[len];
    cursorValid = new boolean[len];
    for (int i = 0; i < len; i++) {
        loaderManager.initLoader(i, null, this);
        cursorValid[i] = false;
    }
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:22,代码来源:MessageListFragment.java

示例4: RecipientPresenter

import android.app.LoaderManager; //导入依赖的package包/类
public RecipientPresenter(Context context, LoaderManager loaderManager,
        RecipientMvpView recipientMvpView, Account account, ComposePgpInlineDecider composePgpInlineDecider,
        ComposePgpEnableByDefaultDecider composePgpEnableByDefaultDecider,
        AutocryptStatusInteractor autocryptStatusInteractor,
        ReplyToParser replyToParser, RecipientsChangedListener recipientsChangedListener) {
    this.recipientMvpView = recipientMvpView;
    this.context = context;
    this.autocryptStatusInteractor = autocryptStatusInteractor;
    this.composePgpInlineDecider = composePgpInlineDecider;
    this.composePgpEnableByDefaultDecider = composePgpEnableByDefaultDecider;
    this.replyToParser = replyToParser;
    this.listener = recipientsChangedListener;

    recipientMvpView.setPresenter(this);
    recipientMvpView.setLoaderManager(loaderManager);
    onSwitchAccount(account);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:18,代码来源:RecipientPresenter.java

示例5: setUp

import android.app.LoaderManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Context context = ShadowApplication.getInstance().getApplicationContext();
    Robolectric.getBackgroundThreadScheduler().pause();

    recipientMvpView = mock(RecipientMvpView.class);
    account = mock(Account.class);
    composePgpInlineDecider = mock(ComposePgpInlineDecider.class);
    composePgpEnableByDefaultDecider = mock(ComposePgpEnableByDefaultDecider.class);
    autocryptStatusInteractor = mock(AutocryptStatusInteractor.class);
    replyToParser = mock(ReplyToParser.class);
    LoaderManager loaderManager = mock(LoaderManager.class);
    listener = mock(RecipientPresenter.RecipientsChangedListener.class);

    recipientPresenter = new RecipientPresenter(
            context, loaderManager, recipientMvpView, account, composePgpInlineDecider,
            composePgpEnableByDefaultDecider, autocryptStatusInteractor, replyToParser, listener);
    runBackgroundTask();

    noRecipientsAutocryptResult = new RecipientAutocryptStatus(RecipientAutocryptStatusType.NO_RECIPIENTS, null);
}
 
开发者ID:philipwhiuk,项目名称:q-mail,代码行数:22,代码来源:RecipientPresenterTest.java

示例6: onChange

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onChange(boolean selfChange) {
    if (!isAdded()) {
        return;
    }

    //clear map reload all data
    clearMap();
    setupMap(false);

    // reload data from loaders
    LoaderManager lm = getActivity().getLoaderManager();

    Loader<Cursor> loader =
            lm.getLoader(TOKEN_LOADER_MARKERS);
    if (loader != null) {
        loader.forceLoad();
    }

    loader = lm.getLoader(TOKEN_LOADER_TILES);
    if (loader != null) {
        loader.forceLoad();
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:25,代码来源:MapFragment.java

示例7: onActivityCreated

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mLoaderIdlingResource =
            new LoaderIdlingResource(getClass().getName() + "/" + getId(), getLoaderManager());

    // Load data queries if any.
    if (mInitialQueriesToLoad != null && mInitialQueriesToLoad.length > 0) {
        LoaderManager manager = getLoaderManager();
        for (int i = 0; i < mInitialQueriesToLoad.length; i++) {
            manager.initLoader(mInitialQueriesToLoad[i].getId(), null, this);
        }
    } else {
        // No data query to load, update the view.
        mUpdatableView.displayData(mModel, null);
    }
}
 
开发者ID:dreaminglion,项目名称:iosched-reader,代码行数:19,代码来源:PresenterFragmentImpl.java

示例8: setUp

import android.app.LoaderManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    mockStatic(Base64.class);
    PowerMockito.when(Base64.encodeToString(any(byte[].class), any(Integer.class))).thenAnswer(invocation -> {
        byte[] bytes = (byte[]) invocation.getArguments()[0];
        return new String(bytes);
    });

    mPreferences = new SharedPreferencesMapImpl();
    mContext = RxUtils.rxContext();
    when(mContext.getSharedPreferences(anyString(), anyInt())).thenReturn(mPreferences);

    LoaderManager lm = RxUtils.rxLoaderManager();

    mView = mock(LogInView.class);
    doNothing().when(mView).openRepositoriesScreen();
    doNothing().when(mView).showLoginError();
    doNothing().when(mView).showPasswordError();
    mPresenter = new LogInPresenter(mContext, lm, mView);
}
 
开发者ID:ArturVasilov,项目名称:AndroidArchitecture,代码行数:21,代码来源:LogInPresenterTest.java

示例9: setUp

import android.app.LoaderManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    Context context = RxUtils.rxContext();
    LoaderManager loaderManager = RxUtils.rxLoaderManager();

    mView = mock(RepositoriesView.class);
    doNothing().when(mView).showLoading();
    doNothing().when(mView).hideLoading();
    doNothing().when(mView).showError();
    doNothing().when(mView).showRepositories(anyList());
    doNothing().when(mView).showCommits(any(Repository.class));

    RepositoriesRepository repository = new TestRepositoryImpl(
            generateRepositories(15));
    mPresenter = new RepositoriesPresenter(context, loaderManager,
            mView, repository);
}
 
开发者ID:ArturVasilov,项目名称:AndroidArchitecture,代码行数:18,代码来源:RepositoriesPresenterTest.java

示例10: setUp

import android.app.LoaderManager; //导入依赖的package包/类
@Before
public void setUp() throws Exception {
    mView = Mockito.mock(WalkthroughView.class);
    Mockito.doNothing().when(mView).showBenefit(anyInt());
    Mockito.doNothing().when(mView).setActionButtonText(anyInt());
    Mockito.doNothing().when(mView).showLoadingSplash();
    Mockito.doNothing().when(mView).showError();
    Mockito.doNothing().when(mView).finishWalkthrough();

    Context context = MockUtils.mockContext();
    LoaderManager lm = MockUtils.mockLoaderManager();

    mPresenter = new WalkthroughPresenter(context, lm, mView);

    RepositoryProvider.setRemoteRepository(new TestRemoteRepository());
    RepositoryProvider.setKeyValueStorage(new TestKeyValueStorage());
}
 
开发者ID:ArturVasilov,项目名称:AndroidArchitecture,代码行数:18,代码来源:WalkthroughPresenterTest.java

示例11: testGet

import android.app.LoaderManager; //导入依赖的package包/类
@Test
public void testGet() throws Exception {
  //GIVEN
  Activity activity = Robolectric.buildActivity(Activity.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 SmoothieActivityModule(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, is(activity));
  assertThat(fragmentManager, notNullValue());
  assertThat(loaderManager, notNullValue());
  assertThat(layoutInflater, notNullValue());
}
 
开发者ID:stephanenicolas,项目名称:toothpick,代码行数:24,代码来源:SmoothieActivityModuleTest.java

示例12: testStartLoaderThatIsAlreadyInitialized

import android.app.LoaderManager; //导入依赖的package包/类
@Test
public void testStartLoaderThatIsAlreadyInitialized() {
	final Activity activity = Robolectric.buildActivity(TestActivity.class).create().start().resume().get();
	final FragmentManager fragmentManager = activity.getFragmentManager();
	final BaseFragment fragment = new TestFragment();
	fragmentManager.beginTransaction().add(fragment, null).commit();
	fragmentManager.executePendingTransactions();
	final LoaderManager loaderManager = fragment.getLoaderManager();
	final LoaderManager.LoaderCallbacks mockLoaderCallbacks = mock(LoaderManager.LoaderCallbacks.class);
	final Loader firstLoader = new CursorLoader(mApplication, Uri.EMPTY, null, null, null, null);
	final Loader secondLoader = new CursorLoader(mApplication, Uri.EMPTY, null, null, null, null);
	when(mockLoaderCallbacks.onCreateLoader(1, null)).thenReturn(firstLoader);
	loaderManager.initLoader(1, null, mockLoaderCallbacks);
	when(mockLoaderCallbacks.onCreateLoader(1, null)).thenReturn(secondLoader);
	assertThat(fragment.startLoader(1, null, mockLoaderCallbacks), is(secondLoader));
	assertThat(loaderManager.getLoader(1), is(secondLoader));
	loaderManager.destroyLoader(1);
}
 
开发者ID:universum-studios,项目名称:android_fragments,代码行数:19,代码来源:BaseFragmentTest.java

示例13: onActivityCreated

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    mMessageHelper = MessageHelper.getInstance(getActivity());

    initializeMessageList();

    // This needs to be done before initializing the cursor loader below
    initializeSortSettings();

    mLoaderJustInitialized = true;
    LoaderManager loaderManager = getLoaderManager();
    int len = mAccountUuids.length;
    mCursors = new Cursor[len];
    mCursorValid = new boolean[len];
    for (int i = 0; i < len; i++) {
        loaderManager.initLoader(i, null, this);
        mCursorValid[i] = false;
    }
}
 
开发者ID:scoute-dich,项目名称:K9-MailClient,代码行数:22,代码来源:MessageListFragment.java

示例14: onChange

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onChange(boolean selfChange) {
    if (!isAdded()) {
        return;
    }

    //clear map reload all data
    clearMap();
    setupMap(false);

    // reload data from loaders
    LoaderManager lm = getActivity().getLoaderManager();
    mMarkersLoaded = false;
    mOverlaysLoaded = false;

    Loader<Cursor> loader =
            lm.getLoader(MarkerQuery._TOKEN);
    if (loader != null) {
        loader.forceLoad();
    }

    loader = lm.getLoader(OverlayQuery._TOKEN);
    if (loader != null) {
        loader.forceLoad();
    }
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:27,代码来源:MapFragment.java

示例15: onCreate

import android.app.LoaderManager; //导入依赖的package包/类
@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    final String chosenAccountName = AccountUtils.getActiveAccountName(getActivity());
    mPlusClient = new PlusClient.Builder(getActivity(), this, this)
            .clearScopes()
            .setAccountName(chosenAccountName)
            .build();

    final Intent intent = BaseActivity.fragmentArgumentsToIntent(getArguments());
    mSessionUri = intent.getData();

    if (mSessionUri == null) {
        return;
    }

    mSessionId = ScheduleContract.Sessions.getSessionId(mSessionUri);

    mVariableHeightHeader = intent.getBooleanExtra(EXTRA_VARIABLE_HEIGHT_HEADER, false);

    LoaderManager manager = getLoaderManager();
    manager.restartLoader(0, null, this);

    setHasOptionsMenu(true);
}
 
开发者ID:The-WebOps-Club,项目名称:saarang-iosched,代码行数:26,代码来源:SessionFeedbackFragment.java


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