更新小智形象动画

This commit is contained in:
wangcongtao
2021-01-12 11:08:16 +08:00
parent 7c38f180a8
commit b35be5f7fb
5 changed files with 29 additions and 7 deletions

View File

@@ -513,7 +513,20 @@ public class AnimRes {
0
};
// 背景
public static final int sBkgRes[] = {
R.drawable.ic_common_bkg,
R.drawable.ic_common_bkg,
R.drawable.ic_common_bkg,
R.drawable.ic_common_bkg,
R.drawable.ic_common_bkg,
R.drawable.ic_runningg_bkg,
R.drawable.ic_common_bkg,
R.drawable.ic_common_bkg
};
public static final int sKeyPointOfNavigation = 16;
public static final int sCommonBkgRes = R.drawable.ic_common_bkg;
public static int sRes[] = sAll[0];
}

View File

@@ -21,7 +21,7 @@ public class AnimWrapper implements Anim {
public AnimWrapper( ImageView target, ImageView bkg ) {
if ( CarSeries.isF8xxSeries() ) {
bkg.setVisibility( View.VISIBLE );
mDelegate = new OthersAnim( target );
mDelegate = new OthersAnim( target, bkg );
} else {
mDelegate = new KitkatAnim( target );
}

View File

@@ -13,13 +13,16 @@ import android.widget.ImageView;
*/
public class OthersAnim implements Anim {
private ImageView mBkg;
private int mStartIndex = 0;
private final static int MSG_LOOP = 3003;
public static final int MSG_CHANGE = 3004;
public static final long INTERVAL = 50L;
public static final long FRAME_INTERVAL = 50L;
private boolean mStarted = false;
public static final long ANIM_INTERVAL = 15 * 1_000L;
private ImageView mImageView;
private int mEmojiIndex = 0;
@@ -39,7 +42,7 @@ public class OthersAnim implements Anim {
mStartIndex = mKeyPoint;
}
mImageView.setImageResource( AnimRes.sRes[mStartIndex++ % AnimRes.sRes.length] );
mHandler.sendEmptyMessageDelayed( MSG_LOOP, INTERVAL );
mHandler.sendEmptyMessageDelayed( MSG_LOOP, FRAME_INTERVAL );
}
break;
case MSG_CHANGE:
@@ -49,11 +52,12 @@ public class OthersAnim implements Anim {
mEmojiIndex++;
AnimRes.sRes = AnimRes.sAll[mEmojiIndex % AnimRes.sAll.length];
mKeyPoint = AnimRes.sKeyPoint[mEmojiIndex % AnimRes.sKeyPoint.length];
mBkg.setImageResource( AnimRes.sBkgRes[mEmojiIndex % AnimRes.sBkgRes.length] );
mStartIndex = 0;
if ( start ) {
start();
}
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 60 * 1_000L );
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, ANIM_INTERVAL );
}
break;
}
@@ -62,10 +66,12 @@ public class OthersAnim implements Anim {
private AnimRes.EmojiType mLastType;
public OthersAnim( ImageView imageView ) {
public OthersAnim( ImageView imageView, ImageView bkg ) {
this.mImageView = imageView;
mBkg = bkg;
mLastType = AnimRes.EmojiType.Others;
AnimRes.sRes = AnimRes.sAll[mEmojiIndex];
mBkg.setImageResource( AnimRes.sCommonBkgRes );
}
@Override
@@ -75,7 +81,7 @@ public class OthersAnim implements Anim {
}
mStarted = true;
mHandler.sendEmptyMessage( MSG_LOOP );
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 30 * 1_000L );
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, ANIM_INTERVAL );
}
@Override
@@ -96,14 +102,16 @@ public class OthersAnim implements Anim {
mStartIndex = 0;
mKeyPoint = AnimRes.sKeyPointOfNavigation;
AnimRes.sRes = AnimRes.sNavigation;
mBkg.setImageResource( AnimRes.sCommonBkgRes );
break;
case Music:
mStartIndex = 0;
mKeyPoint = 0;
AnimRes.sRes = AnimRes.sMusic;
mBkg.setImageResource( AnimRes.sCommonBkgRes );
break;
case Others:
mHandler.sendEmptyMessageDelayed( MSG_CHANGE, 0 * 1_000L );
mHandler.sendEmptyMessage( MSG_CHANGE );
break;
}
}
@@ -113,5 +121,6 @@ public class OthersAnim implements Anim {
stop();
mHandler = null;
mImageView = null;
mBkg = null;
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB