Java 类com.google.zxing.client.android.PreferencesActivity 实例源码

项目:BibSearch    文件:CameraManager.java   
/**
 * Opens the camera driver and initializes the hardware parameters.
 *
 * @param holder The surface object which the camera will draw preview frames into.
 * @throws IOException Indicates the camera driver failed to open.
 */
public void openDriver(SurfaceHolder holder) throws IOException {
  if (camera == null) {
    camera = Camera.open();
    if (camera == null) {
      throw new IOException();
    }
  }
  camera.setPreviewDisplay(holder);
  if (!initialized) {
    initialized = true;
    configManager.initFromCameraParameters(camera);
  }
  configManager.setDesiredCameraParameters(camera);

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
  reverseImage = prefs.getBoolean(PreferencesActivity.KEY_REVERSE_IMAGE, false);
  if (prefs.getBoolean(PreferencesActivity.KEY_FRONT_LIGHT, false)) {
    FlashlightManager.enableFlashlight();
  }
}
项目:keepass2android    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}
项目:keepass2android    文件:ResultHandler.java   
private String parseCustomSearchURL() {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH,
      null);
  if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
    return null;
  }
  return customProductSearch;
}
项目:weex-3d-map    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}
项目:weex-3d-map    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
  CameraConfigurationUtils.setTorch(parameters, newSetting);
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
  if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
    CameraConfigurationUtils.setBestExposure(parameters, newSetting);
  }
}
项目:weex-3d-map    文件:ResultHandler.java   
private String parseCustomSearchURL() {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH,
      null);
  if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
    return null;
  }
  return customProductSearch;
}
项目:weex-3d-map    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
  // Do not save this item to the history if the preference is turned off, or the contents are
  // considered secure.
  if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
      handler.areContentsSecure() || !enableHistory) {
    return;
  }

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
    deletePrevious(result.getText());
  }

  ContentValues values = new ContentValues();
  values.put(DBHelper.TEXT_COL, result.getText());
  values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
  values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
  values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  try {
    db = helper.getWritableDatabase();      
    // Insert the new entry into the DB.
    db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
  } finally {
    close(null, db);
  }
}
项目:KeePass2Android    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}
项目:KeePass2Android    文件:ResultHandler.java   
private String parseCustomSearchURL() {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH,
      null);
  if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
    return null;
  }
  return customProductSearch;
}
项目:PortraitZXing    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
    this.camera = camera;
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    String currentFocusMode = camera.getParameters().getFocusMode();
    useAutoFocus = sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true)
            && FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
    Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
    start();
}
项目:PortraitZXing    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
    CameraConfigurationUtils.setTorch(parameters, newSetting);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
        CameraConfigurationUtils.setBestExposure(parameters, newSetting);
    }
}
项目:PortraitZXing    文件:ResultHandler.java   
private String parseCustomSearchURL() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null);
    if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
        return null;
    }
    return customProductSearch;
}
项目:PortraitZXing    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
    // Do not save this item to the history if the preference is turned off,
    // or the contents are
    // considered secure.
    if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) || handler.areContentsSecure()
            || !enableHistory) {
        return;
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
        deletePrevious(result.getText());
    }

    ContentValues values = new ContentValues();
    values.put(DBHelper.TEXT_COL, result.getText());
    values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
    values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
    values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

    SQLiteOpenHelper helper = new DBHelper(activity);
    SQLiteDatabase db = null;
    try {
        db = helper.getWritableDatabase();
        // Insert the new entry into the DB.
        db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
    } finally {
        close(null, db);
    }
}
项目:PortraitZXing    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
    this.camera = camera;
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    String currentFocusMode = camera.getParameters().getFocusMode();
    useAutoFocus = sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true)
            && FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
    Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
    start();
}
项目:PortraitZXing    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
    CameraConfigurationUtils.setTorch(parameters, newSetting);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
        CameraConfigurationUtils.setBestExposure(parameters, newSetting);
    }
}
项目:PortraitZXing    文件:ResultHandler.java   
private String parseCustomSearchURL() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null);
    if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
        return null;
    }
    return customProductSearch;
}
项目:PortraitZXing    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
    // Do not save this item to the history if the preference is turned off,
    // or the contents are
    // considered secure.
    if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) || handler.areContentsSecure()
            || !enableHistory) {
        return;
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
        deletePrevious(result.getText());
    }

    ContentValues values = new ContentValues();
    values.put(DBHelper.TEXT_COL, result.getText());
    values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
    values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
    values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

    SQLiteOpenHelper helper = new DBHelper(activity);
    SQLiteDatabase db = null;
    try {
        db = helper.getWritableDatabase();
        // Insert the new entry into the DB.
        db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
    } finally {
        close(null, db);
    }
}
项目:PortraitZXing    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
    this.camera = camera;
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    String currentFocusMode = camera.getParameters().getFocusMode();
    useAutoFocus = sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true)
            && FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
    Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
    start();
}
项目:PortraitZXing    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
    CameraConfigurationUtils.setTorch(parameters, newSetting);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
        CameraConfigurationUtils.setBestExposure(parameters, newSetting);
    }
}
项目:PortraitZXing    文件:ResultHandler.java   
private String parseCustomSearchURL() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null);
    if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
        return null;
    }
    return customProductSearch;
}
项目:PortraitZXing    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
    // Do not save this item to the history if the preference is turned off,
    // or the contents are
    // considered secure.
    if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) || handler.areContentsSecure()
            || !enableHistory) {
        return;
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
        deletePrevious(result.getText());
    }

    ContentValues values = new ContentValues();
    values.put(DBHelper.TEXT_COL, result.getText());
    values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
    values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
    values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

    SQLiteOpenHelper helper = new DBHelper(activity);
    SQLiteDatabase db = null;
    try {
        db = helper.getWritableDatabase();
        // Insert the new entry into the DB.
        db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
    } finally {
        close(null, db);
    }
}
项目:PortraitZXing    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
    this.camera = camera;
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    String currentFocusMode = camera.getParameters().getFocusMode();
    useAutoFocus = sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true)
            && FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
    Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
    start();
}
项目:PortraitZXing    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
    CameraConfigurationUtils.setTorch(parameters, newSetting);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
        CameraConfigurationUtils.setBestExposure(parameters, newSetting);
    }
}
项目:PortraitZXing    文件:ResultHandler.java   
private String parseCustomSearchURL() {
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH, null);
    if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
        return null;
    }
    return customProductSearch;
}
项目:PortraitZXing    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
    // Do not save this item to the history if the preference is turned off,
    // or the contents are
    // considered secure.
    if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) || handler.areContentsSecure()
            || !enableHistory) {
        return;
    }

    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
    if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
        deletePrevious(result.getText());
    }

    ContentValues values = new ContentValues();
    values.put(DBHelper.TEXT_COL, result.getText());
    values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
    values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
    values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

    SQLiteOpenHelper helper = new DBHelper(activity);
    SQLiteDatabase db = null;
    try {
        db = helper.getWritableDatabase();
        // Insert the new entry into the DB.
        db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
    } finally {
        close(null, db);
    }
}
项目:weex-analyzer-android    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}
项目:weex-analyzer-android    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
  CameraConfigurationUtils.setTorch(parameters, newSetting);
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
  if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
    CameraConfigurationUtils.setBestExposure(parameters, newSetting);
  }
}
项目:weex-analyzer-android    文件:ResultHandler.java   
private String parseCustomSearchURL() {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH,
      null);
  if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
    return null;
  }
  return customProductSearch;
}
项目:weex-analyzer-android    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
  // Do not save this item to the history if the preference is turned off, or the contents are
  // considered secure.
  if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
      handler.areContentsSecure() || !enableHistory) {
    return;
  }

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
    deletePrevious(result.getText());
  }

  ContentValues values = new ContentValues();
  values.put(DBHelper.TEXT_COL, result.getText());
  values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
  values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
  values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  try {
    db = helper.getWritableDatabase();      
    // Insert the new entry into the DB.
    db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
  } finally {
    close(null, db);
  }
}
项目:weex-3d-map    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}
项目:weex-3d-map    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
  CameraConfigurationUtils.setTorch(parameters, newSetting);
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
  if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
    CameraConfigurationUtils.setBestExposure(parameters, newSetting);
  }
}
项目:weex-3d-map    文件:ResultHandler.java   
private String parseCustomSearchURL() {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH,
      null);
  if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
    return null;
  }
  return customProductSearch;
}
项目:weex-3d-map    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
  // Do not save this item to the history if the preference is turned off, or the contents are
  // considered secure.
  if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
      handler.areContentsSecure() || !enableHistory) {
    return;
  }

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
    deletePrevious(result.getText());
  }

  ContentValues values = new ContentValues();
  values.put(DBHelper.TEXT_COL, result.getText());
  values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
  values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
  values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  try {
    db = helper.getWritableDatabase();      
    // Insert the new entry into the DB.
    db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
  } finally {
    close(null, db);
  }
}
项目:ZxingLite    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
    this.camera = camera;
    SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
    String currentFocusMode = camera.getParameters().getFocusMode();
    useAutoFocus =
            sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
                    FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
    Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
    start();
}
项目:ZxingLite    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
    CameraConfigurationUtils.setTorch(parameters, newSetting);
    SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
    if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
        CameraConfigurationUtils.setBestExposure(parameters, newSetting);
    }
}
项目:Weex-TestDemo    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}
项目:Weex-TestDemo    文件:CameraConfigurationManager.java   
private void doSetTorch(Camera.Parameters parameters, boolean newSetting, boolean safeMode) {
  CameraConfigurationUtils.setTorch(parameters, newSetting);
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
  if (!safeMode && !prefs.getBoolean(PreferencesActivity.KEY_DISABLE_EXPOSURE, true)) {
    CameraConfigurationUtils.setBestExposure(parameters, newSetting);
  }
}
项目:Weex-TestDemo    文件:ResultHandler.java   
private String parseCustomSearchURL() {
  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  String customProductSearch = prefs.getString(PreferencesActivity.KEY_CUSTOM_PRODUCT_SEARCH,
      null);
  if (customProductSearch != null && customProductSearch.trim().isEmpty()) {
    return null;
  }
  return customProductSearch;
}
项目:Weex-TestDemo    文件:HistoryManager.java   
public void addHistoryItem(Result result, ResultHandler handler) {
  // Do not save this item to the history if the preference is turned off, or the contents are
  // considered secure.
  if (!activity.getIntent().getBooleanExtra(Intents.Scan.SAVE_HISTORY, true) ||
      handler.areContentsSecure() || !enableHistory) {
    return;
  }

  SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(activity);
  if (!prefs.getBoolean(PreferencesActivity.KEY_REMEMBER_DUPLICATES, false)) {
    deletePrevious(result.getText());
  }

  ContentValues values = new ContentValues();
  values.put(DBHelper.TEXT_COL, result.getText());
  values.put(DBHelper.FORMAT_COL, result.getBarcodeFormat().toString());
  values.put(DBHelper.DISPLAY_COL, handler.getDisplayContents().toString());
  values.put(DBHelper.TIMESTAMP_COL, System.currentTimeMillis());

  SQLiteOpenHelper helper = new DBHelper(activity);
  SQLiteDatabase db = null;
  try {
    db = helper.getWritableDatabase();      
    // Insert the new entry into the DB.
    db.insert(DBHelper.TABLE_NAME, DBHelper.TIMESTAMP_COL, values);
  } finally {
    close(null, db);
  }
}
项目:weex    文件:AutoFocusManager.java   
AutoFocusManager(Context context, Camera camera) {
  this.camera = camera;
  SharedPreferences sharedPrefs = PreferenceManager.getDefaultSharedPreferences(context);
  String currentFocusMode = camera.getParameters().getFocusMode();
  useAutoFocus =
      sharedPrefs.getBoolean(PreferencesActivity.KEY_AUTO_FOCUS, true) &&
      FOCUS_MODES_CALLING_AF.contains(currentFocusMode);
  Log.i(TAG, "Current focus mode '" + currentFocusMode + "'; use auto focus? " + useAutoFocus);
  start();
}