package com.ym.modulecommon.utils;

import android.content.Context;
import android.os.CountDownTimer;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;


/**
 * 按钮倒计时
 * @author lbm
 *
 */
public class LJButtonCountTimer extends CountDownTimer {
	
	TextView mButton;
	ImageView close;
	Context mContext;

	public LJButtonCountTimer(Context ctx, long millisInFuture, long countDownInterval, TextView button, ImageView close) {
		super(millisInFuture, countDownInterval);
		this.mButton = button;
		this.mContext = ctx;
		this.close = close;

	}

	@Override
	public void onFinish() {
//		mButton.setTextColor(Color.parseColor("#ffffff"));
		mButton.setVisibility(View.GONE);
		close.setVisibility(View.VISIBLE);
		mButton.setEnabled(true);
		cancel();
	}

	@Override
	public void onTick(long arg0) {
//		mButton.setTextColor(Color.parseColor("#EED685"));
		mButton.setText(((arg0/1000)+1)+"");
		mButton.setEnabled(false);
	}

}
