Android Open Source - APO-Theta-Upsilon-App Image Adapter






From Project

Back to project page APO-Theta-Upsilon-App.

License

The source code is released under:

GNU Lesser General Public License

If you think the Android project APO-Theta-Upsilon-App 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

/*
 * Copyright 2011 Devin Schwab, Umang Banugaria
 *//from ww w .ja  v a 2s .  c  o m
 * This file is part of the APO Theta Upsilon App for Case Western Reserve University's Alpha Phi Omega Theta Upsilon Chapter.
 *
 * The APO Theta Upsilon program is free software: you can redistribute it and/or modify
 * it under the terms of the Lesser GNU General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * Lesser GNU General Public License for more details.
 *
 * You should have received a copy of the Lesser GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

package edu.cwru.apo;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.GridView;
import android.widget.ImageView;

public class ImageAdapter extends BaseAdapter {
  private Context mContext;
  
  public ImageAdapter(Context c) {
    mContext = c;
  }

  public int getCount() {
    return mThumbIds.length;
  }

  public Object getItem(int position) {
    // TODO Auto-generated method stub
    return null;
  }

  public long getItemId(int position) {
    // TODO Auto-generated method stub
    return 0;
  }

  public View getView(int position, View convertView, ViewGroup parent) {
    // TODO Auto-generated method stub
    ImageView imageView;
    if(convertView == null) {
      imageView = new ImageView(mContext);
      imageView.setLayoutParams(new GridView.LayoutParams(85,85));
      imageView.setScaleType(ImageView.ScaleType.CENTER_CROP);
      imageView.setPadding(8,8,8,8);
    } 
    else {
      imageView = (ImageView) convertView;
    }
    
    imageView.setImageResource(mThumbIds[position]);
    return imageView;
  }
  
  // contains the images that will represent each button
  private Integer[] mThumbIds = {
      R.drawable.report,
      R.drawable.contract,
      R.drawable.directory
  };

}




Java Source Code List

edu.cwru.apo.API.java
edu.cwru.apo.APO.java
edu.cwru.apo.AsyncRestRequestListener.java
edu.cwru.apo.Auth.java
edu.cwru.apo.Contract.java
edu.cwru.apo.Directory.java
edu.cwru.apo.DynamicHmac.java
edu.cwru.apo.ForgotPassword.java
edu.cwru.apo.Hex.java
edu.cwru.apo.Hmac.java
edu.cwru.apo.Home.java
edu.cwru.apo.ImageAdapter.java
edu.cwru.apo.Installation.java
edu.cwru.apo.Login.java
edu.cwru.apo.News.java
edu.cwru.apo.PhoneOpenHelper.java
edu.cwru.apo.Profile.java
edu.cwru.apo.Report.java
edu.cwru.apo.RestClient.java
edu.cwru.apo.TrustAPOHttpClient.java