Java Code Examples for com.android.gallery3d.common.Utils#closeSilently()

The following examples show how to use com.android.gallery3d.common.Utils#closeSilently() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BitmapRegionTileSource.java    From Trebuchet with GNU General Public License v3.0 6 votes vote down vote up
@Override
public SimpleBitmapRegionDecoder loadBitmapRegionDecoder() {
    try {
        InputStream is = regenerateInputStream();
        SimpleBitmapRegionDecoder regionDecoder =
                SimpleBitmapRegionDecoderWrapper.newInstance(is, false);
        Utils.closeSilently(is);
        if (regionDecoder == null) {
            is = regenerateInputStream();
            regionDecoder = DumbBitmapRegionDecoder.newInstance(is);
            Utils.closeSilently(is);
        }
        return regionDecoder;
    } catch (FileNotFoundException e) {
        Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
        return null;
    }
}
 
Example 2
Source File: BitmapRegionTileSource.java    From TurboLauncher with Apache License 2.0 6 votes vote down vote up
@Override
public SimpleBitmapRegionDecoder loadBitmapRegionDecoder() {
    try {
        InputStream is = regenerateInputStream();
        SimpleBitmapRegionDecoder regionDecoder =
                SimpleBitmapRegionDecoderWrapper.newInstance(is, false);
        Utils.closeSilently(is);
        if (regionDecoder == null) {
            is = regenerateInputStream();
            regionDecoder = DumbBitmapRegionDecoder.newInstance(is);
            Utils.closeSilently(is);
        }
        return regionDecoder;
    } catch (FileNotFoundException e) {
        Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
        return null;
    }
}
 
Example 3
Source File: BitmapRegionTileSource.java    From LB-Launcher with Apache License 2.0 6 votes vote down vote up
@Override
public SimpleBitmapRegionDecoder loadBitmapRegionDecoder() {
    try {
        InputStream is = regenerateInputStream();
        SimpleBitmapRegionDecoder regionDecoder =
                SimpleBitmapRegionDecoderWrapper.newInstance(is, false);
        Utils.closeSilently(is);
        if (regionDecoder == null) {
            is = regenerateInputStream();
            regionDecoder = DumbBitmapRegionDecoder.newInstance(is);
            Utils.closeSilently(is);
        }
        return regionDecoder;
    } catch (FileNotFoundException e) {
        Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
        return null;
    }
}
 
Example 4
Source File: BitmapRegionTileSource.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public Bitmap loadPreviewBitmap(BitmapFactory.Options options) {
    try {
        InputStream is = regenerateInputStream();
        Bitmap b = BitmapFactory.decodeStream(is, null, options);
        Utils.closeSilently(is);
        return b;
    } catch (FileNotFoundException e) {
        Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
        return null;
    }
}
 
Example 5
Source File: BitmapRegionTileSource.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public SimpleBitmapRegionDecoder loadBitmapRegionDecoder() {
    InputStream is = regenerateInputStream();
    SimpleBitmapRegionDecoder regionDecoder =
            SimpleBitmapRegionDecoderWrapper.newInstance(is, false);
    Utils.closeSilently(is);
    if (regionDecoder == null) {
        is = regenerateInputStream();
        regionDecoder = DumbBitmapRegionDecoder.newInstance(is);
        Utils.closeSilently(is);
    }
    return regionDecoder;
}
 
Example 6
Source File: BitmapRegionTileSource.java    From Trebuchet with GNU General Public License v3.0 5 votes vote down vote up
@Override
public boolean readExif(ExifInterface ei) {
    try {
        InputStream is = regenerateInputStream();
        ei.readExif(is);
        Utils.closeSilently(is);
        return true;
    } catch (IOException e) {
        Log.e("BitmapRegionTileSource", "Error reading resource", e);
        return false;
    }
}
 
Example 7
Source File: WallpaperCropActivity.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
public Point getImageBounds() {
    InputStream is = regenerateInputStream();
    if (is != null) {
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(is, null, options);
        Utils.closeSilently(is);
        if (options.outWidth != 0 && options.outHeight != 0) {
            return new Point(options.outWidth, options.outHeight);
        }
    }
    return null;
}
 
Example 8
Source File: BitmapRegionTileSource.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
@Override
public Bitmap loadPreviewBitmap(BitmapFactory.Options options) {
    try {
        InputStream is = regenerateInputStream();
        Bitmap b = BitmapFactory.decodeStream(is, null, options);
        Utils.closeSilently(is);
        return b;
    } catch (FileNotFoundException e) {
        Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
        return null;
    }
}
 
Example 9
Source File: BitmapRegionTileSource.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
@Override
public SimpleBitmapRegionDecoder loadBitmapRegionDecoder() {
    InputStream is = regenerateInputStream();
    SimpleBitmapRegionDecoder regionDecoder =
            SimpleBitmapRegionDecoderWrapper.newInstance(is, false);
    Utils.closeSilently(is);
    if (regionDecoder == null) {
        is = regenerateInputStream();
        regionDecoder = DumbBitmapRegionDecoder.newInstance(is);
        Utils.closeSilently(is);
    }
    return regionDecoder;
}
 
Example 10
Source File: BitmapRegionTileSource.java    From TurboLauncher with Apache License 2.0 5 votes vote down vote up
@Override
public boolean readExif(ExifInterface ei) {
    try {
        InputStream is = regenerateInputStream();
        ei.readExif(is);
        Utils.closeSilently(is);
        return true;
    } catch (IOException e) {
        Log.e("BitmapRegionTileSource", "Error reading resource", e);
        return false;
    }
}
 
Example 11
Source File: WallpaperCropActivity.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
public Point getImageBounds() {
    InputStream is = regenerateInputStream();
    if (is != null) {
        BitmapFactory.Options options = new BitmapFactory.Options();
        options.inJustDecodeBounds = true;
        BitmapFactory.decodeStream(is, null, options);
        Utils.closeSilently(is);
        if (options.outWidth != 0 && options.outHeight != 0) {
            return new Point(options.outWidth, options.outHeight);
        }
    }
    return null;
}
 
Example 12
Source File: BitmapRegionTileSource.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
@Override
public Bitmap loadPreviewBitmap(BitmapFactory.Options options) {
    try {
        InputStream is = regenerateInputStream();
        Bitmap b = BitmapFactory.decodeStream(is, null, options);
        Utils.closeSilently(is);
        return b;
    } catch (FileNotFoundException e) {
        Log.e("BitmapRegionTileSource", "Failed to load URI " + mUri, e);
        return null;
    }
}
 
Example 13
Source File: BitmapRegionTileSource.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
@Override
public SimpleBitmapRegionDecoder loadBitmapRegionDecoder() {
    InputStream is = regenerateInputStream();
    SimpleBitmapRegionDecoder regionDecoder =
            SimpleBitmapRegionDecoderWrapper.newInstance(is, false);
    Utils.closeSilently(is);
    if (regionDecoder == null) {
        is = regenerateInputStream();
        regionDecoder = DumbBitmapRegionDecoder.newInstance(is);
        Utils.closeSilently(is);
    }
    return regionDecoder;
}
 
Example 14
Source File: BitmapRegionTileSource.java    From LB-Launcher with Apache License 2.0 5 votes vote down vote up
@Override
public boolean readExif(ExifInterface ei) {
    try {
        InputStream is = regenerateInputStream();
        ei.readExif(is);
        Utils.closeSilently(is);
        return true;
    } catch (IOException e) {
        Log.e("BitmapRegionTileSource", "Error reading resource", e);
        return false;
    }
}