@@ -16,7 +16,9 @@ package com.king.zxing.camera;
|
||||
*/
|
||||
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
||||
import com.king.zxing.Preferences;
|
||||
|
||||
@@ -33,11 +35,16 @@ public enum FrontLightMode {
|
||||
OFF;
|
||||
|
||||
private static FrontLightMode parse(String modeString) {
|
||||
return modeString == null ? OFF : valueOf(modeString);
|
||||
return modeString == null ? AUTO : valueOf(modeString);
|
||||
}
|
||||
|
||||
public static FrontLightMode readPref(SharedPreferences sharedPrefs) {
|
||||
return parse(sharedPrefs.getString(Preferences.KEY_FRONT_LIGHT_MODE, OFF.toString()));
|
||||
return parse(sharedPrefs.getString(Preferences.KEY_FRONT_LIGHT_MODE, AUTO.toString()));
|
||||
}
|
||||
|
||||
public static void put(Context context, FrontLightMode mode) {
|
||||
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
||||
prefs.edit().putString(Preferences.KEY_FRONT_LIGHT_MODE, mode.toString()).commit();
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user