安卓照相机默认4:3

packages/apps/Camera/src/com/android/camera/CameraSettings.java

public class CameraSettings {
             return;
         }
 
-        resetIfInvalid(pref, resetFirst);
+        /*resetIfInvalid(pref, resetFirst);*/
+                if(row == SettingChecker.ROW_SETTING_PICTURE_RATIO)
+          {
+                     String value = pref.getValue();
+                      Log.v(TAG, "resetIfInvalid(" + value + ")first= "+resetFirst);
+                     
+                     if (pref.findIndexOfValue(value) == NOT_FOUND) {
+                         if (resetFirst) {
+                             pref.setValueIndex(1);
+                         } else if (pref.getEntryValues() != null && pref.getEntryValues().length > 0) {
+                      pref.setValueIndex(pref.getEntryValues().length - 1);
+                 }
+              }
+          } 
+           else
+                 {
+                   resetIfInvalid(pref, resetFirst);
+                 }
+               
+               
         setListPreference(row, pref);
     }

@@ -982,6 +1001,21 @@ public class CameraSettings {
         initialCameraPictureSize(context, parameters);
         writePreferredCameraId(preferences, currentCameraId);
         writePreferredCamera3DMode(preferences, current3DMode);
+               
+               List<Size> supported = parameters.getSupportedPictureSizes();
+           String targetRatio = SettingChecker.getPreferenceValue(context,
+                    preferences, SettingChecker.ROW_SETTING_PICTURE_RATIO);
+           Log.v(TAG, "targetRatio=" + targetRatio);
+           if(!targetRatio.equals(CameraSettings.PICTURE_RATIO_4_3))
+                 {
+              targetRatio = CameraSettings.PICTURE_RATIO_4_3;
+                   SharedPreferences.Editor editor = ComboPreferences.get(context).edit();
+                       editor.putString(CameraSettings.KEY_PICTURE_RATIO, targetRatio);
+ 
+                       editor.apply();
+                
+                       }
+               
     }

上一篇:使用python在pycharm中制作二维码


下一篇:Djiango入门 持续更新