public void hideToFromView() { if (vFrom != null) { AlphaAnimation animAlpha = new AlphaAnimation(1, 0); animAlpha.setDuration(AnimationDuration); vMask.startAnimation(animAlpha); int x = 0; int y = (screenHeight - statusBarHeight - screenWidth) / 2 + statusBarHeight; int[] location = new int[2]; vFrom.getLocationInWindow(location); int toX = location[0]; int toY = location[1]; float scale = (float) vFrom.getWidth() / (float) UIUtil.getScreenWidth(); ScaleAnimation animScale = new ScaleAnimation(1, scale, 1, scale); animScale.setDuration(AnimationDuration); TranslateAnimation animTrans = new TranslateAnimation(0, toX - x, 0, toY - y); animTrans.setDuration(AnimationDuration); AnimationSet animSet = new AnimationSet(true); animSet.addAnimation(animScale); animSet.addAnimation(animTrans); flImages.startAnimation(animSet); postDelayed( new Runnable() { @Override public void run() { setVisibility(View.GONE); } }, AnimationDuration); } else { setVisibility(View.GONE); } }
public void showPicFromPosition( final String content, final Bitmap placeHolder, final int x, final int y, final int width) { initView(); setVisibility(View.VISIBLE); iv.setVisibility(View.INVISIBLE); ivPlaceHolder.setImageBitmap(placeHolder); final int size = Math.min(screenHeight, screenWidth); new Thread() { public void run() { final Bitmap bmp = Qr.bitmap(content, size); post( new Runnable() { @Override public void run() { iv.setImageBitmap(bmp); iv.setVisibility(View.VISIBLE); } }); }; }.start(); AlphaAnimation animAlpha = new AlphaAnimation(0, 1); animAlpha.setDuration(AnimationDuration); vMask.startAnimation(animAlpha); int toX = 0; int toY = (screenHeight - statusBarHeight - screenWidth) / 2 + statusBarHeight; int toWidth = UIUtil.getScreenWidth(); float scale = (float) width / (float) toWidth; ScaleAnimation animScale = new ScaleAnimation(scale, 1, scale, 1); animScale.setDuration(AnimationDuration); TranslateAnimation animTrans = new TranslateAnimation(x - toX, 0, y - toY, 0); animTrans.setDuration(AnimationDuration); AnimationSet animSet = new AnimationSet(true); animSet.setFillBefore(true); animSet.setDuration(AnimationDuration); animSet.addAnimation(animScale); animSet.addAnimation(animTrans); flImages.startAnimation(animSet); }
private void configureTopBarSize() { int sideBarSize = UIUtil.getScreenWidth() / 3 - UIUtil.getScreenWidth() / 18; tbtnMessage.getLayoutParams().width = sideBarSize; tbtnMe.getLayoutParams().width = sideBarSize; }
private void firstInit() { statusBarHeight = ImageManageUtil.getStatusBarHeight(BitherApplication.hotActivity.getWindow()); screenHeight = UIUtil.getScreenHeight(); screenWidth = UIUtil.getScreenWidth(); }