package com.nd.android.u.square.ui.view;

import android.content.Context;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.common.utils.StarAppUtils;
import com.common.widget.CommonActivityTitle;
import com.nd.android.u.square.R;
import com.nd.android.u.square.utils.Helper;

/**
 *
 * <br>
 * Created 2014-8-18 上午10:10:37
 *
 * @version
 * @author yusongying
 *
 * @see
 */
public class SquareTitleView extends CommonActivityTitle {

	private Button circleTip;
	private TextView titleText;
	
	public SquareTitleView(Context context) {
        super(context);
        init();
    }

    public SquareTitleView(Context context, AttributeSet attrs) {
        super(context, attrs);
        init();
    }

    public SquareTitleView(Context context, AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        init();
    }

    private void init() {

    	titleText = (TextView) findViewById(R.id.tvTitleText);
    	StarAppUtils.setViewTypeFace(titleText, false);
        RelativeLayout rightLay = (RelativeLayout) findViewById(R.id.rlTitleRight);
        int circleSize = Helper.dip2px(getContext(), 10);
		LayoutParams btnCircleParams = new LayoutParams(circleSize , circleSize);
        btnCircleParams.addRule(RelativeLayout.ALIGN_RIGHT,R.id.flTitleRight);
        btnCircleParams.addRule(RelativeLayout.ALIGN_TOP,R.id.flTitleRight);
        circleTip = new Button(getContext());
        circleTip.setGravity(Gravity.CENTER);
        circleTip.setBackgroundResource(R.drawable.msg_circle_bg_shape);
        rightLay.addView(circleTip, btnCircleParams);
        circleTip.setVisibility(View.GONE);
    }
    
	public void showMsgTip(){
		circleTip.setVisibility(View.VISIBLE);
	}
	
	public void hideMsgTip(){
		circleTip.setVisibility(View.GONE);
	}
}
