Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 884d6164 authored by Fahim Salam Chowdhury's avatar Fahim Salam Chowdhury 👽
Browse files

229-Optimize_preview_when_taking_picture

parent 937770f5
Loading
Loading
Loading
Loading
Loading
+4 −23
Original line number Diff line number Diff line
@@ -222,29 +222,10 @@ public class MyPreferenceFragment extends PreferenceFragment implements OnShared
        final int [] widths = bundle.getIntArray("resolution_widths");
        final int [] heights = bundle.getIntArray("resolution_heights");
        final boolean [] supports_burst = bundle.getBooleanArray("resolution_supports_burst");
        if( widths != null && heights != null && supports_burst != null ) {
            CharSequence [] entries = new CharSequence[widths.length];
            CharSequence [] values = new CharSequence[widths.length];
            for(int i=0;i<widths.length;i++) {
                entries[i] = widths[i] + " x " + heights[i] + " " + Preview.getAspectRatioMPString(getResources(), widths[i], heights[i], supports_burst[i]);
                values[i] = widths[i] + " " + heights[i];
            }
            ListPreference lp = (ListPreference)findPreference("preference_resolution");
            lp.setEntries(entries);
            lp.setEntryValues(values);
            String resolution_preference_key = PreferenceKeys.getResolutionPreferenceKey(cameraId);
            String resolution_value = sharedPreferences.getString(resolution_preference_key, "");
            if( MyDebug.LOG )
                Log.d(TAG, "resolution_value: " + resolution_value);
            lp.setValue(resolution_value);
            // now set the key, so we save for the correct cameraId
            lp.setKey(resolution_preference_key);
        }
        else {
            Preference pref = findPreference("preference_resolution");
            PreferenceGroup pg = (PreferenceGroup)this.findPreference("preference_screen_photo_settings");
            pg.removePreference(pref);
        }

        Preference pref1 = findPreference("preference_resolution");
        PreferenceGroup pg1 = (PreferenceGroup)this.findPreference("preference_screen_photo_settings");
        pg1.removePreference(pref1);

        String fps_preference_key = PreferenceKeys.getVideoFPSPreferenceKey(cameraId);
        if( MyDebug.LOG )
+5 −0
Original line number Diff line number Diff line
@@ -3546,6 +3546,11 @@ public class Preview implements SurfaceHolder.Callback, TextureView.SurfaceTextu
                optimalSize = getClosestSize(sizes, targetRatio, null);
            }
        }

        if (((MainActivity)getContext()).isInFullScreenMode()) {
           camera_controller.setPictureSize(optimalSize.width, optimalSize.height);
        }

        if (MyDebug.LOG) {
            Log.d(TAG, "chose optimalSize: " + optimalSize.width + " x " + optimalSize.height);
            Log.d(TAG, "optimalSize ratio: " + ((double) optimalSize.width / optimalSize.height));
+1 −1
Original line number Diff line number Diff line
@@ -349,7 +349,7 @@ public class PopupView extends LinearLayout {
            if( MyDebug.LOG )
                Log.d(TAG, "PopupView time 8: " + (System.nanoTime() - debug_time));

            if( !preview.isVideo() && photo_mode != MyApplicationInterface.PhotoMode.Panorama ) {
            if( !preview.isVideo() && photo_mode != MyApplicationInterface.PhotoMode.Panorama && !main_activity.isInFullScreenMode()) {
                // Only show photo resolutions in photo mode - even if photo snapshots whilst recording video is supported, the
                // resolutions for that won't match what the user has requested for photo mode resolutions.
                // And Panorama mode chooses its own resolution.