示例#1
0
  @Override
  public ManualParameterInterface getCCTParameter() {
    // looks like wb-current-cct is loaded when the preview is up. this could be also for the other
    // parameters
    String wbModeval = "", wbmax = "", wbmin = "";

    if (parameters.get(KEYS.MAX_WB_CCT) != null) {
      wbmax = KEYS.MAX_WB_CCT;
    } else if (parameters.get(KEYS.MAX_WB_CT) != null) wbmax = KEYS.MAX_WB_CT;

    if (parameters.get(KEYS.MIN_WB_CCT) != null) {
      wbmin = KEYS.MIN_WB_CCT;
    } else if (parameters.get(KEYS.MIN_WB_CT) != null) wbmin = KEYS.MIN_WB_CT;

    if (arrayContainsString(parametersHandler.WhiteBalanceMode.GetValues(), KEYS.WB_MODE_MANUAL))
      wbModeval = KEYS.WB_MODE_MANUAL;
    else if (arrayContainsString(
        parametersHandler.WhiteBalanceMode.GetValues(), KEYS.WB_MODE_MANUAL_CCT))
      wbModeval = KEYS.WB_MODE_MANUAL_CCT;

    if (!wbmax.equals("") && !wbmin.equals("") && !wbModeval.equals("")) {
      Logger.d(TAG, "Found all wbct values:" + wbmax + " " + wbmin + " " + wbModeval);
      return new BaseCCTManual(parameters, wbmax, wbmin, cameraUiWrapper, 100, wbModeval);
    } else {
      Logger.d(TAG, "Failed to lookup wbct:" + " " + wbmax + " " + wbmin + " " + wbModeval);
      return null;
    }
  }
示例#2
0
    // rgb(255,108, 0)   1500k
    // rgb 255,255,255   6000k
    // rgb(181,205, 255) 15000k
    @Override
    public void SetValue(int valueToSet) {
      if (valueToSet == 0) // = auto
      return;
      currentInt = valueToSet;
      valueToSet = Integer.parseInt(stringvalues[valueToSet]);
      int[] rgb = cctLookup.get(valueToSet + "");
      if (rgb == null) {
        Logger.d(TAG, "get cct from lookup failed:" + valueToSet);
        return;
      }
      float rf, gf, bf = 0;

      rf = (float) getRGBToDouble(rgb[0]);
      gf = (float) getRGBToDouble(rgb[1]) / 2; // we have two green channels
      bf = (float) getRGBToDouble(rgb[2]);
      rf = rf / gf;
      bf = bf / gf;
      gf = 1;

      Logger.d(TAG, "r:" + rgb[0] + " g:" + rgb[1] + " b:" + rgb[2]);
      Logger.d(TAG, "ColorTemp=" + valueToSet + " WBCT = r:" + rf + " g:" + gf + " b:" + bf);
      wbChannelVector = new RggbChannelVector(rf, gf, gf, bf);
      ((CameraHolderApi2) cameraUiWrapper.GetCameraHolder())
          .SetParameterRepeating(CaptureRequest.COLOR_CORRECTION_GAINS, wbChannelVector);
    }
示例#3
0
 @Nullable
 private boolean deletFile(File file) {
   if (!file.delete()) {
     DocumentFile sdDir = getExternalSdDocumentFile();
     if (sdDir == null) return false;
     String baseS = sdDir.getName();
     String fileFolder = file.getAbsolutePath();
     String[] split = fileFolder.split("/");
     DocumentFile tmpdir = null;
     boolean append = false;
     for (String aSplit : split) {
       if (aSplit.equals(baseS) || append) {
         if (!append) {
           append = true;
           tmpdir = sdDir;
         } else {
           tmpdir = tmpdir.findFile(aSplit);
         }
       }
     }
     boolean d = false;
     d = !(tmpdir != null && tmpdir.exists()) || tmpdir.delete();
     Logger.d("delteDocumentFile", "file delted:" + d);
     return d;
   }
   return true;
 }
示例#4
0
 @Override
 public void ChooseSDCard(I_OnActivityResultCallback callback) {
   try {
     resultCallback = callback;
     Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT_TREE);
     startActivityForResult(intent, READ_REQUEST_CODE);
   } catch (ActivityNotFoundException activityNotFoundException) {
     Logger.exception(activityNotFoundException);
   }
 }
示例#5
0
 @Override
 public String GetValue() {
   try {
     int i =
         ((CameraHolderApi2) cameraUiWrapper.GetCameraHolder())
             .get(CaptureRequest.COLOR_CORRECTION_MODE);
     ColorCorrectionModes sceneModes = ColorCorrectionModes.values()[i];
     return sceneModes.toString();
   } catch (NullPointerException ex) {
     Logger.exception(ex);
   }
   return "";
 }
 @Override
 public void SetValue(String value) {
   if (parameter != null && parameter.IsSupported()) {
     if (key_appsettings != null && !key_appsettings.equals(""))
       fragment_activityInterface.getAppSettings().setString(key_appsettings, value);
     try {
       parameter.SetValue(value, true);
     } catch (NullPointerException ex) {
       Logger.exception(ex);
     }
     onParameterValueChanged(value);
   }
 }
示例#7
0
 @Override
 public boolean hasCameraPermission() {
   if (VERSION.SDK_INT >= VERSION_CODES.M) {
     if (checkSelfPermission(Manifest.permission.CAMERA) != PackageManager.PERMISSION_GRANTED) {
       RequestPermission = true;
       Logger.d(TAG, "Request cameraPermission");
       requestPermissions(
           new String[] {Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO}, 1);
       return false;
     }
     return true;
   }
   return true;
 }
示例#8
0
 @Override
 protected void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   Logger.d(TAG, "createHandlers()");
   appSettingsManager =
       new AppSettingsManager(PreferenceManager.getDefaultSharedPreferences(getBaseContext()));
   bitmapHelper =
       new BitmapHelper(
           getApplicationContext(),
           getResources().getDimensionPixelSize(R.dimen.image_thumbnails_size),
           this);
   fileListners = new ArrayList<>();
   storageHandler = new StorageFileHandler(this);
   if (appSettingsManager.getDevice() == null)
     appSettingsManager.SetDevice(new DeviceUtils().getDevice(getResources()));
   imageSaver = new ImageSaver(this);
   HIDENAVBAR();
 }
示例#9
0
 @Override
 public boolean hasLocationPermission() {
   if (VERSION.SDK_INT >= VERSION_CODES.M) {
     if (checkSelfPermission(Manifest.permission.ACCESS_COARSE_LOCATION)
         != PackageManager.PERMISSION_GRANTED) {
       RequestPermission = true;
       Logger.d(TAG, "Request LocationPermission");
       requestPermissions(
           new String[] {
             Manifest.permission.ACCESS_COARSE_LOCATION, Manifest.permission.ACCESS_FINE_LOCATION
           },
           1);
       return false;
     }
     return true;
   }
   return true;
 }
示例#10
0
 @Override
 public boolean hasWifiPermission() {
   if (VERSION.SDK_INT >= VERSION_CODES.M) {
     if (checkSelfPermission(Manifest.permission.ACCESS_WIFI_STATE)
         != PackageManager.PERMISSION_GRANTED) {
       RequestPermission = true;
       Logger.d(TAG, "Request wifiPermission");
       requestPermissions(
           new String[] {
             Manifest.permission.ACCESS_WIFI_STATE, Manifest.permission.CHANGE_WIFI_STATE
           },
           1);
       return false;
     }
     return true;
   }
   return true;
 }
示例#11
0
 @Override
 public boolean hasExternalSDPermission() {
   if (VERSION.SDK_INT >= VERSION_CODES.M) {
     if (checkSelfPermission(Manifest.permission.READ_EXTERNAL_STORAGE)
         != PackageManager.PERMISSION_GRANTED) {
       RequestPermission = true;
       Logger.d(TAG, "Request externalSdPermission");
       requestPermissions(
           new String[] {
             Manifest.permission.READ_EXTERNAL_STORAGE, Manifest.permission.WRITE_EXTERNAL_STORAGE
           },
           1);
       return false;
     }
     return true;
   }
   return true;
 }
示例#12
0
    @Override
    public String GetValue() {
      if (cameraUiWrapper.GetCameraHolder() != null
          || !((CameraHolderApi2) cameraUiWrapper.GetCameraHolder())
              .get(CaptureRequest.CONTROL_AWB_MODE)
              .equals("null")) {
        try {
          int i =
              ((CameraHolderApi2) cameraUiWrapper.GetCameraHolder())
                  .get(CaptureRequest.CONTROL_AWB_MODE);
          WhiteBalanceValues sceneModes = WhiteBalanceValues.values()[i];
          return sceneModes.toString();
        } catch (NullPointerException ex) {
          Logger.exception(ex);
          return "AUTO";
        }

      } else return "AUTO";
    }