예제 #1
1
  public CamInitSetting(Camera cam, Activity activity, String orentation) {
    try {
      this.activity = activity;
      this.cam = cam;
      deviceData = new DeviceData();
      devicearraydata =
          deviceData.getDeviceCamSetting(Deviceinfo.BUILD_MODEL, orentation, activity);

      PrintLog.print(activity.getApplicationContext(), Deviceinfo.BUILD_MODEL);
      PrintLog.print(
          activity.getApplicationContext(), Deviceinfo.getDeviceScreenOrentation(activity));
      PrintLog.print(
          activity.getApplicationContext(),
          "W"
              + Deviceinfo.getDeviceScreenSize(activity)[0]
              + "|H"
              + Deviceinfo.getDeviceScreenSize(activity)[1]
              + "|A"
              + Deviceinfo.getStatusBarHeight(activity));

      setCameraDisplaySetting();

    } catch (Exception e) {
      Log.e(TAG, "cam is null", e);
    }
  }
예제 #2
0
 /**
  * Returns a <code>DeviceData</code> based on the receiver. Modifications made to this <code>
  * DeviceData</code> will not affect the receiver.
  *
  * @return a <code>DeviceData</code> containing the device's data and attributes
  * @exception SWTException
  *     <ul>
  *       <li>ERROR_DEVICE_DISPOSED - if the receiver has been disposed
  *     </ul>
  *
  * @see DeviceData
  */
 public DeviceData getDeviceData() {
   checkDevice();
   DeviceData data = new DeviceData();
   data.debug = debug;
   data.tracking = tracking;
   if (tracking) {
     synchronized (trackingLock) {
       int count = 0, length = objects.length;
       for (int i = 0; i < length; i++) {
         if (objects[i] != null) count++;
       }
       int index = 0;
       data.objects = new Object[count];
       data.errors = new Error[count];
       for (int i = 0; i < length; i++) {
         if (objects[i] != null) {
           data.objects[index] = objects[i];
           data.errors[index] = errors[i];
           index++;
         }
       }
     }
   } else {
     data.objects = new Object[0];
     data.errors = new Error[0];
   }
   return data;
 }
예제 #3
0
  public CamInitSetting(Camera cam, Activity activity, String orentation, SurfaceView sufview) {
    try {
      this.activity = activity;
      this.cam = cam;
      deviceData = new DeviceData();
      devicearraydata =
          deviceData.getDeviceCamSetting(Deviceinfo.BUILD_MODEL, orentation, activity);

      PrintLog.print(activity.getApplicationContext(), Deviceinfo.BUILD_MODEL);
      PrintLog.print(
          activity.getApplicationContext(), Deviceinfo.getDeviceScreenOrentation(activity));
      PrintLog.print(
          activity.getApplicationContext(),
          "W"
              + Deviceinfo.getDeviceScreenSize(activity)[0]
              + "|H"
              + Deviceinfo.getDeviceScreenSize(activity)[1]
              + "|A"
              + Deviceinfo.getStatusBarHeight(activity));

      if (Deviceinfo.BUILD_MODEL.contains("HTC")) {
        sufview.setLayoutParams(
            new ViewGroup.LayoutParams(
                Deviceinfo.getDeviceScreenSize(activity)[0],
                Deviceinfo.getDeviceScreenSize(activity)[1]));
      } else {
        int w = 0, h = 0;
        double per_of_apect = 0.0;
        per_of_apect =
            (((Deviceinfo.getDeviceScreenSize(activity)[1]
                            - Deviceinfo.getStatusBarHeight(activity))
                        * 100.0)
                    / Deviceinfo.getDeviceScreenSize(activity)[1])
                / 100;
        w = (int) ((cam.getParameters().getPreviewSize().height * 2) * (per_of_apect));
        h = Deviceinfo.getDeviceScreenSize(activity)[1] - Deviceinfo.getStatusBarHeight(activity);
        sufview.setLayoutParams(new ViewGroup.LayoutParams(w, h));
      }

      setCameraDisplaySetting();

    } catch (Exception e) {
      Log.e(TAG, "cam is null", e);
    }
  }