summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/ui/CameraControls.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/camera/ui/CameraControls.java')
-rw-r--r--src/com/android/camera/ui/CameraControls.java51
1 files changed, 51 insertions, 0 deletions
diff --git a/src/com/android/camera/ui/CameraControls.java b/src/com/android/camera/ui/CameraControls.java
index 1c9419569..181bd991e 100644
--- a/src/com/android/camera/ui/CameraControls.java
+++ b/src/com/android/camera/ui/CameraControls.java
@@ -26,6 +26,7 @@ import android.util.AttributeSet;
import android.view.View;
import android.view.ViewPropertyAnimator;
import android.widget.FrameLayout;
+import android.widget.TextView;
import java.util.ArrayList;
import org.codeaurora.snapcam.R;
@@ -66,6 +67,8 @@ public class CameraControls extends RotatableLayout {
private boolean[] mTempEnabled = new boolean[9];
private boolean mLocSet = false;
+ private TextView mRemainingPhotos;
+
AnimatorListener outlistener = new AnimatorListener() {
@Override
public void onAnimationStart(Animator animation) {
@@ -205,6 +208,7 @@ public class CameraControls extends RotatableLayout {
mPreview = findViewById(R.id.preview_thumb);
mSceneModeSwitcher = findViewById(R.id.scene_mode_switcher);
mFilterModeSwitcher = findViewById(R.id.filter_mode_switcher);
+ mRemainingPhotos = (TextView) findViewById(R.id.remaining_photos);
}
@Override
@@ -238,6 +242,8 @@ public class CameraControls extends RotatableLayout {
View done = findViewById(R.id.btn_done);
toRight(done, shutter, rotation);
}
+
+ layoutRemaingPhotos();
}
private void setLocation(int w, int h) {
@@ -388,6 +394,7 @@ public class CameraControls extends RotatableLayout {
mPreview.animate().translationXBy(-mSize).setDuration(ANIME_DURATION);
break;
}
+ mRemainingPhotos.setVisibility(View.INVISIBLE);
}
public void showUI() {
@@ -475,6 +482,9 @@ public class CameraControls extends RotatableLayout {
mPreview.animate().translationXBy(mSize).setDuration(ANIME_DURATION);
break;
}
+ if (mRemainingPhotos.getVisibility() == View.INVISIBLE) {
+ mRemainingPhotos.setVisibility(View.VISIBLE);
+ }
}
private void center(View v, Rect other, int rotation) {
@@ -646,4 +656,45 @@ public class CameraControls extends RotatableLayout {
mBackgroundView.setBackgroundResource(R.drawable.switcher_bg);
}
+ private void layoutRemaingPhotos() {
+ int rl = mPreview.getLeft();
+ int rt = mPreview.getTop();
+ int rr = mPreview.getRight();
+ int rb = mPreview.getBottom();
+ int w = mRemainingPhotos.getMeasuredWidth();
+ int h = mRemainingPhotos.getMeasuredHeight();
+ int m = getResources().getDimensionPixelSize(R.dimen.remaining_photos_margin);
+
+ int hc, vc;
+ int rotation = getUnifiedRotation();
+ switch (rotation) {
+ case 90:
+ hc = (rl + rr) / 2 - m;
+ vc = (rt + rb) / 2;
+ break;
+ case 180:
+ hc = (rl + rr) / 2;
+ vc = (rt + rb) / 2 + m;
+ break;
+ case 270:
+ hc = (rl + rr) / 2 + m;
+ vc = (rt + rb) / 2;
+ break;
+ default:
+ hc = (rl + rr) / 2;
+ vc = (rt + rb) / 2 - m;
+ break;
+ }
+ mRemainingPhotos.layout(hc - w / 2, vc - h / 2, hc + w / 2, vc + h / 2);
+ }
+
+ public void updateRemainingPhotos(int remaining) {
+ if (remaining < 0) {
+ mRemainingPhotos.setVisibility(View.GONE);
+ } else {
+ mRemainingPhotos.setVisibility(View.VISIBLE);
+ mRemainingPhotos.setText(String.format(
+ getResources().getString(R.string.remaining_photos_format), remaining));
+ }
+ }
}