Skip to content

Commit 88bdfd2

Browse files
committed
Cleaned up unused imports and variable names.
1 parent 871150e commit 88bdfd2

File tree

1 file changed

+13
-33
lines changed

1 file changed

+13
-33
lines changed

app/src/main/java/com/googleresearch/capturesync/MainActivity.java

Lines changed: 13 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,9 @@
1717

1818
package com.googleresearch.capturesync;
1919

20-
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_MODE_AUTO;
2120
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_MODE_OFF;
2221
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_TRIGGER_CANCEL;
23-
import static android.hardware.camera2.CameraMetadata.CONTROL_AF_TRIGGER_IDLE;
2422
import static android.hardware.camera2.CaptureRequest.CONTROL_AF_MODE;
25-
import static android.hardware.camera2.CaptureRequest.CONTROL_AF_TRIGGER;
26-
import static android.hardware.camera2.CaptureRequest.LENS_FOCUS_DISTANCE;
27-
import static java.security.AccessController.getContext;
2823

2924
import android.Manifest.permission;
3025
import android.annotation.SuppressLint;
@@ -50,14 +45,12 @@
5045
import android.media.CamcorderProfile;
5146
import android.media.MediaCodec;
5247
import android.media.MediaRecorder;
53-
import android.net.wifi.WifiInfo;
5448
import android.net.wifi.WifiManager;
5549
import android.os.Bundle;
5650
import android.os.Environment;
5751
import android.os.Handler;
5852
import android.os.HandlerThread;
5953
import android.provider.Settings;
60-
import android.telephony.TelephonyManager;
6154
import android.util.Log;
6255
import android.util.Size;
6356
import android.view.Gravity;
@@ -72,7 +65,6 @@
7265
import android.widget.SeekBar.OnSeekBarChangeListener;
7366
import android.widget.TextView;
7467
import android.widget.Toast;
75-
import android.provider.Settings.Secure;
7668

7769
import com.googleresearch.capturesync.softwaresync.CSVLogger;
7870
import com.googleresearch.capturesync.softwaresync.SoftwareSyncLeader;
@@ -131,10 +123,11 @@
131123
*/
132124
public class MainActivity extends Activity {
133125
private static final String TAG = "MainActivity";
134-
private static final int STATIC_LEN = 15_000;
135126
private static final int REC_QUALITY = CamcorderProfile.QUALITY_1080P ;
136127
private static final int REC_BITRATE = 10*1000*1000;
137128
private static final int REC_FPS = 30;
129+
private static final String REC_SUBDIR_NAME = "RecSync";
130+
138131

139132
private String lastTimeStamp;
140133
private PeriodCalculator periodCalculator;
@@ -161,24 +154,12 @@ public Integer getLastVideoSeqId() {
161154

162155
private Integer lastVideoSeqId;
163156

164-
public int getCurSequence() {
165-
return curSequence;
166-
}
167-
168-
// public void setLogger(CSVLogger mLogger) {
169-
// this.mLogger = mLogger;
170-
// }
171-
172157
public CSVLogger getLogger() {
173158
return mLogger;
174159
}
175160

176161
private CSVLogger mLogger;
177162

178-
private int curSequence;
179-
180-
private static final String SUBDIR_NAME = "RecSync";
181-
182163
private boolean permissionsGranted = false;
183164
private boolean isAutofocusStarted = false;
184165
// Phase config file to use for phase alignment, configs are located in the raw folder.
@@ -209,8 +190,7 @@ public CSVLogger getLogger() {
209190
private Button captureStillButton;
210191
private Button getPeriodButton;
211192
private Button phaseAlignButton;
212-
private Button makeFocusButton;
213-
private Button unlockFocusButton;
193+
private Button toggleFocusButton;
214194
private SeekBar exposureSeekBar;
215195
private SeekBar sensitivitySeekBar;
216196
private TextView statusTextView;
@@ -525,7 +505,7 @@ private void handleWebSocketMsg(@NotNull WsMessageContext wsMessageContext){
525505
((SoftwareSyncLeader) softwareSyncController.softwareSync)
526506
.broadcastRpc(SoftwareSyncController.METHOD_START_FOCUS,"");
527507

528-
makeFocusButton.setText("Stop Autofocus");
508+
toggleFocusButton.setText("Stop Autofocus");
529509
break;
530510

531511
case "STOP_AUTOFOCUS":
@@ -536,7 +516,7 @@ private void handleWebSocketMsg(@NotNull WsMessageContext wsMessageContext){
536516
((SoftwareSyncLeader) softwareSyncController.softwareSync)
537517
.broadcastRpc(SoftwareSyncController.METHOD_STOP_FOCUS,"");
538518

539-
makeFocusButton.setText("Start Autofocus");
519+
toggleFocusButton.setText("Start Autofocus");
540520
break ;
541521
}
542522
}
@@ -642,7 +622,7 @@ private void setLeaderClientControls(boolean isLeader) {
642622
// Leader, all controls visible and set.
643623
captureStillButton.setVisibility(View.VISIBLE);
644624
phaseAlignButton.setVisibility(View.VISIBLE);
645-
makeFocusButton.setVisibility(View.VISIBLE);
625+
toggleFocusButton.setVisibility(View.VISIBLE);
646626

647627
getPeriodButton.setVisibility(View.VISIBLE);
648628
exposureSeekBar.setVisibility(View.VISIBLE);
@@ -705,16 +685,16 @@ private void setLeaderClientControls(boolean isLeader) {
705685
.broadcastRpc(SoftwareSyncController.METHOD_DO_PHASE_ALIGN, "");
706686
});
707687

708-
makeFocusButton.setOnClickListener(
688+
toggleFocusButton.setOnClickListener(
709689
view -> {
710690
if (isAutofocusStarted) {
711691
stopAutofocus();
712-
makeFocusButton.setText("Start Autofocus");
692+
toggleFocusButton.setText("Start Autofocus");
713693
((SoftwareSyncLeader) softwareSyncController.softwareSync)
714694
.broadcastRpc(SoftwareSyncController.METHOD_STOP_FOCUS,"");
715695
} else {
716696
startAutofocus();
717-
makeFocusButton.setText("Stop Autofocus");
697+
toggleFocusButton.setText("Stop Autofocus");
718698
((SoftwareSyncLeader) softwareSyncController.softwareSync)
719699
.broadcastRpc(SoftwareSyncController.METHOD_START_FOCUS,"");
720700
}
@@ -787,7 +767,7 @@ public void onStopTrackingTouch(SeekBar seekBar) {
787767
getPeriodButton.setVisibility(View.VISIBLE);
788768
exposureSeekBar.setVisibility(View.INVISIBLE);
789769
sensitivitySeekBar.setVisibility(View.INVISIBLE);
790-
makeFocusButton.setVisibility(View.INVISIBLE);
770+
toggleFocusButton.setVisibility(View.INVISIBLE);
791771

792772
captureStillButton.setOnClickListener(null);
793773
phaseAlignButton.setOnClickListener(null);
@@ -1044,7 +1024,7 @@ private void createUi() {
10441024
// Controls.
10451025
captureStillButton = findViewById(R.id.capture_still_button);
10461026
phaseAlignButton = findViewById(R.id.phase_align_button);
1047-
makeFocusButton = findViewById(R.id.make_focus_button);
1027+
toggleFocusButton = findViewById(R.id.make_focus_button);
10481028

10491029
getPeriodButton = findViewById(R.id.get_period_button);
10501030

@@ -1253,7 +1233,7 @@ private String getOutputMediaFilePath(String prefixText) throws IOException {
12531233

12541234
File sdcard = Environment.getExternalStorageDirectory();
12551235

1256-
Path dir = Files.createDirectories(Paths.get(sdcard.getAbsolutePath(), SUBDIR_NAME, "VID"));
1236+
Path dir = Files.createDirectories(Paths.get(sdcard.getAbsolutePath(), REC_SUBDIR_NAME, "VID"));
12571237

12581238
lastTimeStamp = new SimpleDateFormat("yyyyMMdd_HHmmss",
12591239
Locale.getDefault()).format(new Date());
@@ -1468,7 +1448,7 @@ public void startVideo(boolean wantAutoExp, String prefixText) {
14681448
String filename = prefixText+"_"+lastTimeStamp + ".csv";
14691449
// Creates frame timestamps logger
14701450
try {
1471-
mLogger = new CSVLogger(SUBDIR_NAME, filename, this);
1451+
mLogger = new CSVLogger(REC_SUBDIR_NAME, filename, this);
14721452
} catch (IOException e) {
14731453
e.printStackTrace();
14741454
}

0 commit comments

Comments
 (0)