1111import android .hardware .usb .UsbDevice ;
1212import android .hardware .usb .UsbManager ;
1313import android .os .Bundle ;
14+ import android .preference .PreferenceManager ;
1415import android .util .Log ;
1516import android .view .GestureDetector ;
1617import android .view .MotionEvent ;
2223
2324import androidx .appcompat .app .ActionBar ;
2425import androidx .appcompat .app .AppCompatActivity ;
25- import androidx .preference .PreferenceManager ;
26+ import io .sentry .SentryLevel ;
27+ import io .sentry .android .core .SentryAndroid ;
28+
2629import com .fpvout .digiview .dvr .DVR ;
2730import java .io .IOException ;
2831import java .util .HashMap ;
2932
30- import io .sentry .SentryLevel ;
31- import io .sentry .android .core .SentryAndroid ;
3233
3334import static com .fpvout .digiview .VideoReaderExoplayer .VideoZoomedIn ;
3435
@@ -40,6 +41,7 @@ public class MainActivity extends AppCompatActivity implements UsbDeviceListener
4041 private int shortAnimationDuration ;
4142 private float buttonAlpha = 1 ;
4243 private View settingsButton ;
44+ private View recordButton ;
4345 private View watermarkView ;
4446 private OverlayView overlayView ;
4547 PendingIntent permissionIntent ;
@@ -113,6 +115,7 @@ public void onClick(View v) {
113115 v .getContext ().startActivity (intent );
114116 }
115117 });
118+ recordButton = findViewById (R .id .recordbt );
116119
117120 sharedPreferences = PreferenceManager .getDefaultSharedPreferences (this );
118121
@@ -137,7 +140,7 @@ private void setupGestureDetectors() {
137140 gestureDetector = new GestureDetector (this , new GestureDetector .SimpleOnGestureListener () {
138141 @ Override
139142 public boolean onSingleTapConfirmed (MotionEvent e ) {
140- toggleSettingsButton ();
143+ toggleButton ();
141144 return super .onSingleTapConfirmed (e );
142145 }
143146
@@ -162,7 +165,7 @@ public void onScaleEnd(ScaleGestureDetector detector) {
162165 watermarkView .setVisibility (View .GONE );
163166
164167 mUsbMaskConnection = new UsbMaskConnection ();
165- mVideoReader = new VideoReaderExoplayer (fpvView , overlayView , this , recorder );
168+ mVideoReader = new VideoReaderExoplayer (fpvView , overlayView , this );
166169
167170 if (!usbConnected ) {
168171 if (searchDevice ()) {
@@ -232,9 +235,10 @@ private void updateVideoZoom() {
232235 }
233236 }
234237
235- private void toggleSettingsButton () {
238+ private void toggleButton () {
236239 // cancel any pending delayed animations first
237240 settingsButton .getHandler ().removeCallbacksAndMessages (null );
241+ recordButton .getHandler ().removeCallbacksAndMessages (null );
238242
239243 if (buttonAlpha == 1 ) {
240244 buttonAlpha = 0 ;
@@ -251,6 +255,10 @@ public void onAnimationEnd(Animator animation) {
251255 autoHideSettingsButton ();
252256 }
253257 });
258+
259+ recordButton .animate ()
260+ .alpha (buttonAlpha )
261+ .setDuration (shortAnimationDuration );
254262 }
255263
256264 private void autoHideSettingsButton () {
@@ -265,6 +273,16 @@ public void run() {
265273 .setDuration (shortAnimationDuration );
266274 }
267275 }, 3000 );
276+
277+ recordButton .postDelayed (new Runnable () {
278+ @ Override
279+ public void run () {
280+ buttonAlpha = 0 ;
281+ recordButton .animate ()
282+ .alpha (0 )
283+ .setDuration (shortAnimationDuration );
284+ }
285+ }, 3000 );
268286 }
269287
270288 @ Override
@@ -347,15 +365,10 @@ public void onResume() {
347365 }
348366
349367 settingsButton .setAlpha (1 );
368+ recordButton .setAlpha (1 );
350369 autoHideSettingsButton ();
351370 updateWatermark ();
352371 updateVideoZoom ();
353-
354- try {
355- recorder .init ();
356- } catch (IOException e ) {
357- e .printStackTrace ();
358- }
359372 }
360373
361374 @ Override
0 commit comments