Guest User

Untitled

a guest
Apr 24th, 2018
71
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.45 KB | None | 0 0
  1. class C03012 implements Runnable {
  2. C03012() {
  3. }
  4.  
  5. public void run() {
  6. Camera.this.StartCamera();
  7. }
  8. }
  9.  
  10. public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
  11. this.startCameraHandler = new Handler();
  12. this.mScannerView = new ZXingScannerView(getActivity()) {
  13. };
  14. this.mScannerView.setResultHandler(this);
  15. return this.mScannerView;
  16. }
  17.  
  18. public void onResume() {
  19. super.onResume();
  20. ResumeCamera();
  21. }
  22.  
  23. public void handleResult(Result rawResult) {
  24. String sendTxt;
  25. sendTxt = rawResult.toString();
  26. ((MainActivity)getActivity()).recibirTexto(sendTxt);
  27.  
  28. this.startCameraHandler.postDelayed(this.DelayedStartCamera, 0001);
  29. }
  30.  
  31. private void ResumeCamera() {
  32. try {
  33. this.mScannerView.setAutoFocus(mAutoFocus);
  34. StartCamera();
  35. } catch (Exception e) {
  36. e.printStackTrace();
  37. try {
  38. mAutoFocus = false;
  39. this.mScannerView.setAutoFocus(mAutoFocus);
  40. StartCamera();
  41.  
  42. } catch (Exception e2) {
  43. e2.printStackTrace();
  44. }
  45. }
  46. }
  47.  
  48. private void StartCamera() {
  49. if (mCameraId != -1) {
  50. this.mScannerView.startCamera(mCameraId);
  51. } else {
  52. this.mScannerView.startCamera();
  53. }
  54. }
  55.  
  56. private void StopCamera() {
  57. this.startCameraHandler.removeCallbacks(this.DelayedStartCamera);
  58. this.mScannerView.stopCamera();
  59. }
  60.  
  61.  
  62. public void onPause() {
  63. super.onPause();
  64. StopCamera();
  65. }
Add Comment
Please, Sign In to add comment