2016년 3월 24일 목요일

바코드스캐너#안드로이드 해상도와 무관하게 스캔영역 넓히기



바코드스캐너
#안드로이드 해상도와 무관하게 스캔영역 넓히기



소스)

CameraManager.java

/**
   * Calculates the framing rect which the UI should draw to show the user where to place the
   * barcode. This target helps with alignment as well as forces the user to hold the device
   * far enough away to ensure the image will be in focus.
   *
   * @return The rectangle to draw on screen in window coordinates.
   */
  public synchronized Rect getFramingRect() {
  if (framingRect == null) {
      if (camera == null) {
        return null;
      }
      Point screenResolution = configManager.getScreenResolution();
      int width = screenResolution.x * 3 / 4;
 
      int height = screenResolution.y * 3 / 4;
      Log.v("Framing rect is : ", "width is "+width+"   and height is "+height);
      int leftOffset = (screenResolution.x - width) / 2;
      int topOffset = (screenResolution.y - height) / 2;
      framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
      Log.d(TAG, "Calculated framing rect: " + framingRect);
  }
  return framingRect;

  /*if (framingRect == null) {
      if (camera == null) {
        return null;
      }
      Point screenResolution = configManager.getScreenResolution();
      if (screenResolution == null) {
        // Called early, before init even finished
        return null;
      }
      int width = findDesiredDimensionInRange(screenResolution.x, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH);
      int height = findDesiredDimensionInRange(screenResolution.y, MIN_FRAME_HEIGHT, MAX_FRAME_HEIGHT);
      int leftOffset = (screenResolution.x - width) / 2;
      int topOffset = (screenResolution.y - height) / 2;
      framingRect = new Rect(leftOffset, topOffset, leftOffset + width, topOffset + height);
      Log.d(TAG, "Calculated framing rect: " + framingRect);
      }
      return framingRect;*/
  }

* 해상도와 무관하게 스캔의 영역을 넓혀줘요

==========================================

소스) 캡춰 화면



* 안드로이드 어플중에 대만에서 만든 바코드 스캐너, 큐알스캐너 어플이 있는데, 아주 심플하지만  인기가 좋은  이유가 있었다,
지인중에 기획력이 뛰어난 분이 면밀히 검토한 결과 발견했는데, 미묘한 차이점 중 하나가 스캔영역을 넓혀주니 스캔이 잘되게 해주는 편리함을 제공해주니 인기가 좋다,,,
이외에  간단하면서도 군더더기가 없었던게 인기의 비결이었다고 해요

- 안드로이드 어플 개발하는데 있어서의 핵심 포인트는 편리함과 안정성

즐거운 시간 보내세요~

댓글 없음:

댓글 쓰기