欢迎动画界面

package com.haoxee.haoxin.login.activity;

import android.content.Context;
import android.content.Intent;
import android.os.Build;
import android.os.Bundle;
import android.telephony.PhoneStateListener;
import android.telephony.TelephonyManager;
import android.util.Log;
import android.view.KeyEvent;
import android.view.View;
import android.view.animation.Animation;
import android.view.animation.Animation.AnimationListener;
import android.view.animation.AnimationUtils;

import com.haoxee.haoxin.R;
import com.haoxee.haoxin.common.Constants;
import com.haoxee.haoxin.common.activity.BaseActivity;
import com.haoxee.haoxin.push.client.ServiceManager;

public class StartupActivity extends BaseActivity implements AnimationListener {
    private Animation alphaAnimation = null;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        TelephonyManager tm = (TelephonyManager) this.getSystemService(Context.TELEPHONY_SERVICE);
        imei = tm.getDeviceId();
        imsi = tm.getSubscriberId();
        Constants.IMEI = imei;
        Log.i("", "Constants.IMEI:" + Constants.IMEI);
        Constants.IMSI = imsi;
        Constants.SDK_VERSION = Build.VERSION.SDK;
        Constants.SYS_VERSION = Build.VERSION.RELEASE;
        View image_View = getLayoutInflater().inflate(R.layout.activity_main, null);
        this.mainView.addView(image_View);
        alphaAnimation = AnimationUtils.loadAnimation(this, R.anim.welcome_alpha);
        alphaAnimation.setFillEnabled(true); // 启动Fill保持
        alphaAnimation.setFillAfter(true); // 设置动画的最后一帧是保持在View上面
        image_View.setAnimation(alphaAnimation);
        alphaAnimation.setAnimationListener(this); // 为动画设置监听
        TelListener myPhoneCallListener = new TelListener(StartupActivity.this);
        tm.listen(myPhoneCallListener, PhoneStateListener.LISTEN_CALL_STATE);
    }

    @Override
    public void onAnimationEnd(Animation animation) {
        // 动画结束时结束欢迎界面并转到软件的主界面
        Intent intent = new Intent(this, TeLoginActivity.class);
        startActivity(intent);
        this.finish();

    }

    @Override
    public void onAnimationRepeat(Animation animation) {

    }

    @Override
    public void onAnimationStart(Animation animation) {

    }

    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        // 在欢迎界面屏蔽BACK键
        if (keyCode == KeyEvent.KEYCODE_BACK) {
            return false;
        }
        return false;
    }


}

 

posted @ 2013-06-04 08:40  double0zhou  阅读(361)  评论(0编辑  收藏  举报