Android Open Source - groceryviewer Grocery List Adapter






From Project

Back to project page groceryviewer.

License

The source code is released under:

GNU General Public License

If you think the Android project groceryviewer listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.

Java Source Code

package com.github.knrajago.groceryviewer.listadapters;
//www .ja  va2  s  .co m
import com.github.knrajago.groceryviewer.R;

import android.content.Context;
import android.database.Cursor;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.CursorAdapter;
import android.widget.TextView;

import static com.github.knrajago.groceryviewer.constants.GroceryViewerConstants.APPLICATION_TAG;
import static com.github.knrajago.groceryviewer.constants.GroceryViewerConstants.ITEM_COL;

public class GroceryListAdapter extends CursorAdapter {


  LayoutInflater mLayoutInflater = null;
  public GroceryListAdapter(Context pContext, Cursor c, boolean autoRequery) {
    super(pContext, c, autoRequery);
        mLayoutInflater = LayoutInflater.from(pContext);
  }

  public GroceryListAdapter(Context pContext, Cursor c, int flags) {
    super(pContext, c, flags);
  }

  @Override
  public void bindView(View pView, Context pContext, Cursor pCursor) {
    updateView(pView, pCursor);
  }

  @Override
  public View newView(Context pContext, Cursor pCursor, ViewGroup pParent) {
    String methodName = "newView";
    Log.i(APPLICATION_TAG, methodName + " entering");
    View view = mLayoutInflater.inflate(R.layout.grocery_item_view, pParent, false);
        updateView(view, pCursor);
        Log.i(APPLICATION_TAG, methodName + " exiting");
        return view;
  }
  
  private void updateView(View pView, Cursor pCursor) {
    String methodName = "updateView";
    Log.i(APPLICATION_TAG, methodName + " entering");
    TextView txtView = (TextView) pView.findViewById(R.id.grocery_itm_txt);
    txtView.setText(pCursor.getString(pCursor.getColumnIndex(ITEM_COL)));
    Log.i(APPLICATION_TAG, methodName + " entering");
  }
}




Java Source Code List

android.UnusedStub.java
com.github.knrajago.groceryviewer.GroceryViewerActivity.java
com.github.knrajago.groceryviewer.constants.GroceryViewerConstants.java
com.github.knrajago.groceryviewer.listadapters.GroceryListAdapter.java
com.github.knrajago.groceryviewer.localdb.GroceryListHelper.java
com.github.knrajago.groceryviewer.observers.GroceryViewerObserver.java
com.github.knrajago.groceryviewer.providers.GroceryViewerContentProvider.java
com.github.knrajago.groceryviewer.services.GroceryViewerSyncService.java
com.github.knrajago.groceryviewer.syncadapters.GoogleSpreadsheetRefresher.java
com.github.knrajago.groceryviewer.threadedutils.GoogleAuthTokenRetriever.java
com.github.knrajago.groceryviewer.utils.GroceryViewerUtils.java