package com.scut.picturelibrary.adapter;

import java.util.ArrayList;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.Button;

import com.scut.picturelibrary.Constants;

/**
 * 用于显示都有哪些字体样式可选择的Adapter
 * 
 * @author 黄建斌
 * 
 */
public class TextFontsShowAdapter extends ArrayAdapter<Integer> {
	int mResId;
	int mTextViewResourceId;
	Context mContext;
	ArrayList<Integer> mContent;

	public TextFontsShowAdapter(Context context, int resource,
			int textViewResourceId) {
		super(context, resource, textViewResourceId);
		mContext = context;
		mResId = resource;
		mContent = new ArrayList<Integer>();
		for (int i = 0; i < Constants.FONTS_DRAWABLE_ID.length; i++) {
			mContent.add(Constants.FONTS_DRAWABLE_ID[i]);
		}
		addAll(mContent);
		mTextViewResourceId = textViewResourceId;
	}

	@SuppressWarnings("deprecation")
	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		View v = View.inflate(mContext, mResId, null);
		Button img = (Button) v.findViewById(mTextViewResourceId);
		int id = getItem(position);
		int sdk = android.os.Build.VERSION.SDK_INT;
		if (sdk < android.os.Build.VERSION_CODES.JELLY_BEAN) {
			img.setBackgroundDrawable(getContext().getResources().getDrawable(
					id));
		} else {
			img.setBackground(getContext().getResources().getDrawable(id));
		}

		return v;
	}
}

@@ -885,42 +885,8 @@
 %09%7D%0A%0A
-%09@SuppressWarnings(%22deprecation%22)%0A
 %09@Ov
@@ -892,16 +892,16 @@
 verride%0A
+
 %09public 
@@ -1112,271 +1112,78 @@
 %0A%09%09i
-nt sdk = android.os.Build.VERSION.SDK_INT;%0A%09%09if (sdk %3C android.os.Build.VERSION_CODES.JELLY_BEAN) %7B%0A%09%09%09img.setBackgroundDrawable(getContext().getResources().getDrawable(%0A%09%09%09%09%09id));%0A%09%09%7D else %7B%0A%09%09%09img.setBackground(getContext().getResources().getDrawable(id));%0A%09%09%7D%0A
+mg.setBackgroundDrawable(getContext().getResources().getDrawable(id));
 %0A%09%09r

Use low version sdk api