package com.marshalchen.common.uimodule.androidviewhover.tools;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.view.View;
import com.marshalchen.common.uimodule.nineoldandroids.view.ViewHelper;
public class Util {
public static Bitmap getViewBitmap(View v) {
if(v.getWidth() == 0 || v.getHeight() == 0)
return null;
Bitmap b = Bitmap.createBitmap( v.getWidth(), v.getHeight(), Bitmap.Config.ARGB_8888);
Canvas c = new Canvas(b);
v.draw(c);
return b;
}
public static void reset(View target) {
ViewHelper.setAlpha(target, 1);
ViewHelper.setScaleX(target, 1);
ViewHelper.setScaleY(target, 1);
ViewHelper.setTranslationX(target, 0);
ViewHelper.setTranslationY(target, 0);
ViewHelper.setRotation(target, 0);
ViewHelper.setRotationY(target, 0);
ViewHelper.setRotationX(target, 0);
ViewHelper.setPivotX(target, target.getMeasuredWidth() / 2.0f);
ViewHelper.setPivotY(target, target.getMeasuredHeight() / 2.0f);
}
}