Search in sources :

Example 1 with LoaderManager

use of android.app.LoaderManager in project k-9 by k9mail.

the class RecipientPresenterTest method setUp.

@Before
public void setUp() throws Exception {
    Context context = ShadowApplication.getInstance().getApplicationContext();
    recipientMvpView = mock(RecipientMvpView.class);
    account = mock(Account.class);
    composePgpInlineDecider = mock(ComposePgpInlineDecider.class);
    replyToParser = mock(ReplyToParser.class);
    LoaderManager loaderManager = mock(LoaderManager.class);
    listener = mock(RecipientPresenter.RecipientsChangedListener.class);
    recipientPresenter = new RecipientPresenter(context, loaderManager, recipientMvpView, account, composePgpInlineDecider, replyToParser, listener);
    recipientPresenter.updateCryptoStatus();
}
Also used : Context(android.content.Context) Account(com.fsck.k9.Account) LoaderManager(android.app.LoaderManager) ComposePgpInlineDecider(com.fsck.k9.message.ComposePgpInlineDecider) ReplyToParser(com.fsck.k9.helper.ReplyToParser) Before(org.junit.Before)

Example 2 with LoaderManager

use of android.app.LoaderManager in project android_packages_apps_Settings by LineageOS.

the class InstalledAppDetails method onResume.

@Override
public void onResume() {
    super.onResume();
    if (mFinishing) {
        return;
    }
    AppItem app = new AppItem(mAppEntry.info.uid);
    app.addUid(mAppEntry.info.uid);
    if (mStatsSession != null) {
        LoaderManager loaderManager = getLoaderManager();
        loaderManager.restartLoader(LOADER_CHART_DATA, ChartDataLoader.buildArgs(getTemplate(getContext()), app), mDataCallbacks);
        loaderManager.restartLoader(LOADER_STORAGE, Bundle.EMPTY, this);
    }
    restartBatteryStatsLoader();
    if (mDevelopmentSettingsEnabler.getLastEnabledState()) {
        new MemoryUpdater().execute();
    }
    updateDynamicPrefs();
}
Also used : LoaderManager(android.app.LoaderManager) AppItem(com.android.settingslib.AppItem)

Example 3 with LoaderManager

use of android.app.LoaderManager in project android_packages_apps_Settings by LineageOS.

the class SearchFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    long startTime = System.currentTimeMillis();
    setHasOptionsMenu(true);
    final LoaderManager loaderManager = getLoaderManager();
    mSearchAdapter = new SearchResultsAdapter(this, mSearchFeatureProvider);
    mSavedQueryController = new SavedQueryController(getContext(), loaderManager, mSearchAdapter);
    mSearchFeatureProvider.initFeedbackButton();
    if (savedInstanceState != null) {
        mQuery = savedInstanceState.getString(STATE_QUERY);
        mNeverEnteredQuery = savedInstanceState.getBoolean(STATE_NEVER_ENTERED_QUERY);
        mResultClickCount = savedInstanceState.getInt(STATE_RESULT_CLICK_COUNT);
        mShowingSavedQuery = savedInstanceState.getBoolean(STATE_SHOWING_SAVED_QUERY);
    } else {
        mShowingSavedQuery = true;
    }
    final Activity activity = getActivity();
    // Run the Index update only if we have some space
    if (!Utils.isLowStorage(activity)) {
        mSearchFeatureProvider.updateIndexAsync(activity, this);
    } else {
        Log.w(TAG, "Cannot update the Indexer as we are running low on storage space!");
    }
    if (SettingsSearchIndexablesProvider.DEBUG) {
        Log.d(TAG, "onCreate spent " + (System.currentTimeMillis() - startTime) + " ms");
    }
}
Also used : LoaderManager(android.app.LoaderManager) SettingsActivity(com.android.settings.SettingsActivity) Activity(android.app.Activity)

Example 4 with LoaderManager

use of android.app.LoaderManager in project android_packages_apps_Settings by LineageOS.

the class SearchFragment method onIndexingFinished.

/**
 * Gets called when Indexing is completed.
 */
@Override
public void onIndexingFinished() {
    if (getActivity() == null) {
        return;
    }
    if (mShowingSavedQuery) {
        mSavedQueryController.loadSavedQueries();
    } else {
        final LoaderManager loaderManager = getLoaderManager();
        loaderManager.initLoader(SearchLoaderId.DATABASE, null, /* args */
        this);
        loaderManager.initLoader(SearchLoaderId.INSTALLED_APPS, null, /* args */
        this);
        loaderManager.initLoader(SearchLoaderId.ACCESSIBILITY_SERVICES, null, /* args */
        this);
        loaderManager.initLoader(SearchLoaderId.INPUT_DEVICES, null, /* args */
        this);
    }
    requery();
}
Also used : LoaderManager(android.app.LoaderManager)

Example 5 with LoaderManager

use of android.app.LoaderManager in project android_packages_apps_Settings by LineageOS.

the class SearchFragmentTest method onIndexingFinished_notShowingSavedQuery_initLoaders.

@Test
public void onIndexingFinished_notShowingSavedQuery_initLoaders() {
    ActivityController<SearchActivity> activityController = Robolectric.buildActivity(SearchActivity.class);
    activityController.setup();
    SearchFragment fragment = (SearchFragment) spy(activityController.get().getFragmentManager().findFragmentById(R.id.main_content));
    final LoaderManager loaderManager = mock(LoaderManager.class);
    when(fragment.getLoaderManager()).thenReturn(loaderManager);
    fragment.mShowingSavedQuery = false;
    fragment.mQuery = null;
    fragment.onIndexingFinished();
    verify(loaderManager).initLoader(eq(SearchFragment.SearchLoaderId.DATABASE), eq(null), any(LoaderManager.LoaderCallbacks.class));
    verify(loaderManager).initLoader(eq(SearchFragment.SearchLoaderId.INSTALLED_APPS), eq(null), any(LoaderManager.LoaderCallbacks.class));
}
Also used : LoaderManager(android.app.LoaderManager) Test(org.junit.Test)

Aggregations

LoaderManager (android.app.LoaderManager)42 Activity (android.app.Activity)6 SettingsActivity (com.android.settings.SettingsActivity)6 AppItem (com.android.settingslib.AppItem)6 Test (org.junit.Test)6 Bundle (android.os.Bundle)2 Context (android.content.Context)1 CursorLoader (android.content.CursorLoader)1 Loader (android.content.Loader)1 Cursor (android.database.Cursor)1 Toast (android.widget.Toast)1 AlbumFolder (com.codez.collar.bean.AlbumFolder)1 Account (com.fsck.k9.Account)1 ReplyToParser (com.fsck.k9.helper.ReplyToParser)1 ComposePgpInlineDecider (com.fsck.k9.message.ComposePgpInlineDecider)1 File (java.io.File)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 Before (org.junit.Before)1