main
Matthew 8 months ago
parent 3714d08296
commit ce8972f584

@ -14,6 +14,7 @@
android:allowBackup="true" android:allowBackup="true"
android:icon="@drawable/ic_launcher" android:icon="@drawable/ic_launcher"
android:label="@string/app_name" android:label="@string/app_name"
android:requestLegacyExternalStorage="true"
android:theme="@style/MaterialTheme"> android:theme="@style/MaterialTheme">
<activity <activity
android:name=".MainActivity" android:name=".MainActivity"

@ -497,7 +497,7 @@ public class Camera2RawFragment extends Fragment
String currentDateTime = generateTimestamp(); String currentDateTime = generateTimestamp();
File jpegFile = new File(Environment. File jpegFile = new File(Environment.
getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM), getExternalStoragePublicDirectory(Environment.DIRECTORY_DCIM),
"IMG_" + currentDateTime + ".jpg"); "Camera/IMG_" + currentDateTime + ".jpg");
// Look up the ImageSaverBuilder for this request and update it with the file name // Look up the ImageSaverBuilder for this request and update it with the file name
// based on the capture start time. // based on the capture start time.
@ -524,7 +524,7 @@ public class Camera2RawFragment extends Fragment
if (jpegBuilder != null) { if (jpegBuilder != null) {
jpegBuilder.setResult(result); jpegBuilder.setResult(result);
sb.append("Saving JPEG as: "); sb.append("保存于: ");
sb.append(jpegBuilder.getSaveLocation()); sb.append(jpegBuilder.getSaveLocation());
} }
@ -714,7 +714,7 @@ public class Camera2RawFragment extends Fragment
// For still image captures, we use the largest available size. // For still image captures, we use the largest available size.
Size[] resolutions = map.getHighResolutionOutputSizes(ImageFormat.JPEG); Size[] resolutions = map.getHighResolutionOutputSizes(ImageFormat.JPEG);
if (resolutions == null) { if (resolutions == null || resolutions.length == 0) {
resolutions = map.getOutputSizes(ImageFormat.JPEG); resolutions = map.getOutputSizes(ImageFormat.JPEG);
} }
Size largestJpeg = Collections.max(Arrays.asList(resolutions), new CompareSizesByArea()); Size largestJpeg = Collections.max(Arrays.asList(resolutions), new CompareSizesByArea());
@ -1028,7 +1028,7 @@ public class Camera2RawFragment extends Fragment
// For still image captures, we always use the largest available size. // For still image captures, we always use the largest available size.
Size[] resolutions = map.getHighResolutionOutputSizes(ImageFormat.JPEG); Size[] resolutions = map.getHighResolutionOutputSizes(ImageFormat.JPEG);
if (resolutions == null) { if (resolutions == null || resolutions.length == 0) {
resolutions = map.getOutputSizes(ImageFormat.JPEG); resolutions = map.getOutputSizes(ImageFormat.JPEG);
} }
Size largestJpeg = Collections.max(Arrays.asList(resolutions), new CompareSizesByArea()); Size largestJpeg = Collections.max(Arrays.asList(resolutions), new CompareSizesByArea());

Loading…
Cancel
Save