Cache objects to use less memory
This commit is contained in:
parent
03ac2f8b42
commit
6407f1101a
@ -1528,9 +1528,10 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
|
|||||||
public class LightningViewAdapter extends ArrayAdapter<LightningView> {
|
public class LightningViewAdapter extends ArrayAdapter<LightningView> {
|
||||||
|
|
||||||
Context context;
|
Context context;
|
||||||
|
ColorMatrix colorMatrix;
|
||||||
|
ColorMatrixColorFilter filter;
|
||||||
|
Paint paint;
|
||||||
int layoutResourceId;
|
int layoutResourceId;
|
||||||
|
|
||||||
List<LightningView> data = null;
|
List<LightningView> data = null;
|
||||||
|
|
||||||
public LightningViewAdapter(Context context, int layoutResourceId, List<LightningView> data) {
|
public LightningViewAdapter(Context context, int layoutResourceId, List<LightningView> data) {
|
||||||
@ -1586,13 +1587,15 @@ public class BrowserActivity extends ActionBarActivity implements BrowserControl
|
|||||||
favicon.getHeight(), Bitmap.Config.ARGB_8888);
|
favicon.getHeight(), Bitmap.Config.ARGB_8888);
|
||||||
|
|
||||||
Canvas c = new Canvas(grayscaleBitmap);
|
Canvas c = new Canvas(grayscaleBitmap);
|
||||||
Paint p = new Paint();
|
if (colorMatrix == null || filter == null || paint == null) {
|
||||||
ColorMatrix cm = new ColorMatrix();
|
paint = new Paint();
|
||||||
|
colorMatrix = new ColorMatrix();
|
||||||
cm.setSaturation(0);
|
colorMatrix.setSaturation(0);
|
||||||
ColorMatrixColorFilter filter = new ColorMatrixColorFilter(cm);
|
filter = new ColorMatrixColorFilter(colorMatrix);
|
||||||
p.setColorFilter(filter);
|
paint.setColorFilter(filter);
|
||||||
c.drawBitmap(favicon, 0, 0, p);
|
}
|
||||||
|
|
||||||
|
c.drawBitmap(favicon, 0, 0, paint);
|
||||||
holder.favicon.setImageBitmap(grayscaleBitmap);
|
holder.favicon.setImageBitmap(grayscaleBitmap);
|
||||||
}
|
}
|
||||||
return row;
|
return row;
|
||||||
|
Loading…
Reference in New Issue
Block a user