Ejemplo n.º 1
0
 void setTorch(Camera camera, boolean newSetting) {
   Camera.Parameters parameters = camera.getParameters();
   doSetTorch(parameters, newSetting);
   camera.setParameters(parameters);
   SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
   boolean currentSetting = prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false);
   if (currentSetting != newSetting) {
     SharedPreferences.Editor editor = prefs.edit();
     editor.putBoolean(PreferencesActivity.KEY_FRONT_LIGHT, newSetting);
     editor.commit();
   }
 }
 private void initializeTorch(
     Camera.Parameters parameters, SharedPreferences prefs, boolean safeMode) {
   boolean currentSetting = FrontLightMode.readPref(prefs) == FrontLightMode.ON;
   doSetTorch(parameters, currentSetting, safeMode);
 }
 void setTorch(Camera camera, boolean newSetting) {
   Camera.Parameters parameters = camera.getParameters();
   doSetTorch(parameters, newSetting, false);
   camera.setParameters(parameters);
 }
Ejemplo n.º 4
0
 private void initializeTorch(Camera.Parameters parameters, SharedPreferences prefs) {
   boolean currentSetting = prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false);
   doSetTorch(parameters, currentSetting);
 }