glide에서 사용되는 것을 bitmap으로 변환함
public static Bitmap getBitmapFromDrawable(ImageView iv){
Logger.log("#688 iv->"+iv.getDrawable());
Bitmap bitmap = null;
Drawable drawable = iv.getDrawable();
if(drawable == null){
return bitmap;
}
if (drawable instanceof GlideBitmapDrawable) {
bitmap = ((GlideBitmapDrawable) drawable).getBitmap();
} else if (drawable instanceof TransitionDrawable) {
TransitionDrawable transitionDrawable = (TransitionDrawable) drawable;
int length = transitionDrawable.getNumberOfLayers();
for (int i = 0; i < length; ++i) {
Drawable child = transitionDrawable.getDrawable(i);
if (child instanceof GlideBitmapDrawable) {
bitmap = ((GlideBitmapDrawable) child).getBitmap();
break;
} else if (child instanceof SquaringDrawable
&& child.getCurrent() instanceof GlideBitmapDrawable) {
bitmap = ((GlideBitmapDrawable) child.getCurrent()).getBitmap();
break;
}
}
} else if (drawable instanceof SquaringDrawable) {
bitmap = ((GlideBitmapDrawable) drawable.getCurrent()).getBitmap();
}
return bitmap;
}
'Programming > Android' 카테고리의 다른 글
android ViewPager 무한 반복 looping (0) | 2017.08.01 |
---|---|
android 카메라 전환 (0) | 2017.07.13 |
android 디바이스 화면 크기 구하기 (0) | 2017.06.23 |
android Fragment에서 Activity 메소드 사용하기 (0) | 2017.05.26 |
android media play (0) | 2017.05.12 |