From 32b1f21a367401f0fcffa45cc07dce73fd671d6b Mon Sep 17 00:00:00 2001 From: likaid Date: Sun, 6 Sep 2015 16:28:18 +0800 Subject: SnapdragonCamera: Stop the longshot when the storage is full The remainingPhotos was decreeased by 1 for each shot, when it came to 0, the longshot process was not stopped. When the remaining photos are less than 20, show "<20" for the remainingPhotos; When the storage is full, Stop the longshot process. Change-Id: Ifb1fb38f668132e1058f8a937afa9fa0b5afb5a7 CRs-Fixed: 893008 --- src/com/android/camera/ui/CameraControls.java | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) (limited to 'src/com/android/camera/ui/CameraControls.java') diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java index c0defea06..52750f32a 100644 --- a/src/com/android/camera/ui/CameraControls.java +++ b/src/com/android/camera/ui/CameraControls.java @@ -41,6 +41,7 @@ import org.codeaurora.snapcam.R; import com.android.camera.ui.ModuleSwitcher; import com.android.camera.ui.RotateImageView; import com.android.camera.ShutterButton; +import com.android.camera.Storage; import com.android.camera.util.CameraUtil; import com.android.camera.TsMakeupManager; @@ -84,6 +85,7 @@ public class CameraControls extends RotatableLayout { private LinearLayout mRemainingPhotos; private TextView mRemainingPhotosText; + private int mCurrentRemaining = -1; private int mOrientation; private int mPreviewRatio; @@ -92,6 +94,8 @@ public class CameraControls extends RotatableLayout { private Paint mPaint; + private static final int LOW_REMAINING_PHOTOS = 20; + AnimatorListener outlistener = new AnimatorListener() { @Override public void onAnimationStart(Animator animation) { @@ -868,14 +872,20 @@ public class CameraControls extends RotatableLayout { } public void updateRemainingPhotos(int remaining) { - if (remaining < 0) { + long remainingStorage = Storage.getAvailableSpace() - Storage.LOW_STORAGE_THRESHOLD_BYTES; + if (remaining < 0 && remainingStorage <= 0) { mRemainingPhotos.setVisibility(View.GONE); } else { for (int i = mRemainingPhotos.getChildCount() - 1; i >= 0; --i) { mRemainingPhotos.getChildAt(i).setVisibility(View.VISIBLE); } - mRemainingPhotosText.setText(remaining + " "); + if (remaining < LOW_REMAINING_PHOTOS) { + mRemainingPhotosText.setText("<" + LOW_REMAINING_PHOTOS + " "); + } else { + mRemainingPhotosText.setText(remaining + " "); + } } + mCurrentRemaining = remaining; } public void setMargins(int top, int bottom) { @@ -900,7 +910,9 @@ public class CameraControls extends RotatableLayout { public void showRefocusToast(boolean show) { mRefocusToast.setVisibility(show ? View.VISIBLE : View.GONE); - mRemainingPhotos.setVisibility(show ? View.GONE : View.VISIBLE); + if (mCurrentRemaining > 0 ) { + mRemainingPhotos.setVisibility(show ? View.GONE : View.VISIBLE); + } } public void setOrientation(int orientation, boolean animation) { -- cgit v1.2.3