Home | History | Annotate | Download | only in widget
      1 /*
      2  * Copyright (C) 2010 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.contacts.widget;
     17 
     18 import android.view.View;
     19 import android.view.ViewGroup;
     20 import android.widget.BaseAdapter;
     21 
     22 /**
     23  * A general purpose adapter that contains exactly one item.
     24  */
     25 public abstract class SingleItemAdapter extends BaseAdapter {
     26 
     27     public int getCount() {
     28         return 1;
     29     }
     30 
     31     public Object getItem(int position) {
     32         return null;
     33     }
     34 
     35     public long getItemId(int position) {
     36         return 0;
     37     }
     38 
     39     public View getView(int position, View convertView, ViewGroup parent) {
     40         return getView(convertView, parent);
     41     }
     42 
     43     /**
     44      * Creates the view.
     45      */
     46     protected abstract View getView(View convertView, ViewGroup parent);
     47 }
     48