Permalink
Browse files

FIX. Not full drawing sticker;

Refactor. Sticker bitmap isMutable;
  • Loading branch information...
1 parent 9878bb0 commit 535031e054f748005828e5f50ed82e43073ef3a5 @nfirex committed Apr 17, 2012
Showing with 8 additions and 9 deletions.
  1. +8 −9 src/com/wagado/widget/StickySectionListView.java
@@ -20,6 +20,7 @@
import android.content.Context;
import android.graphics.Bitmap;
+import android.graphics.Bitmap.Config;
import android.graphics.Canvas;
import android.os.Parcel;
import android.os.Parcelable;
@@ -79,6 +80,10 @@ public void setAdapter(ListAdapter adapter) {
mParent = null;
mLayoutParams = null;
mStickerSection = null;
+ if (mStickerBitmap != null) {
+ mStickerBitmap.recycle();
+ }
+ mStickerBitmap = null;
}
}
@@ -214,13 +219,7 @@ protected void calculateStickerMargin () {
* @param canvas - Canvas for ListView, his child and blahblahblah
*/
protected void drawSticker(Canvas canvas) {
- if (mStickerSection.getHeight() == 0) {
- canvas.drawBitmap(mStickerBitmap, 0, mStickerMargin, null);
- } else {
- canvas.translate(0, mStickerMargin);
- mStickerSection.draw(canvas);
- canvas.translate(0, - mStickerMargin);
- }
+ canvas.drawBitmap(mStickerBitmap, 0, mStickerMargin, null);
}
/**
@@ -230,10 +229,10 @@ protected void drawSticker(Canvas canvas) {
protected Bitmap getBitmap(View view) {
view.setDrawingCacheEnabled(true);
view.measure(MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED), MeasureSpec.makeMeasureSpec(0, MeasureSpec.UNSPECIFIED));
- view.layout(0, 0, view.getMeasuredWidth(), view.getMeasuredHeight());
+ view.layout(0, 0, getWidth(), view.getMeasuredHeight());
view.buildDrawingCache(true);
- final Bitmap bitmap = Bitmap.createBitmap(view.getDrawingCache(true));
+ final Bitmap bitmap = view.getDrawingCache(true).copy(Config.ARGB_8888, true);
view.setDrawingCacheEnabled(false);

0 comments on commit 535031e

Please sign in to comment.