55import android .view .View ;
66import android .view .Window ;
77import android .view .WindowManager ;
8+ import android .view .animation .AlphaAnimation ;
89import android .view .animation .Animation ;
10+ import android .widget .FrameLayout ;
911import android .widget .TextView ;
10- import common .base .utils .CommonLog ;
12+
13+ import common .base .utils .ViewUtil ;
1114
1215/**
1316 * User: fee(1176610771@qq.com)
@@ -56,13 +59,21 @@ protected void onCreate(Bundle savedInstanceState) {
5659 @ Override
5760 protected void initViews () {
5861 splashAnimation = getAnimation4BackgroudImsg ();
59- if ( splashAnimation != null ) {
60- splashAnimation . setDuration ( splashDuringTime );
61- splashAnimation . setAnimationListener ( this );
62+ //added by fee 2016-12-06增加一些提升健壮性代码逻辑,以防止使用者不配置(赋值)一些必要的变量值
63+ if ( splashAnimation == null ) {
64+ splashAnimation = new AlphaAnimation ( 0.1f , 1.0f );
6265 }
63- if (toAnimView != null ) {
64- toAnimView .setAnimation (splashAnimation );
66+ if (splashDuringTime == 0 ) {
67+ splashDuringTime = 3000 ;
68+ }
69+ splashAnimation .setDuration (splashDuringTime );
70+ splashAnimation .setAnimationListener (this );
71+
72+ if (toAnimView == null ) {//使用者这都不想赋值,本基类为了动画能执行,只好自己造一个视图出来
73+ toAnimView = new FrameLayout (mContext );
74+ ViewUtil .getContentContainerView (this ).addView (toAnimView );
6575 }
76+ toAnimView .setAnimation (splashAnimation );
6677 if (tvBtnJumpOverSplash != null ) {
6778 tvBtnJumpOverSplash .setOnClickListener (this );
6879 }
@@ -131,7 +142,7 @@ protected Animation getAnimation4BackgroudImsg() {
131142 */
132143 @ Override
133144 public void onAnimationStart (Animation animation ) {
134- CommonLog . e (TAG , " --> onAnimationStart() " );
145+ e (TAG , " --> onAnimationStart() " );
135146 if (countDownTimer != null ) {//如果是广告展示,动画开始时则开始倒计时
136147 countDownTimer .start ();
137148 }
@@ -145,7 +156,7 @@ public void onAnimationStart(Animation animation) {
145156 */
146157 @ Override
147158 public void onAnimationEnd (Animation animation ) {
148- CommonLog . e (TAG ," --> onAnimationEnd() " );
159+ e (TAG ," --> onAnimationEnd() " );
149160 if (animation == splashAnimation ) {
150161 if (countDownTimer == null ) {//如果没有倒计时,则依据闪屏动画完成了来自动跳转,否则依据用户直接点击跳过或者倒计时完成
151162 //动画完成了,跳转到目标界面,子类区分实现
0 commit comments