Skip to content

Commit

Permalink
Implement switching icon on the freeze button
Browse files Browse the repository at this point in the history
  • Loading branch information
0xf104a committed Nov 19, 2023
1 parent 48eb560 commit e2061dc
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/com/polar/mirror/FreezeController.java
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ public class FreezeController {
private final ImageCapture mImageCapture;
private final Context mContext;
private boolean mCameraFrozen = false;
private final FloatingActionButton mFreezeButton;

FreezeController(Context context, FloatingActionButton freezeButton, PreviewView cameraView,
ImageView freezeView){
Expand All @@ -46,6 +47,7 @@ public class FreezeController {
mImageCapture = new ImageCapture.Builder()
.setCaptureMode(ImageCapture.CAPTURE_MODE_MINIMIZE_LATENCY)
.build();
mFreezeButton = freezeButton;
}

/**
Expand Down Expand Up @@ -139,11 +141,13 @@ public void toggleFreeze(){
if(mCameraFrozen){
mFreezeView.setVisibility(View.GONE);
mCameraView.setVisibility(View.VISIBLE);
mFreezeButton.setImageResource(android.R.drawable.ic_media_pause);
mCameraFrozen = false;
} else {
setFrozenImage();
mCameraView.setVisibility(View.GONE);
mFreezeView.setVisibility(View.VISIBLE);
mFreezeButton.setImageResource(android.R.drawable.ic_media_play);
mCameraFrozen = true;
}
}
Expand Down

0 comments on commit e2061dc

Please sign in to comment.