Android Open Source - camp-food-manager Result List View Adapter






From Project

Back to project page camp-food-manager.

License

The source code is released under:

GNU General Public License

If you think the Android project camp-food-manager 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.V4Creations.FSMK.campfoodmanager.adapter;
/*from  www. j a v  a  2  s  . c o m*/
import java.util.ArrayList;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.RadioButton;
import android.widget.TextView;

import com.V4Creations.FSMK.campfoodmanager.R;

public class ResultListViewAdapter extends BaseAdapter {
  private ArrayList<ResultListViewItem> itemList;
  private LayoutInflater mInflater;

  public ResultListViewAdapter(Context context,
      ArrayList<ResultListViewItem> itemList) {
    this.itemList = itemList;
    mInflater = (LayoutInflater) context
        .getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  @Override
  public int getCount() {
    return itemList.size();
  }

  @Override
  public ResultListViewItem getItem(int position) {
    return (ResultListViewItem) itemList.get(position);
  }

  @Override
  public long getItemId(int position) {
    return position;
  }

  @Override
  public View getView(int position, View convertView, ViewGroup parent) {
    ResultListViewItem tempDirectoryListItem = getItem(position);
    if (convertView == null) {
      convertView = mInflater
          .inflate(
              com.V4Creations.FSMK.campfoodmanager.R.layout.result_list_view_item,
              null);
      ViewHolder viewHolder = new ViewHolder();
      viewHolder.dateTextView = (TextView) convertView
          .findViewById(R.id.dateTextView);
      viewHolder.breakfastCheckBox = (RadioButton) convertView
          .findViewById(R.id.breakFastRadioButton);
      viewHolder.lunchCheckBox = (RadioButton) convertView
          .findViewById(R.id.lunchRadioButton);
      viewHolder.dinnerCheckBox = (RadioButton) convertView
          .findViewById(R.id.dinnerRadioButton);
      convertView.setTag(viewHolder);
    }
    ViewHolder viewHolder = (ViewHolder) convertView.getTag();
    viewHolder.dateTextView.setText(tempDirectoryListItem.mDateString);
    viewHolder.breakfastCheckBox
        .setChecked(tempDirectoryListItem.mIsBreakfast);
    viewHolder.lunchCheckBox.setChecked(tempDirectoryListItem.mIsLunch);
    viewHolder.dinnerCheckBox.setChecked(tempDirectoryListItem.mIsDinner);
    return convertView;
  }

  private static class ViewHolder {
    TextView dateTextView;
    RadioButton breakfastCheckBox, lunchCheckBox, dinnerCheckBox;
  }

  public static class ResultListViewItem {
    public String mDateString;
    public boolean mIsBreakfast, mIsLunch, mIsDinner;

    public ResultListViewItem(String dateString, boolean isBreakfast,
        boolean isLunch, boolean isDinner) {

      mDateString = dateString;
      mIsBreakfast = isBreakfast;
      mIsLunch = isLunch;
      mIsDinner = isDinner;
    }
  }
}




Java Source Code List

com.V4Creations.FSMK.campfoodmanager.adapter.ResultListViewAdapter.java
com.V4Creations.FSMK.campfoodmanager.db.CampFoodManagerDataBase.java
com.V4Creations.FSMK.campfoodmanager.db.DatabaseHelper.java
com.V4Creations.FSMK.campfoodmanager.db.GetAllStudensDetailsHelperAsynzTask.java
com.V4Creations.FSMK.campfoodmanager.db.GetDetailsHelperAsynzTask.java
com.V4Creations.FSMK.campfoodmanager.flash.Constants.java
com.V4Creations.FSMK.campfoodmanager.flash.Droid22Flashlight.java
com.V4Creations.FSMK.campfoodmanager.flash.Flashlight.java
com.V4Creations.FSMK.campfoodmanager.flash.FroyoLedFlashlight.java
com.V4Creations.FSMK.campfoodmanager.flash.HtcLedFlashlight.java
com.V4Creations.FSMK.campfoodmanager.flash.LedFlashlightReceiver.java
com.V4Creations.FSMK.campfoodmanager.flash.Moto21LedFlashlight.java
com.V4Creations.FSMK.campfoodmanager.fragment.MenuFragment.java
com.V4Creations.FSMK.campfoodmanager.interfaces.GetFullStudentsDetailsInterface.java
com.V4Creations.FSMK.campfoodmanager.interfaces.GetSingleItemDetailsInterface.java
com.V4Creations.FSMK.campfoodmanager.ui.CampFoodManagerMainActivity.java
com.V4Creations.FSMK.campfoodmanager.ui.PreferencesActivity.java
com.V4Creations.FSMK.campfoodmanager.util.BaseActivity.java
com.V4Creations.FSMK.campfoodmanager.util.Settings.java
com.google.zxing.client.android.AmbientLightManager.java
com.google.zxing.client.android.BeepManager.java
com.google.zxing.client.android.CaptureActivityHandler.java
com.google.zxing.client.android.DecodeFormatManager.java
com.google.zxing.client.android.DecodeHandler.java
com.google.zxing.client.android.DecodeHintManager.java
com.google.zxing.client.android.DecodeThread.java
com.google.zxing.client.android.FinishListener.java
com.google.zxing.client.android.InactivityTimer.java
com.google.zxing.client.android.IntentSource.java
com.google.zxing.client.android.Intents.java
com.google.zxing.client.android.ViewfinderResultPointCallback.java
com.google.zxing.client.android.ViewfinderView.java
com.google.zxing.client.android.camera.AutoFocusManager.java
com.google.zxing.client.android.camera.CameraConfigurationManager.java
com.google.zxing.client.android.camera.CameraManager.java
com.google.zxing.client.android.camera.FrontLightMode.java
com.google.zxing.client.android.camera.PreviewCallback.java
com.google.zxing.client.android.camera.exposure.DefaultExposureInterface.java
com.google.zxing.client.android.camera.exposure.ExposureInterface.java
com.google.zxing.client.android.camera.exposure.ExposureManager.java
com.google.zxing.client.android.camera.exposure.FroyoExposureInterface.java
com.google.zxing.client.android.camera.open.DefaultOpenCameraInterface.java
com.google.zxing.client.android.camera.open.GingerbreadOpenCameraInterface.java
com.google.zxing.client.android.camera.open.OpenCameraInterface.java
com.google.zxing.client.android.camera.open.OpenCameraManager.java
com.google.zxing.client.android.common.PlatformSupportManager.java
com.google.zxing.client.android.common.executor.AsyncTaskExecInterface.java
com.google.zxing.client.android.common.executor.AsyncTaskExecManager.java
com.google.zxing.client.android.common.executor.DefaultAsyncTaskExecInterface.java
com.google.zxing.client.android.common.executor.HoneycombAsyncTaskExecInterface.java