Giter VIP home page Giter VIP logo

Comments (8)

JDSCaram avatar JDSCaram commented on August 20, 2024 4

@KingsMentor
I am with same problem, I realized that when init the screen the camera preview is compressed, however I go to other screen and back to camera preview without killing the instance the preview, the screen is normal, does not get compressed

Edit:
This code solved the problem for me.
barcodeCapture = childFragmentManager.findFragmentById(R.id.fragment) as BarcodeCapture? barcodeCapture?.setRetrieval(this) barcodePreview = barcodeCapture?.view?.findViewById(R.id.preview) as? CameraSourcePreview barcodeCapture?.view?.post { barcodePreview?.requestLayout() }

from mobilevisionbarcodescanner.

doruchidean-lifeishard avatar doruchidean-lifeishard commented on August 20, 2024 1

@KingsMentor
I am with same problem, I realized that when init the screen the camera preview is compressed, however I go to other screen and back to camera preview without killing the instance the preview, the screen is normal, does not get compressed

Edit:
This code solved the problem for me.
barcodeCapture = childFragmentManager.findFragmentById(R.id.fragment) as BarcodeCapture? barcodeCapture?.setRetrieval(this) barcodePreview = barcodeCapture?.view?.findViewById(R.id.preview) as? CameraSourcePreview barcodeCapture?.view?.post { barcodePreview?.requestLayout() }

@JDSCaram 's suggestion fixed the issue for me. Here is a java code equivalent:
final View barcodePreview = barcodeCapture.getView().findViewById(R.id.preview);
barcodeCapture.getView().post(new Runnable() {
@OverRide
public void run() {
barcodePreview.requestLayout();
}
});

from mobilevisionbarcodescanner.

darkkillen avatar darkkillen commented on August 20, 2024

@KingsMentor Any update?

from mobilevisionbarcodescanner.

KingsMentor avatar KingsMentor commented on August 20, 2024

@darkkillen what version of the library are you using. Kindly confirm if it is 2.0.3

from mobilevisionbarcodescanner.

Glennmen avatar Glennmen commented on August 20, 2024

@KingsMentor I am having this same issue in 2.0.3
Maybe Actionbar is causing this? Not sure though

from mobilevisionbarcodescanner.

Glennmen avatar Glennmen commented on August 20, 2024

@KingsMentor Please explain why the latest release version 2.0.3 and the library master branch are not the same.
I tested the sample app from the project repo (after changing layout to fullscreen with toolbar) and the preview is not compressed.
When I replaced implementation project(':barcodescanner') with implementation 'xyz.belvi.mobilevision:barcodescanner:2.0.3' to test latest library release version the preview was compressed again.
I even reverted back to the sample app and only changed gradle to use the release library instead of the project library and the preview was also compressed.

I hope this information might help finding the source of the issue and releasing a fix for it.

from mobilevisionbarcodescanner.

tjvanos avatar tjvanos commented on August 20, 2024

Hey @KingsMentor,

Thank you for your library!

I have encountered the same problem. It occurs on phones with non usual aspect ratios like the huawai p20 pro and the samsung s9+. When i check the code i see that it uses the displayMetrics for the screen height and width, but i believe it should use the preview height and width. This will make the camera view stretch. I hope this information in combination with the following article can help you further in solving this problem.

https://stackoverflow.com/questions/19577299/android-camera-preview-stretched/22758359

Thanks in advance.

from mobilevisionbarcodescanner.

mksmartlabs avatar mksmartlabs commented on August 20, 2024

@KingsMentor
I am with same problem, I realized that when init the screen the camera preview is compressed, however I go to other screen and back to camera preview without killing the instance the preview, the screen is normal, does not get compressed
Edit:
This code solved the problem for me.
barcodeCapture = childFragmentManager.findFragmentById(R.id.fragment) as BarcodeCapture? barcodeCapture?.setRetrieval(this) barcodePreview = barcodeCapture?.view?.findViewById(R.id.preview) as? CameraSourcePreview barcodeCapture?.view?.post { barcodePreview?.requestLayout() }

@JDSCaram 's suggestion fixed the issue for me. Here is a java code equivalent:
final View barcodePreview = barcodeCapture.getView().findViewById(R.id.preview);
barcodeCapture.getView().post(new Runnable() {
@OverRide
public void run() {
barcodePreview.requestLayout();
}
});

Hi, i'm trying this but i continue to see the stretched preview. Is there any other way to solve it?

from mobilevisionbarcodescanner.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.