1 // 左右滚动算法,类似广告效果
2 public void twinklingBasketGifProgress() {
3 ProcessScreen processScreen=(ProcessScreen) Session.current.getNavigator().getCurrentScreen();
4 final Handler twinkNameHandler = processScreen.getCurrentHandler();
5 Runnable twinkNameTask = new Runnable() {
6 private boolean isForward = true;
7 private int twinkTimes = 0;
8 @Override
9 public void run() {
10 if (currentTwinklingIndex == twinklingBasketGif.length - 1) {
11 isForward = false;
12 }else if (currentTwinklingIndex == 0){
13 isForward = true;
14 twinkTimes ++;
15 }
16 if (isForward) {
17 currentTwinklingIndex++;
18 } else {
19 currentTwinklingIndex--;
20 }
21 myTaskbarImage.setImageResource(twinklingBasketGif[currentTwinklingIndex]);
22 if (twinkTimes <= 2) {
23 twinkNameHandler.postDelayed(this, 100);
24 }else {
25 myTaskbarImage.setImageBitmap(defaultBasketIcon);
26 currentTwinklingIndex = -1;
27 }
28 Log.e("", currentTwinklingIndex + "");
29 }
30 };
31 twinkNameHandler.postDelayed(twinkNameTask, 100);
32 }
2 public void twinklingBasketGifProgress() {
3 ProcessScreen processScreen=(ProcessScreen) Session.current.getNavigator().getCurrentScreen();
4 final Handler twinkNameHandler = processScreen.getCurrentHandler();
5 Runnable twinkNameTask = new Runnable() {
6 private boolean isForward = true;
7 private int twinkTimes = 0;
8 @Override
9 public void run() {
10 if (currentTwinklingIndex == twinklingBasketGif.length - 1) {
11 isForward = false;
12 }else if (currentTwinklingIndex == 0){
13 isForward = true;
14 twinkTimes ++;
15 }
16 if (isForward) {
17 currentTwinklingIndex++;
18 } else {
19 currentTwinklingIndex--;
20 }
21 myTaskbarImage.setImageResource(twinklingBasketGif[currentTwinklingIndex]);
22 if (twinkTimes <= 2) {
23 twinkNameHandler.postDelayed(this, 100);
24 }else {
25 myTaskbarImage.setImageBitmap(defaultBasketIcon);
26 currentTwinklingIndex = -1;
27 }
28 Log.e("", currentTwinklingIndex + "");
29 }
30 };
31 twinkNameHandler.postDelayed(twinkNameTask, 100);
32 }