/*
 * Copyright (C) 2007 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package org.robolectric.shadows;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ResourceCursorAdapter;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

/**
 * An easy adapter that creates views defined in an XML file. You can specify
 * the XML file that defines the appearance of the views.
 */
@Implements(ResourceCursorAdapter.class)
public class ShadowResourceCursorAdapter extends ShadowCursorAdapter {
  private int mLayout;

  private int mDropDownLayout;

  private LayoutInflater mInflater;

  /**
   * Constructor.
   *
   * @param context The context where the ListView associated with this
   *            SimpleListItemFactory is running
   * @param layout resource identifier of a layout file that defines the views
   *            for this list item.  Unless you override them later, this will
   *            define both the item views and the drop down views.
   * @param c The cursor from which to get the data.
   */
  public void __constructor__(Context context, int layout, Cursor c) {
    super.__constructor__(context, c);
    mLayout = mDropDownLayout = layout;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  /**
   * Constructor.
   *
   * @param context The context where the ListView associated with this
   *            SimpleListItemFactory is running
   * @param layout resource identifier of a layout file that defines the views
   *            for this list item.  Unless you override them later, this will
   *            define both the item views and the drop down views.
   * @param c The cursor from which to get the data.
   * @param autoRequery If true the adapter will call requery() on the
   *                    cursor whenever it changes so the most recent
   *                    data is always displayed.
   */
  public void __constructor__(Context context, int layout, Cursor c, boolean autoRequery) {
    super.__constructor__(context, c, autoRequery);
    mLayout = mDropDownLayout = layout;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  @Implementation
  public View newView(Context context, Cursor cursor, ViewGroup parent) {
    return mInflater.inflate(mLayout, parent, false);
  }

  @Implementation
  public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) {
    return mInflater.inflate(mDropDownLayout, parent, false);
  }

  @Implementation
  public void setViewResource(int layout) {
    mLayout = layout;
  }

  @Implementation
  public void setDropDownViewResource(int dropDownLayout) {
    mDropDownLayout = dropDownLayout;
  }
}
package org.robolectric.shadows;

import android.content.Context;
import android.database.Cursor;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ResourceCursorAdapter;
import org.robolectric.annotation.Implementation;
import org.robolectric.annotation.Implements;

/**
 * An easy adapter that creates views defined in an XML file. You can specify
 * the XML file that defines the appearance of the views.
 */
@Implements(ResourceCursorAdapter.class)
public class ShadowResourceCursorAdapter extends ShadowCursorAdapter {
  private int mLayout;
  private int mDropDownLayout;
  private LayoutInflater mInflater;

  public void __constructor__(Context context, int layout, Cursor c) {
    super.__constructor__(context, c);
    mLayout = mDropDownLayout = layout;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  public void __constructor__(Context context, int layout, Cursor c, boolean autoRequery) {
    super.__constructor__(context, c, autoRequery);
    mLayout = mDropDownLayout = layout;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  public void __constructor__(Context context, int layout, Cursor c, int flags) {
    super.__constructor__(context, c, flags);
    mLayout = mDropDownLayout = layout;
    mInflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
  }

  @Implementation
  public View newView(Context context, Cursor cursor, ViewGroup parent) {
    return mInflater.inflate(mLayout, parent, false);
  }

  @Implementation
  public View newDropDownView(Context context, Cursor cursor, ViewGroup parent) {
    return mInflater.inflate(mDropDownLayout, parent, false);
  }

  @Implementation
  public void setViewResource(int layout) {
    mLayout = layout;
  }

  @Implementation
  public void setDropDownViewResource(int dropDownLayout) {
    mDropDownLayout = dropDownLayout;
  }
}
Add missing constructor for ShadowResourceCursorAdapter.