[Question] Preview of taken photo
How can i make a preview after photo is taken.
I was trying with "FullScreenViewActivity" but fail :(
Can someone help?
ins't gallery button working for you? can you give more info?
It's working, all fine.
I want to make a preview of image after photo is taken, sometimes you shake your hand and photo can be bad, so automatic preview after photo shoot is good idea.
The main idea is to be able to scan multiple pages quickly, but I understand that some images can get low quality. It should be possible to open the image viewer with the new image right after it's taken but I think that it would be best to just put a link with a thumbnail on the side of the shutter button, sometimes the thumbnail will be good enough to just continue and get the next page.
Another idea is to show the image with a OK/DELETE right after its captured.
Yes i was planing to make a OK / DELETE based on FullScreenViewActivity, but don't know how to force a single image view.
I Think that the best option is a popover on the same view, this way the workflow gets faster: take picture, aprove, next picture, without the need to reinitialize the camera. It's possible to use the element of the animation.
The OK/DELETE would appear before the file is saved on the gallery
I make a simple preview with this code:
` private void SimplePreviewRun(String filename, ScannedDocument document) {
SimplePreviewRunClass runnable = new SimplePreviewRunClass(filename, document);
runOnUiThread(runnable);
}
class SimplePreviewRunClass implements Runnable {
//private void SimplePreviewRun(String filename, ScannedDocument document) {
private Size imageSize;
//private Point[] previewPoints = null;
//public Size previewSize = null;
public String fileName = null;
public int width;
public int height;
//private Bitmap bitmap;
private ImageLoader mImageLoader;
private ImageSize mTargetSize;
//private int maxTexture;
private int mMaxTexture;
public SimplePreviewRunClass(String filename, ScannedDocument document) {
this.fileName = filename;
this.imageSize = document.processed.size();
}
@Override
public void run() {
ImageLoaderConfiguration config = new ImageLoaderConfiguration.Builder(getApplicationContext()).build();
mImageLoader = ImageLoader.getInstance();
mImageLoader.init(config);
TouchImageView imgDisplay;
imgDisplay = (TouchImageView) findViewById(R.id.imgDisplay);
mMaxTexture = Utils.getMaxTextureSize();
Log.d("FullScreenViewActivity", "gl resolution: " + mMaxTexture);
mTargetSize = new ImageSize(mMaxTexture, mMaxTexture);
mImageLoader.displayImage("file:///" + fileName, imgDisplay, mTargetSize);
imgDisplay.setVisibility(View.VISIBLE);
Button deletePreviewBtn = findViewById(R.id.deletePreview);
Button savePreviewBtn = findViewById(R.id.savePreview);
deletePreviewBtn.setVisibility(View.VISIBLE);
savePreviewBtn.setVisibility(View.VISIBLE);
}
}
`
create two invisible buttons in main scanner view and:
` deletePreviewBtnL = (Button) findViewById(R.id.deletePreview); savePreviewBtnL = (Button) findViewById(R.id.savePreview);
deletePreviewBtnL.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Toast.makeText(getApplicationContext(), R.string.action_delete, Toast.LENGTH_LONG).show();
Button deletePreviewBtn = findViewById(R.id.deletePreview);
deletePreviewBtn.setVisibility(View.INVISIBLE);
Button savePreviewBtn = findViewById(R.id.savePreview);
savePreviewBtn.setVisibility(View.INVISIBLE);
ImageView imageView = findViewById(R.id.imgDisplay);
imageView.setVisibility(View.INVISIBLE);
//deletePreviewBtn.setOnClickListener(null);
//savePreviewBtn.setOnClickListener(null);
deleteLastFile();
}
});
savePreviewBtnL.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
//Strin confirmationText = R.string.save_confirmation;
//Toast.makeText(getApplicationContext(), confirmationText, Toast.LENGTH_LONG).show();
Button deletePreviewBtn = findViewById(R.id.deletePreview);
deletePreviewBtn.setVisibility(View.INVISIBLE);
Button savePreviewBtn = findViewById(R.id.savePreview);
savePreviewBtn.setVisibility(View.INVISIBLE);
ImageView imageView = findViewById(R.id.imgDisplay);
imageView.setVisibility(View.INVISIBLE);
//deletePreviewBtn.setOnClickListener(null);
//savePreviewBtn.setOnClickListener(null);
//uploadMedia(lastFile);
new Thread(uploadTask).start();
}
});
` We can make an checkbox in option to make a preview of taken photo or not.
Great @graczu0x0x0x0x0 , can you submit it through a pull request?
Yes i will, it's my first time working with github i need to get some knowlage first.