Example usage for android.content Loader isStarted

List of usage examples for android.content Loader isStarted

Introduction

In this page you can find the example usage for android.content Loader isStarted.

Prototype

public boolean isStarted() 

Source Link

Document

Return whether this load has been started.

Usage

From source file:android.support.content.LoaderQueryRunner.java

@Override
public boolean isRunning(@NonNull Query query) {
    Loader<Cursor> loader = mLoaderMgr.getLoader(query.getId());
    return loader != null && loader.isStarted();
    // Hmm, when exactly would the loader not be started? Does it imply that it will
    // be starting at some point?
}

From source file:com.github.secondsun.catfactsdemo.networking.LoaderBasedFactFetcher.java

@Override
public void onResume() {
    Loader<Object> localLoader = activity.getLoaderManager().getLoader(LOADER_ID);
    if (localLoader != null && !localLoader.isStarted()) {
        localLoader.startLoading();// www. j  av a 2s.  co  m
    }
    if (localLoader != null) {
        activity.displayFacts(
                ((HttpCatLoader) (Loader<?>) activity.getLoaderManager().getLoader(LOADER_ID)).data);
    }
}

From source file:biz.wiz.android.wallet.ui.PeerListFragment.java

@Override
public void onResume() {
    super.onResume();

    handler.postDelayed(new Runnable() {
        @Override/*from   www.j a  v  a 2s. co m*/
        public void run() {
            adapter.notifyDataSetChanged();

            final Loader<String> loader = loaderManager.getLoader(ID_REVERSE_DNS_LOADER);
            final boolean loaderRunning = loader != null && loader.isStarted();

            if (!loaderRunning) {
                for (int i = 0; i < adapter.getCount(); i++) {
                    final Peer peer = adapter.getItem(i);
                    final InetAddress address = peer.getAddress().getAddr();

                    if (!hostnames.containsKey(address)) {
                        final Bundle args = new Bundle();
                        args.putSerializable("address", address);
                        loaderManager.initLoader(ID_REVERSE_DNS_LOADER, args, reverseDnsLoaderCallbacks)
                                .forceLoad();

                        break;
                    }
                }
            }

            handler.postDelayed(this, REFRESH_MS);
        }
    }, REFRESH_MS);
}

From source file:systems.soapbox.ombuds.client.ui.PeerListFragment.java

@Override
public void onResume() {
    super.onResume();

    handler.postDelayed(new Runnable() {
        @Override//from  w ww  . java2 s .c o m
        public void run() {
            adapter.notifyDataSetChanged();

            final Loader<String> loader = loaderManager.getLoader(ID_REVERSE_DNS_LOADER);
            final boolean loaderRunning = loader != null && loader.isStarted();

            if (!loaderRunning) {
                for (int i = 0; i < adapter.getItemCount(); i++) {
                    final Peer peer = adapter.getItem(i);
                    final InetAddress address = peer.getAddress().getAddr();

                    if (!hostnames.containsKey(address)) {
                        final Bundle args = new Bundle();
                        args.putSerializable("address", address);
                        loaderManager.initLoader(ID_REVERSE_DNS_LOADER, args, reverseDnsLoaderCallbacks)
                                .forceLoad();

                        break;
                    }
                }
            }

            handler.postDelayed(this, REFRESH_MS);
        }
    }, REFRESH_MS);
}

From source file:org.andstatus.app.msg.TimelineActivity.java

@Override
public void onLoadFinished(Loader<Cursor> loader, Cursor cursor) {
    final String method = "onLoadFinished";
    MyLog.v(this, method);
    boolean doChangeListContent = loader.isStarted() && cursor != null && !mFinishing;
    if (doChangeListContent && !(loader instanceof TimelineCursorLoader1)) {
        MyLog.e(this, method + "; Wrong type of loader: " + MyLog.objTagToString(loader));
        doChangeListContent = false;// ww w . j  av a  2  s .c  o  m
    }
    TimelineCursorLoader1 myLoader = null;
    if (doChangeListContent) {
        myLoader = (TimelineCursorLoader1) loader;
        doChangeListContent = !myLoader.getParams().cancelled;
    }
    if (doChangeListContent) {
        changeListContent(myLoader, cursor);
    } else {
        setLoading(method, false);
        updateScreen();
        clearNotifications();
    }
}