Search in sources :

Example 11 with RecipeList

use of com.se491.chef_ly.model.RecipeList in project chefly_android by chef-ly.

the class ListViewFragment method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    isLoading = new AtomicBoolean(false);
    if (savedInstanceState != null) {
        title = savedInstanceState.getString("title");
        pageNum = savedInstanceState.getString("pageNum");
        list = savedInstanceState.getParcelable(title);
        searchText = savedInstanceState.getString("search");
    } else {
        if (getArguments() != null) {
            title = getArguments().getString("title");
            pageNum = getArguments().getString("pageNum");
            searchText = getArguments().getString("search");
        //list = getArguments().getParcelableArrayList("list");
        }
        if (list == null) {
            list = new RecipeList();
        }
    }
    Log.d(TAG + "/" + title, "results -> " + title + " " + pageNum);
}
Also used : AtomicBoolean(java.util.concurrent.atomic.AtomicBoolean) RecipeList(com.se491.chef_ly.model.RecipeList)

Example 12 with RecipeList

use of com.se491.chef_ly.model.RecipeList in project chefly_android by chef-ly.

the class ListViewFragment method onLoadFinished.

//  LoaderManager callback method
@Override
public void onLoadFinished(Loader<RecipeList> loader, RecipeList data) {
    Log.d(TAG + "/" + title, "Loader - OnLoadFinish");
    for (RecipeInformation recipe : data) {
        list.add(recipe);
    }
    ((BaseAdapter) listView.getAdapter()).notifyDataSetChanged();
    isLoading.set(false);
    Log.d(TAG, "Getting more recipes from server --- Done");
}
Also used : BaseAdapter(android.widget.BaseAdapter) RecipeInformation(com.se491.chef_ly.model.RecipeInformation)

Aggregations

RecipeList (com.se491.chef_ly.model.RecipeList)8 RecipeInformation (com.se491.chef_ly.model.RecipeInformation)4 Intent (android.content.Intent)3 BaseAdapter (android.widget.BaseAdapter)3 Paint (android.graphics.Paint)2 Bundle (android.os.Bundle)2 Gson (com.google.gson.Gson)2 GsonBuilder (com.google.gson.GsonBuilder)2 RequestMethod (com.se491.chef_ly.http.RequestMethod)2 IOException (java.io.IOException)2 Type (java.lang.reflect.Type)2 SharedPreferences (android.content.SharedPreferences)1 Parcel (android.os.Parcel)1 Parcelable (android.os.Parcelable)1 NavigationView (android.support.design.widget.NavigationView)1 LocalBroadcastManager (android.support.v4.content.LocalBroadcastManager)1 ViewPager (android.support.v4.view.ViewPager)1 DrawerLayout (android.support.v4.widget.DrawerLayout)1 ActionBarDrawerToggle (android.support.v7.app.ActionBarDrawerToggle)1 SearchView (android.support.v7.widget.SearchView)1