1 privateShakeManager shake;2
3 shake.setShakeListener(newShakeManager.ShakeListener() {4 @Override5 public voidonShake() {6 QiStart();7 shake.stop();8 canrads.setVisibility(View.GONE);9 soundPool.play(map.get(1),0.3f,0.3f,1,0,0);10 }11 });12
13
14
15 /**
16 * 开始动画17 */
18 private voidQiStart() {19 TranslateAnimation up = newTranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f20 ,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,-0.3f);21 up.setDuration(600L);22 up.setRepeatCount(1);23 up.setRepeatMode(Animation.REVERSE);24 imageshang.startAnimation(up);25
26 TranslateAnimation down = newTranslateAnimation(Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0f27 ,Animation.RELATIVE_TO_SELF,0f,Animation.RELATIVE_TO_SELF,0.3f);28 down.setDuration(600L);29 down.setRepeatCount(1);30 down.setRepeatMode(Animation.REVERSE);31 imagexia.startAnimation(down);32
33 down.setAnimationListener(newAnimation.AnimationListener() {34 @Override35 public voidonAnimationStart(Animation animation) {36
37 }38 @Override39 public voidonAnimationEnd(Animation animation) {40 xian2.setVisibility(View.VISIBLE);41 newRequestClient(getContext(),requestConfig){42
43 @Override44 protected voidloadSuccess(String result) {45 try{46 result = new String(result.getBytes("ISO-8859-1"),"UTF-8");47 } catch(UnsupportedEncodingException e) {48 e.printStackTrace();49 }50 shakeb = JSONParseUtil.parseObject(result,Shakeb.class);51 assert shakeb != null;52 String title = shakeb.getOwner()!=null ? shakeb.getOwner().getName():"";53 tv_neirong.setText(title);54 tv_biaoti.setText(shakeb.getDescription());55 tv_chakan.setText(String.valueOf(shakeb.getForks_count()));56 tv_xingxing.setText(String.valueOf(shakeb.getStars_count()));57 tv_disange.setText(String.valueOf(shakeb.getWatches_count()));58 //获取图片地址
59 String imageUrl =shakeb.getOwner().getNew_portrait();60 ImageLoader imageLoader =ImageLoaderFactory.getImageLoader();61 //加载图片
62 imageLoader.loadImage(imageUrl,roundImageView);63 //隐藏正在加载
64 xian2.setVisibility(View.GONE);65 //播放声音
66 soundPool.play(map.get(0),0.3f,0.3f,1,0,0);67 //显示推举项目
68 canrads.setVisibility(View.VISIBLE);69 //摇一摇监听开始
70 shake.start();71 }72
73 @Override74 protected voidloadFail() {75
76 }77 }.get(RequestAPI.SHAKE);78 }79
80 @Override81 public voidonAnimationRepeat(Animation animation) {82
83 }84 });85
86 }