package com.wasu.cs.ui;

import java.util.ArrayList;

import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
import android.widget.LinearLayout;
import android.widget.TextView;
import cn.com.wasu.main.R;

import com.wasu.module.log.WLog;

public class DetailIndicatorLinearlayout extends LinearLayout {
	private static final String TAG = "DetailIndicatorLinearlayout";
	private ArrayList<TextView> textViews=new ArrayList<TextView>();
	public DetailIndicatorLinearlayout(Context context) {
		super(context);
		init(context);
	}
	public DetailIndicatorLinearlayout(Context context, AttributeSet attrs) {
		super(context, attrs);
		init(context);
	}
	public DetailIndicatorLinearlayout(Context context, AttributeSet attrs,
			int defStyle) {
		super(context, attrs, defStyle);
		init(context);
	}
	private void init(Context context) {
		
		
	}
	public void setIndicatorFocus(int index){
		if(index>textViews.size()-1||textViews.size()==0||index<0){
			WLog.e(TAG, "textViews.size()="+textViews.size()+",index="+index);
			return;
		}
		for(TextView textView:textViews ){
			textView.setTextColor(this.getResources().getColor(R.color.grey));
			textView.setScaleX(1.0f);
			textView.setScaleY(1.0f);
		}
		TextView textView=textViews.get(index);
		textView.setTextColor(this.getResources().getColor(R.color.white));
		textView.setScaleX(1.3f);
		textView.setScaleY(1.3f);
	}
	public void clear(){
		textViews.clear();
	}
	
	@Override
	public void addView(View child) {
		super.addView(child);
		textViews.add((TextView)child);
	}
}
