public class IFCheckBoxInFlater extends IFTextViewInFlater {

	public String ATTRIBUTE_check="checked";
	public boolean checked=false;
	
	@Override
	public TextView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		CheckBox layout = new CheckBox(context);
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
		CheckBox layout = (CheckBox)lay;
		layout.setChecked(checked);
	}

	@Override
	public boolean OnInflateProperty(String nameSpace, String attrName, String attrValue) {
		super.OnInflateProperty(nameSpace, attrName, attrValue);
		if(NAMESPACE_JUAHYA.equals(nameSpace)){
			if((ATTRIBUTE_check).equals(attrName)){
				checked="true".equals(attrValue);
			}
		}else{
			if((NAMESPACE_ANDROID+":"+ATTRIBUTE_check).equals(attrName)){
				checked="true".equals(attrValue);
			}
		}
		return false;
	}
	
	@Override
	public boolean shoulInflate(String name) {
		return name.equalsIgnoreCase("CheckBox");
	}

} public class IFEditTextInFlater extends IFTextViewInFlater {

	@Override
	public TextView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		EditText layout = new EditText(context);
		return layout;
	}

	@Override
	public boolean shoulInflate(String name) {
		return "EditText".equalsIgnoreCase(name);
	}
} public class IFImageViewInFlater extends IJuahyaFlateViewInFlaterAdapter {
	public String ATTRIBUTE_SRC="src";

	public int src=NONE_INT;
	public String imageSrcuri=null;
    
    public IFImageViewInFlater() {
		super();
		if(null==animateFirstListener){
			animateFirstListener = new AnimateFirstDisplayListener();
		}
	}
	private ImageLoadingListener animateFirstListener = null;
    private static class AnimateFirstDisplayListener extends SimpleImageLoadingListener {

        static final List<String> displayedImages = Collections.synchronizedList(new LinkedList<String>());

        @Override
        public void onLoadingComplete(String imageUri, View view, Bitmap loadedImage,String filePath) {
            if (loadedImage != null) {
                ImageView imageView = (ImageView) view;
                DebugUtil.dLog("onLoadingComplete--uri:"+imageUri+",filePath:"+filePath);
                boolean firstDisplay = !displayedImages.contains(imageUri);
                if (firstDisplay) {
                    FadeInBitmapDisplayer.animate(imageView, 500);
                    displayedImages.add(imageUri);
                } else {
                    imageView.setImageBitmap(loadedImage);
                }
            }
        }
    }
	@Override
	public ImageView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		ImageView layout = new ImageView(context);
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
		ImageView layout = (ImageView)lay;
		if(src!=NONE_INT)layout.setImageResource(src);
//		if(NONE_INT!=gravity)layout.setGravity(gravity);
	}
	
	@Override
	public void onFinishLayout(View lay) {
		ImageView layout = (ImageView)lay;
		if(null!=imageSrcuri){
			imageLoader.displayImage(imageSrcuri, layout, options, animateFirstListener);
		}
//		super.onFinishLayout(layout);
	}
	@Override
	public boolean OnInflateProperty(String nameSpace, String attrName, String attrValue) {
		String value=null;
		if(NAMESPACE_ANDROID.equals(nameSpace)){
			if(ATTRIBUTE_SRC.equals(attrName)){
//				src=inflateDrawable(attrValue);
//				src=IFlaterTools.getDrawableLocal(attrValue,getContext());
				if(attrValue.startsWith("#")){
					src=IFlaterTools.getBackgroundColor(attrValue,getContext());
				}else if(attrValue.startsWith("@url/")){
					imageSrcuri=IFlaterTools.getDrawableInternet(attrValue);
				}else{
					src=IFlaterTools.getDrawableLocal(attrValue,getContext());
				}
			
			}
		}else{
			if((NAMESPACE_ANDROID+":"+ATTRIBUTE_SRC).equals(attrName)){
//				src=IFlaterTools.getDrawableLocal(attrValue,getContext());
				if(attrValue.startsWith("#")){
					src=IFlaterTools.getBackgroundColor(attrValue,getContext());
				}else if(attrValue.startsWith("@url/")){
					imageSrcuri=IFlaterTools.getDrawableInternet(attrValue);
				}else{
					src=IFlaterTools.getDrawableLocal(attrValue,getContext());
				}
			}
		}
		return false;
	}
	public int inflateDrawable(String attrValue) {
		String value;
		if(attrValue.startsWith("@drawable/")){
			value = attrValue.substring(10);
			return getContext().getResources().getIdentifier(value, "drawable", getContext().getPackageName());
		}else if(attrValue.startsWith("@dictionary/")){
			//´Ó×Öµä±íÀïÃæ¶ÁÈ¡ÄÚÈÝ txt
		}else if(attrValue.startsWith("@android:drawable/")){
			value = attrValue.substring(18);
			return getContext().getResources().getIdentifier("android:drawable/"+value, null,null);
		}else if(attrValue.startsWith("@url/")){
			
		}
		return NONE_INT;
	}
	@Override
	public boolean shoulInflate(String name) {
		return "ImageView".equalsIgnoreCase(name);
	}

} public class IFLinearLayoutInFlater extends IJuahyaFlateViewInFlaterAdapter {

	public String ATTRIBUTE_ORIENTATION="orientation";
	public int orientation=NONE_INT;
	@Override
	public LinearLayout inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		LinearLayout layout = new LinearLayout(context);
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
		LinearLayout layout = (LinearLayout)lay;
		if(NONE_INT!=orientation)layout.setOrientation(orientation);
		if(NONE_INT!=gravity)layout.setGravity(gravity);
	}
	@Override
	public boolean OnInflateProperty(String nameSpace, String attrName, String attrValue) {
		if("android".equals(nameSpace)){
			if("orientation".equals(attrName)){
				orientation = "vertical".equals(attrValue)?LinearLayout.VERTICAL:LinearLayout.HORIZONTAL;
			}
		}else{
			if((NAMESPACE_ANDROID+":"+ATTRIBUTE_ORIENTATION).equals(attrName)){
				orientation = "vertical".equals(attrValue)?LinearLayout.VERTICAL:LinearLayout.HORIZONTAL;
			}
		}
		return false;
	}
	@Override
	public LinearLayout.LayoutParams getLayoutParams() {
		LinearLayout.LayoutParams param = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WRAP_CONTENT, 
				LinearLayout.LayoutParams.WRAP_CONTENT);
		return param;
	}
	@Override
	public boolean shoulInflate(String name) {
		return name.equalsIgnoreCase("LinearLayout");
	}

} public class IFRelativeLayoutInFlater extends IJuahyaFlateViewInFlaterAdapter {

	public String ATTRIBUTE_ORIENTATION="orientation";
	public int orientation=NONE_INT;
	@Override
	public RelativeLayout inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		RelativeLayout layout = new RelativeLayout(context);
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
		RelativeLayout layout = (RelativeLayout)lay;
//		if(NONE_INT!=orientation)layout.setOrientation(orientation);
		if(NONE_INT!=gravity)layout.setGravity(gravity);
	}
	@Override
	public boolean OnInflateProperty(String nameSpace, String attrName, String attrValue) {
		if("android".equals(nameSpace)){
			if("orientation".equals(attrName)){
				orientation = "vertical".equals(attrValue)?LinearLayout.VERTICAL:LinearLayout.HORIZONTAL;
			}
		}else{
			if((NAMESPACE_ANDROID+":"+ATTRIBUTE_ORIENTATION).equals(attrName)){
				orientation = "vertical".equals(attrValue)?LinearLayout.VERTICAL:LinearLayout.HORIZONTAL;
			}
		}
		return false;
	}
	@Override
	public RelativeLayout.LayoutParams getLayoutParams() {
		RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(RelativeLayout.LayoutParams.WRAP_CONTENT, 
				RelativeLayout.LayoutParams.WRAP_CONTENT);
		return param;
	}
	@Override
	public boolean shoulInflate(String name) {
		return name.equalsIgnoreCase("RelativeLayout");
	}

} public class IFScrollViewInFlater extends IJuahyaFlateViewInFlaterAdapter {

    
    public IFScrollViewInFlater() {
		super();
	}
	@Override
	public ScrollView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		ScrollView layout = new ScrollView(context);
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
	}
	
	@Override
	public void onFinishLayout(View lay) {
//		ScrollView layout = (ScrollView)lay;
//		super.onFinishLayout(layout);
	}
	@Override
	public boolean OnInflateProperty(String nameSpace, String attrName, String attrValue) {
		String value=null;
		if(NAMESPACE_ANDROID.equals(nameSpace)){
		}else{
		}
		return false;
	}
	@Override
	public ScrollView.LayoutParams getLayoutParams() {
		ScrollView.LayoutParams param = new ScrollView.LayoutParams(LinearLayout.LayoutParams.FILL_PARENT, 
				LinearLayout.LayoutParams.WRAP_CONTENT);
		return param;
	}
	@Override
	public boolean shoulInflate(String name) {
		return "ScrollView".equalsIgnoreCase(name);
	}

} public class IFTextViewInFlater extends IJuahyaFlateViewInFlaterAdapter {
	public String ATTRIBUTE_TEXT="text";
	public String ATTRIBUTE_textSize="textSize";
	public String ATTRIBUTE_textColor="textColor";

	public String text;
	public int  textSize=NONE_INT;
	public int  textColor=NONE_INT;
	@Override
	public TextView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		TextView layout = new TextView(context);
		
		
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
		TextView layout = (TextView)lay;
		layout.setText(text);
		if(NONE_INT!=gravity)layout.setGravity(gravity);
		if(NONE_INT!=textSize)layout.setTextSize(textSize);
		if(NONE_INT!=textColor)layout.setTextColor(textColor);
	}
	@Override
	public boolean OnInflateProperty(String nameSpace, String attrName, String attrValue) {
		if(NAMESPACE_ANDROID.equals(nameSpace)){
			if(ATTRIBUTE_TEXT.equals(attrName)){
				text = attrValue;
			}
		}else{
			if((NAMESPACE_ANDROID+":"+ATTRIBUTE_TEXT).equals(attrName)){
					text=attrValue;
			}else if((NAMESPACE_ANDROID+":"+ATTRIBUTE_textSize).equals(attrName)){
				textSize=IFlaterTools.px2dip(getContext(), attrValue);
			}else if((NAMESPACE_ANDROID+":"+ATTRIBUTE_textColor).equals(attrName)){
				textColor=Color.parseColor(attrValue);
			}
		}
		return false;
	}
	@Override
	public boolean shoulInflate(String name) {
		return "TextView".equalsIgnoreCase(name);
	}

} public abstract class IJuahyaFlateViewInFlaterAdapter extends IFlateViewInFlaterAdapter {
	public String ATTRIBUTE_KEY="attrKey";
	public String ATTRIBUTE_DESCRIPTION="attrDescription";
	public String ATTRIBUTE_TYPE="attrType";
	public String attrKey;
	public String attrDescription;
	public String attrType;

	public IJuahyaFlateViewInFlaterAdapter() {
		super();
	}

	@Override
	public boolean inflate(String nameSpace,String attrName,String attrValue){
		super.inflate(nameSpace, attrName, attrValue);
		if(IJuahyaFlateViewInFlaterAdapter.NAMESPACE_JUAHYA.equals(nameSpace)){
			if(ATTRIBUTE_KEY.equals(attrName)){
				attrKey = attrValue;
			}else if((ATTRIBUTE_DESCRIPTION).equals(attrName)){
				attrDescription=attrValue;
			}else if((ATTRIBUTE_TYPE).equals(attrName)){
				attrType=attrValue;
			}
		}else{
			if((IJuahyaFlateViewInFlaterAdapter.NAMESPACE_JUAHYA+":"+ATTRIBUTE_KEY).equals(attrName)){
				attrKey=attrValue;
			}else if((IJuahyaFlateViewInFlaterAdapter.NAMESPACE_JUAHYA+":"+ATTRIBUTE_DESCRIPTION).equals(attrName)){
				attrDescription=attrValue;
			}else if((IJuahyaFlateViewInFlaterAdapter.NAMESPACE_JUAHYA+":"+ATTRIBUTE_TYPE).equals(attrName)){
				attrType=attrValue;
			}
		}
		return false;
	}
	@Override
	public void onFinishIFlate(final View lay){
		if(lay instanceof IJuahya){
			IJuahya layout = (IJuahya)lay;
			if(null!=attrKey)layout.setAttrKey(attrKey);
			if(null!=attrDescription){
				layout.setAttrDescription(attrDescription);
//				layout.setHint(attrDescription);
			}
			if(null!=attrType){
				layout.setAttrType(attrType);
			}
		}
	
	}

	

} public class IFJCheckBoxInFlater extends IFCheckBoxInFlater {

	@Override
	public TextView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		JCheckBox layout = new JCheckBox(context);
		return layout;
	}
	@Override
	public void onFinishIFlate(View lay) {
		super.onFinishIFlate(lay);
	}

	
	@Override
	public boolean shoulInflate(String name) {
		return name.equalsIgnoreCase("com.juahya.guis.JCheckBox");
	}

} public class IFJEditTextInFlater extends IFEditTextInFlater {

	@Override
	public TextView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		JEditText layout = new JEditText(context);
		return layout;
	}
	
	@Override
	public boolean shoulInflate(String name) {
		return "com.juahya.guis.JEditText".equalsIgnoreCase(name);
	}

	
} public class IFJLinearlayoutInFlater extends IFLinearLayoutInFlater {

	@Override
	public LinearLayout inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		JLinearlayout layout = new JLinearlayout(context);
		return layout;
	}
	
	@Override
	public boolean shoulInflate(String name) {
		return name.equalsIgnoreCase("com.juahya.guis.JLinearlayout");
	}

} public class IFJTextViewInFlater extends IFTextViewInFlater {

	@Override
	public TextView inflate(XmlPullParser parser,Context context,LayoutParams paramParrent) {
		super.inflate(parser, context,paramParrent);
		JTextView layout = new JTextView(context);
		
		return layout;
	}
	
	@Override
	public boolean shoulInflate(String name) {
		return name.equalsIgnoreCase("com.juahya.guis.JTextView");
	}

}
import java.util.ArrayList;
import com.xml.inflate.inflater.IFCheckBoxInFlater;
import com.xml.inflate.inflater.IFEditTextInFlater;
import com.xml.inflate.inflater.IFImageViewInFlater;
import com.xml.inflate.inflater.IFLinearLayoutInFlater;
import com.xml.inflate.inflater.IFRelativeLayoutInFlater;
import com.xml.inflate.inflater.IFScrollViewInFlater;
import com.xml.inflate.inflater.IFTextViewInFlater;
import com.xml.inflate.inflater.IJuahyaFlateViewInFlaterAdapter;
import com.xml.inflate.inflater.juahya.IFJCheckBoxInFlater;
import com.xml.inflate.inflater.juahya.IFJEditTextInFlater;
import com.xml.inflate.inflater.juahya.IFJLinearlayoutInFlater;
import com.xml.inflate.inflater.juahya.IFJTextViewInFlater;

package com.xml.inflate.factory;



/**
 * after new Ifxxx api ,add to iflater list
 * */
public class IFLalterSImpleLinearLayoutFactory extends IFlaterBaseFactory{

	static ArrayList<IJuahyaFlateViewInFlaterAdapter> list=null;
	static{
		list=new ArrayList<IJuahyaFlateViewInFlaterAdapter>();
		list.add(new IFLinearLayoutInFlater());
		list.add(new IFTextViewInFlater());
		list.add(new IFEditTextInFlater());
		list.add(new IFJEditTextInFlater());
		list.add(new IFJTextViewInFlater());

		list.add(new IFImageViewInFlater());
