com.wit.android.support.database.adapter.LoaderAdapter.java Source code

Java tutorial

Introduction

Here is the source code for com.wit.android.support.database.adapter.LoaderAdapter.java

Source

/*
 * =================================================================================================
 *                    Copyright (C) 2014 Martin Albedinsky [Wolf-ITechnologies]
 * =================================================================================================
 *         Licensed under the Apache License, Version 2.0 or later (further "License" only).
 * -------------------------------------------------------------------------------------------------
 * You may use this file only in compliance with the License. More details and copy of this License 
 * you may obtain at
 * 
 *       http://www.apache.org/licenses/LICENSE-2.0
 * 
 * You can redistribute, modify or publish any part of the code written within this file but as it 
 * is described in the License, the software distributed under the License is distributed on an 
 * "AS IS" BASIS, WITHOUT WARRANTIES or CONDITIONS OF ANY KIND.
 * 
 * See the License for the specific language governing permissions and limitations under the License.
 * =================================================================================================
 */
package com.wit.android.support.database.adapter;

import android.database.Cursor;
import android.os.Bundle;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.support.v4.content.Loader;
import android.widget.ListAdapter;
import android.widget.SpinnerAdapter;

/**
 * <h3>Interface Overview</h3>
 * todo: description
 *
 * @author Martin Albedinsky
 */
public interface LoaderAdapter extends ListAdapter, SpinnerAdapter {

    /**
     * See {@link LoaderAdapterAssistant#startLoader(FragmentActivity)} for info.
     */
    public boolean startLoader(@NonNull FragmentActivity activity);

    /**
     * See {@link LoaderAdapterAssistant#startLoader(FragmentActivity, Bundle)} for info.
     */
    public boolean startLoader(@NonNull FragmentActivity activity, @Nullable Bundle params);

    /**
     * See {@link LoaderAdapterAssistant#initLoader(FragmentActivity)} for info.
     */
    public boolean initLoader(@NonNull FragmentActivity activity);

    /**
     * See {@link LoaderAdapterAssistant#initLoader(FragmentActivity, Bundle)} for info.
     */
    public boolean initLoader(@NonNull FragmentActivity activity, @Nullable Bundle params);

    /**
     * See {@link LoaderAdapterAssistant#restartLoader(FragmentActivity)} for info.
     */
    public boolean restartLoader(@NonNull FragmentActivity activity);

    /**
     * See {@link LoaderAdapterAssistant#restartLoader(FragmentActivity, Bundle)} for info.
     */
    public boolean restartLoader(@NonNull FragmentActivity activity, @Nullable Bundle params);

    /**
     * Called from {@link LoaderAdapterAssistant#onCreateLoader(int, android.os.Bundle)} of assistant
     * to which is this adapter attached.
     *
     * @param params Bundle with parameters for loader.
     * @return Requested Cursor loader or {@code null} if this adapter does not provides any
     * cursor loader.
     */
    @NonNull
    public Loader<Cursor> createLoader(@Nullable Bundle params);

    /**
     * See {@link LoaderAdapterAssistant#getLoader(FragmentActivity)} for info.
     */
    @Nullable
    public Loader<Cursor> getLoader(@NonNull FragmentActivity activity);

    /**
     * See {@link LoaderAdapterAssistant#destroyLoader(FragmentActivity)} for info.
     */
    public boolean destroyLoader(@NonNull FragmentActivity activity);

    /**
     */
    public void changeCursor(@Nullable Cursor cursor);

    /**
     * Notifies this loader adapter, that a cursor data set received from CursorLoader for this adapter
     * has been successfully loaded.
     */
    public void notifyDataSetLoaded();
}