package com.deng.flashingmath;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.View;
import android.view.Window;
import android.view.animation.AlphaAnimation;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.widget.ImageView;
import android.widget.RelativeLayout;

import com.umeng.analytics.MobclickAgent;


public class Welcome extends Activity{
	
	
	private ImageView welcomeImg;
	
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		final View view = View.inflate(this, R.layout.welcome_page, null);
		
		
		setContentView(view);
		welcomeImg=(ImageView) findViewById(R.id.welcome_img);
		welcomeImg.setBackgroundResource(R.drawable.wellcomebg);
		
		DisplayMetrics dm = new DisplayMetrics();
		getWindowManager().getDefaultDisplay().getMetrics(dm);
		double diagonalPixels = Math.sqrt(Math.pow(dm.widthPixels, 2) + Math.pow(dm.heightPixels, 2));
		double screenSize = diagonalPixels / (160*dm.density);
		
		AlphaAnimation aa = new AlphaAnimation(0.1f,0.9f);
		aa.setDuration(2500);
		view.startAnimation(aa);
		aa.setAnimationListener(new AnimationListener()
		{
			public void onAnimationEnd(Animation arg0) {
				redirectTo();
		}
			public void onAnimationRepeat(Animation animation) {}
			public void onAnimationStart(Animation animation) {}
			
	   });
		
//		RelativeLayout container=(RelativeLayout)findViewById(R.id.container);
//		 new SplashAd(this, container, Constants.APPId, Constants.SplashPosId,
//					new SplashAdListener() {
//						@Override
//						public void onAdPresent() {
//
//						}
//
//						@Override
//						public void onAdFailed(int arg0) {
//							 redirectTo();
//						}
//
//						@Override
//						public void onAdDismissed() {
//							
//							 redirectTo();
//						}
//				});
		
	}

	public void onResume() {
		super.onResume();
		 MobclickAgent.onResume(this);
	 }
     public void onPause() {
		 super.onPause();
		 MobclickAgent.onPause(this);
  }

	private void redirectTo(){    
		Intent intent =new Intent(Welcome.this,MainActivity.class);
		startActivity(intent);
		finish();
		overridePendingTransition(R.anim.zoomin, R.anim.zoomout);
    }
}


@@ -1517,473 +1517,8 @@
  %7D);
-%0A%09%09%0A//%09%09RelativeLayout container=(RelativeLayout)findViewById(R.id.container);%0A//%09%09 new SplashAd(this, container, Constants.APPId, Constants.SplashPosId,%0A//%09%09%09%09%09new SplashAdListener() %7B%0A//%09%09%09%09%09%09@Override%0A//%09%09%09%09%09%09public void onAdPresent() %7B%0A//%0A//%09%09%09%09%09%09%7D%0A//%0A//%09%09%09%09%09%09@Override%0A//%09%09%09%09%09%09public void onAdFailed(int arg0) %7B%0A//%09%09%09%09%09%09%09 redirectTo();%0A//%09%09%09%09%09%09%7D%0A//%0A//%09%09%09%09%09%09@Override%0A//%09%09%09%09%09%09public void onAdDismissed() %7B%0A//%09%09%09%09%09%09%09%0A//%09%09%09%09%09%09%09 redirectTo();%0A//%09%09%09%09%09%09%7D%0A//%09%09%09%09%7D);%0A%09
 %09%0A%09%7D

Update Welcome.java