Java Code Examples for org.telegram.messenger.ApplicationLoader#getFilesDirFixed()

The following examples show how to use org.telegram.messenger.ApplicationLoader#getFilesDirFixed() . 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: InstantCameraView.java    From Telegram-FOSS with GNU General Public License v2.0 6 votes vote down vote up
private void saveLastCameraBitmap() {
    Bitmap bitmap = textureView.getBitmap();
    if (bitmap != null && bitmap.getPixel(0, 0) != 0) {
        lastBitmap = Bitmap.createScaledBitmap(textureView.getBitmap(), 80, 80, true);
        if (lastBitmap != null) {
            Utilities.blurBitmap(lastBitmap, 7, 1, lastBitmap.getWidth(), lastBitmap.getHeight(), lastBitmap.getRowBytes());
            try {
                File file = new File(ApplicationLoader.getFilesDirFixed(), "icthumb.jpg");
                FileOutputStream stream = new FileOutputStream(file);
                lastBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
            } catch (Throwable ignore) {

            }
        }
    }
}
 
Example 2
Source File: InstantCameraView.java    From Telegram with GNU General Public License v2.0 6 votes vote down vote up
private void saveLastCameraBitmap() {
    Bitmap bitmap = textureView.getBitmap();
    if (bitmap != null && bitmap.getPixel(0, 0) != 0) {
        lastBitmap = Bitmap.createScaledBitmap(textureView.getBitmap(), 80, 80, true);
        if (lastBitmap != null) {
            Utilities.blurBitmap(lastBitmap, 7, 1, lastBitmap.getWidth(), lastBitmap.getHeight(), lastBitmap.getRowBytes());
            try {
                File file = new File(ApplicationLoader.getFilesDirFixed(), "icthumb.jpg");
                FileOutputStream stream = new FileOutputStream(file);
                lastBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
            } catch (Throwable ignore) {

            }
        }
    }
}
 
Example 3
Source File: PhotoAttachCameraCell.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
public void updateBitmap() {
    Bitmap bitmap = null;
    try {
        File file = new File(ApplicationLoader.getFilesDirFixed(), "cthumb.jpg");
        bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
    } catch (Throwable ignore) {

    }
    if (bitmap != null) {
        backgroundView.setImageBitmap(bitmap);
    } else {
        backgroundView.setImageResource(R.drawable.icplaceholder);
    }
}
 
Example 4
Source File: ChatAttachAlertPhotoLayout.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
private void saveLastCameraBitmap() {
    if (!canSaveCameraPreview) {
        return;
    }
    try {
        TextureView textureView = cameraView.getTextureView();
        Bitmap bitmap = textureView.getBitmap();
        if (bitmap != null) {
            Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), cameraView.getMatrix(), true);
            bitmap.recycle();
            bitmap = newBitmap;
            Bitmap lastBitmap = Bitmap.createScaledBitmap(bitmap, 80, (int) (bitmap.getHeight() / (bitmap.getWidth() / 80.0f)), true);
            if (lastBitmap != null) {
                if (lastBitmap != bitmap) {
                    bitmap.recycle();
                }
                Utilities.blurBitmap(lastBitmap, 7, 1, lastBitmap.getWidth(), lastBitmap.getHeight(), lastBitmap.getRowBytes());
                File file = new File(ApplicationLoader.getFilesDirFixed(), "cthumb.jpg");
                FileOutputStream stream = new FileOutputStream(file);
                lastBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
                lastBitmap.recycle();
            }
        }
    } catch (Throwable ignore) {

    }
}
 
Example 5
Source File: PhotoAttachCameraCell.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
public void updateBitmap() {
    Bitmap bitmap = null;
    try {
        File file = new File(ApplicationLoader.getFilesDirFixed(), "cthumb.jpg");
        bitmap = BitmapFactory.decodeFile(file.getAbsolutePath());
    } catch (Throwable ignore) {

    }
    if (bitmap != null) {
        backgroundView.setImageBitmap(bitmap);
    } else {
        backgroundView.setImageResource(R.drawable.icplaceholder);
    }
}
 
Example 6
Source File: ChatAttachAlertPhotoLayout.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
private void saveLastCameraBitmap() {
    if (!canSaveCameraPreview) {
        return;
    }
    try {
        TextureView textureView = cameraView.getTextureView();
        Bitmap bitmap = textureView.getBitmap();
        if (bitmap != null) {
            Bitmap newBitmap = Bitmap.createBitmap(bitmap, 0, 0, bitmap.getWidth(), bitmap.getHeight(), cameraView.getMatrix(), true);
            bitmap.recycle();
            bitmap = newBitmap;
            Bitmap lastBitmap = Bitmap.createScaledBitmap(bitmap, 80, (int) (bitmap.getHeight() / (bitmap.getWidth() / 80.0f)), true);
            if (lastBitmap != null) {
                if (lastBitmap != bitmap) {
                    bitmap.recycle();
                }
                Utilities.blurBitmap(lastBitmap, 7, 1, lastBitmap.getWidth(), lastBitmap.getHeight(), lastBitmap.getRowBytes());
                File file = new File(ApplicationLoader.getFilesDirFixed(), "cthumb.jpg");
                FileOutputStream stream = new FileOutputStream(file);
                lastBitmap.compress(Bitmap.CompressFormat.JPEG, 87, stream);
                lastBitmap.recycle();
            }
        }
    } catch (Throwable ignore) {

    }
}