Java Code Examples for android.support.v4.app.LoaderManager#LoaderCallbacks

The following examples show how to use android.support.v4.app.LoaderManager#LoaderCallbacks . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: WeatherActivity.java    From AndroidSchool with Apache License 2.0 5 votes vote down vote up
private void loadWeather(boolean restart) {
    mWeatherLayout.setVisibility(View.INVISIBLE);
    mErrorLayout.setVisibility(View.GONE);
    mLoadingView.showLoadingIndicator();
    LoaderManager.LoaderCallbacks<City> callbacks = new WeatherCallbacks();
    if (restart) {
        getSupportLoaderManager().restartLoader(R.id.weather_loader_id, Bundle.EMPTY, callbacks);
    } else {
        getSupportLoaderManager().initLoader(R.id.weather_loader_id, Bundle.EMPTY, callbacks);
    }
}
 
Example 2
Source File: LoaderManagerCreator.java    From android-atleap with Apache License 2.0 5 votes vote down vote up
/**
 * Init Loader Manager for fragment
 * @param fragment fragment
 * @param callbacks callbacks
 * @param args arguments for loader construction
 * @param <T>
 */
public <T> LoaderManagerCreator(Fragment fragment, LoaderManager.LoaderCallbacks<T> callbacks, Bundle args) {
    this(
            fragment.getActivity().getApplicationContext(),
            fragment.getLoaderManager(),
            (int) HashUtil.longHash(((Object) fragment).getClass(), fragment.getArguments(), callbacks),
            callbacks,
            args
    );
}
 
Example 3
Source File: LoaderManagerCreator.java    From android-atleap with Apache License 2.0 5 votes vote down vote up
/**
 * Init Loader Manager for Activity
 * @param activity activity
 * @param callbacks callbacks
 * @param args arguments for loader construction
 * @param <T>
 */
public <T> LoaderManagerCreator(FragmentActivity activity, LoaderManager.LoaderCallbacks<T> callbacks, Bundle args) {
    this(
            activity.getApplicationContext(),
            activity.getSupportLoaderManager(),
            (int) HashUtil.longHash(((Object) activity).getClass(), activity.getIntent(), callbacks),
            callbacks,
            args
    );
}
 
Example 4
Source File: LoaderManagerCreator.java    From android-atleap with Apache License 2.0 2 votes vote down vote up
/**
 * Init LoaderManager for Fragment.
 * @param fragment fragment
 * @param callbacks Loader callbacks
 * @param <T> usually Cursor
 */
public <T> LoaderManagerCreator(Fragment fragment, LoaderManager.LoaderCallbacks<T> callbacks) {
    this(fragment, callbacks, null);

}
 
Example 5
Source File: LoaderManagerCreator.java    From android-atleap with Apache License 2.0 2 votes vote down vote up
/**
 * Init LoaderManager for Activity.
 * @param activity activity
 * @param callbacks Loader callbacks
 * @param <T> usually Cursor
 */
public <T> LoaderManagerCreator(FragmentActivity activity, LoaderManager.LoaderCallbacks<T> callbacks) {
    this(activity, callbacks, null);
}
 
Example 6
Source File: LoaderManagerCreator.java    From android-atleap with Apache License 2.0 2 votes vote down vote up
/**
 * Init Loader Manager
 * @param context context
 * @param loaderManager loader manager
 * @param loaderId loader id
 * @param callbacks callbacks
 * @param args arguments for loader construction
 * @param <T>
 */
public <T> LoaderManagerCreator(Context context, LoaderManager loaderManager, int loaderId, LoaderManager.LoaderCallbacks<T> callbacks, Bundle args) {
    loaderManager.initLoader(loaderId, args, callbacks);
}