use of android.graphics.drawable.BitmapDrawable in project Klyph by jonathangerbaud.
the class UserSettingsFragment method processImageResponse.
private void processImageResponse(String id, ImageResponse response) {
if (response != null) {
Bitmap bitmap = response.getBitmap();
if (bitmap != null) {
BitmapDrawable drawable = new BitmapDrawable(UserSettingsFragment.this.getResources(), bitmap);
drawable.setBounds(0, 0, getResources().getDimensionPixelSize(R.dimen.com_facebook_usersettingsfragment_profile_picture_width), getResources().getDimensionPixelSize(R.dimen.com_facebook_usersettingsfragment_profile_picture_height));
userProfilePic = drawable;
userProfilePicID = id;
connectedStateLabel.setCompoundDrawables(null, drawable, null, null);
connectedStateLabel.setTag(response.getRequest().getImageUri());
}
}
}
use of android.graphics.drawable.BitmapDrawable in project Talon-for-Twitter by klinker24.
the class PhotoFragment method shareImage.
public void shareImage() {
if (picture == null) {
return;
}
Bitmap bitmap = ((BitmapDrawable) picture.getDrawable()).getBitmap();
// create the intent
Intent sharingIntent = new Intent(android.content.Intent.ACTION_SEND);
sharingIntent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_WHEN_TASK_RESET);
sharingIntent.setType("image/*");
// add the bitmap uri to the intent
Uri uri = getImageUri(activity, bitmap);
sharingIntent.putExtra(Intent.EXTRA_STREAM, uri);
// start the chooser
startActivity(Intent.createChooser(sharingIntent, getString(R.string.menu_share) + ": "));
}
use of android.graphics.drawable.BitmapDrawable in project Talon-for-Twitter by klinker24.
the class ImageUtils method loadCircleImage.
public static void loadCircleImage(Context context, final ImageView iv, String url, BitmapLruCache mCache) {
BitmapDrawable wrapper = null;
if (url != null) {
wrapper = mCache.getFromMemoryCache(url);
}
if (null != wrapper && iv.getVisibility() != View.GONE) {
// The cache has it, so just display it
Log.v("talon_image_cache", "got image from cache");
iv.setImageDrawable(wrapper);
Animation fadeInAnimation = AnimationUtils.loadAnimation(context, R.anim.fade_in);
iv.startAnimation(fadeInAnimation);
} else if (url != null) {
// Memory Cache doesn't have the URL, do threaded request...
iv.setImageDrawable(null);
ImageUrlCircleAsyncTask mCurrentTask = new ImageUrlCircleAsyncTask(context, iv, mCache, false);
try {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
SDK11.executeOnThreadPool(mCurrentTask, url);
} else {
mCurrentTask.execute(url);
}
} catch (RejectedExecutionException e) {
// This shouldn't happen, but might.
}
}
}
use of android.graphics.drawable.BitmapDrawable in project SmartAndroidSource by jaychou2012.
the class DarkImageButton method createPressDrawable.
public Drawable createPressDrawable(Drawable d) {
Bitmap bitmap = ((BitmapDrawable) d).getBitmap().copy(Bitmap.Config.ARGB_8888, true);
Paint paint = new Paint();
paint.setColor(0x60000000);
RectF rect = new RectF(0, 0, bitmap.getWidth(), bitmap.getHeight());
new Canvas(bitmap).drawRoundRect(rect, 4, 4, paint);
return new BitmapDrawable(bitmap);
}
use of android.graphics.drawable.BitmapDrawable in project ImagePicker by jeasonlzy.
the class CropImageView method getCropBitmap.
/**
* @param expectWidth 期望的宽度
* @param exceptHeight 期望的高度
* @param isSaveRectangle 是否按矩形区域保存图片
* @return 裁剪后的Bitmap
*/
public Bitmap getCropBitmap(int expectWidth, int exceptHeight, boolean isSaveRectangle) {
if (expectWidth <= 0 || exceptHeight < 0)
return null;
Bitmap srcBitmap = ((BitmapDrawable) getDrawable()).getBitmap();
//最好用level,因为角度可能不是90的整数
srcBitmap = rotate(srcBitmap, sumRotateLevel * 90);
return makeCropBitmap(srcBitmap, mFocusRect, getImageMatrixRect(), expectWidth, exceptHeight, isSaveRectangle);
}
Aggregations