hide the bottom buttons for a second on photo taken

This commit is contained in:
tibbi 2016-09-20 20:41:25 +02:00
parent 276c47d4f0
commit 18c060eb71
2 changed files with 14 additions and 2 deletions

View File

@ -31,9 +31,9 @@ import java.util.List;
public class Preview extends ViewGroup
implements SurfaceHolder.Callback, View.OnTouchListener, View.OnClickListener, MediaScannerConnection.OnScanCompletedListener {
public static final int PHOTO_PREVIEW_LENGTH = 1000;
private static final String TAG = Preview.class.getSimpleName();
private static final int FOCUS_AREA_SIZE = 100;
private static final int PHOTO_PREVIEW_LENGTH = 1000;
private static final float RATIO_TOLERANCE = 0.1f;
private static SurfaceHolder mSurfaceHolder;

View File

@ -290,8 +290,14 @@ public class MainActivity extends SimpleActivity
private void handleShutter() {
if (mIsInPhotoMode) {
mShutterBtn.animate().rotationBy(90).start();
toggleBottomButtons(true);
mPreview.takePicture();
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
toggleBottomButtons(false);
}
}, Preview.PHOTO_PREVIEW_LENGTH);
} else {
final Resources res = getResources();
final boolean isRecording = mPreview.toggleRecording();
@ -307,6 +313,12 @@ public class MainActivity extends SimpleActivity
}
}
private void toggleBottomButtons(Boolean hide) {
mShutterBtn.animate().alpha(hide ? 0 : 1).start();
mToggleCameraBtn.animate().alpha(hide ? 0 : 1).start();
mToggleFlashBtn.animate().alpha(hide ? 0 : 1).start();
}
@OnClick(R.id.settings)
public void launchSettings() {
if (mSettingsBtn.getAlpha() == 1.f) {