Delete drawing cache after usage
This commit is contained in:
parent
bd6a98725f
commit
83ead3a358
@ -850,16 +850,25 @@ public class IITC_Mobile extends Activity
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void sendScreenshot() {
|
private void sendScreenshot() {
|
||||||
mIitcWebView.setDrawingCacheEnabled(true);
|
Bitmap bitmap = mIitcWebView.getDrawingCache();
|
||||||
final Bitmap bitmap = mIitcWebView.getDrawingCache();
|
|
||||||
if (bitmap == null) {
|
if (bitmap == null) {
|
||||||
Log.e("getDrawingCache() returned null!");
|
mIitcWebView.buildDrawingCache();
|
||||||
return;
|
bitmap = mIitcWebView.getDrawingCache();
|
||||||
|
if (bitmap == null) {
|
||||||
|
Log.e("could not get bitmap!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
bitmap = Bitmap.createBitmap(bitmap);
|
||||||
|
if (!mIitcWebView.isDrawingCacheEnabled()) mIitcWebView.destroyDrawingCache();
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
bitmap = Bitmap.createBitmap(bitmap);
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
final File cache = getExternalCacheDir();
|
final File cache = getExternalCacheDir();
|
||||||
final File file = File.createTempFile("IITC screenshot", ".png", cache);
|
final File file = File.createTempFile("IITC screenshot", ".png", cache);
|
||||||
if (!Bitmap.createBitmap(bitmap).compress(CompressFormat.PNG, 100, new FileOutputStream(file))) {
|
if (!bitmap.compress(CompressFormat.PNG, 100, new FileOutputStream(file))) {
|
||||||
// quality is ignored by PNG
|
// quality is ignored by PNG
|
||||||
throw new IOException("Could not compress bitmap!");
|
throw new IOException("Could not compress bitmap!");
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user