package org.crazyit.progressbar;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.Window;
import android.widget.Button;

/**
 * Description:
 * <br/>site: <a href="http://www.crazyit.org">crazyit.org</a> 
 * <br/>Copyright (C), 2001-2012, Yeeku.H.Lee
 * <br/>This program is protected by copyright laws.
 * <br/>Program Name:
 * <br/>Date:
 * @author  Yeeku.H.Lee kongyeeku@163.com
 * @version  1.0
 */
public class TitleProgressBar extends Activity
{
	@Override
	public void onCreate(Bundle savedInstanceState)
	{
		super.onCreate(savedInstanceState);
//		//ÉèÖÃ´°¿ÚÌØÕ÷£ºÆôÓÃÏÔÊ¾½ø¶ÈµÄ½ø¶ÈÌõ
//		requestWindowFeature(Window.FEATURE_PROGRESS);
		//ÉèÖÃ´°¿ÚÌØÕ÷£ºÆôÓÃ²»ÏÔÊ¾½ø¶ÈµÄ½ø¶ÈÌõ
		requestWindowFeature(Window.FEATURE_INDETERMINATE_PROGRESS);
		setContentView(R.layout.main);
		Button bn1 = (Button)findViewById(R.id.bn01);
		Button bn2 = (Button)findViewById(R.id.bn02);
		bn1.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View source)
			{
				//ÏÔÊ¾²»´ø½ø¶ÈµÄ½ø¶ÈÌõ¡£
				setProgressBarIndeterminateVisibility(true);
				//ÏÔÊ¾´ø½ø¶ÈµÄ½ø¶ÈÌõ¡£
				setProgressBarVisibility(true);
				//ÉèÖÃ½ø¶ÈÌõµÄ½ø¶È
				setProgress(4500);	
				
			}
		});
		bn2.setOnClickListener(new OnClickListener()
		{
			@Override
			public void onClick(View source)
			{
				//Òþ²Ø²»´ø½ø¶ÈµÄ½ø¶ÈÌõ¡£
				setProgressBarIndeterminateVisibility(false);
				//Òþ²Ø´ø½ø¶ÈµÄ½ø¶ÈÌõ¡£
				setProgressBarVisibility(false);
			}
		});	
	}
}