diff --git a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt index 99f1691..d0cad31 100644 --- a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt +++ b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt @@ -328,23 +328,6 @@ } }) - binding.downScaleButton.setOnTouchListener { _, event -> - when (event.action) { - MotionEvent.ACTION_DOWN -> { - if (isPreviewSuccess && isScaleButtonUp) { - hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 0) - isScaleButtonUp = false - } - } - - MotionEvent.ACTION_UP -> { - isScaleButtonUp = true - hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 1) - } - } - true - } - binding.upScaleButton.setOnTouchListener { _, event -> when (event.action) { MotionEvent.ACTION_DOWN -> { @@ -359,7 +342,24 @@ hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_IN, 1) } } - true + false + } + + binding.downScaleButton.setOnTouchListener { _, event -> + when (event.action) { + MotionEvent.ACTION_DOWN -> { + if (isPreviewSuccess && isScaleButtonUp) { + hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 0) + isScaleButtonUp = false + } + } + + MotionEvent.ACTION_UP -> { + isScaleButtonUp = true + hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 1) + } + } + false } } diff --git a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt index 99f1691..d0cad31 100644 --- a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt +++ b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt @@ -328,23 +328,6 @@ } }) - binding.downScaleButton.setOnTouchListener { _, event -> - when (event.action) { - MotionEvent.ACTION_DOWN -> { - if (isPreviewSuccess && isScaleButtonUp) { - hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 0) - isScaleButtonUp = false - } - } - - MotionEvent.ACTION_UP -> { - isScaleButtonUp = true - hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 1) - } - } - true - } - binding.upScaleButton.setOnTouchListener { _, event -> when (event.action) { MotionEvent.ACTION_DOWN -> { @@ -359,7 +342,24 @@ hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_IN, 1) } } - true + false + } + + binding.downScaleButton.setOnTouchListener { _, event -> + when (event.action) { + MotionEvent.ACTION_DOWN -> { + if (isPreviewSuccess && isScaleButtonUp) { + hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 0) + isScaleButtonUp = false + } + } + + MotionEvent.ACTION_UP -> { + isScaleButtonUp = true + hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 1) + } + } + false } } diff --git a/app/src/main/res/drawable/selector_scale_button.xml b/app/src/main/res/drawable/selector_scale_button.xml new file mode 100644 index 0000000..7273700 --- /dev/null +++ b/app/src/main/res/drawable/selector_scale_button.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt index 99f1691..d0cad31 100644 --- a/app/src/main/java/com/casic/endoscope/view/MainActivity.kt +++ b/app/src/main/java/com/casic/endoscope/view/MainActivity.kt @@ -328,23 +328,6 @@ } }) - binding.downScaleButton.setOnTouchListener { _, event -> - when (event.action) { - MotionEvent.ACTION_DOWN -> { - if (isPreviewSuccess && isScaleButtonUp) { - hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 0) - isScaleButtonUp = false - } - } - - MotionEvent.ACTION_UP -> { - isScaleButtonUp = true - hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 1) - } - } - true - } - binding.upScaleButton.setOnTouchListener { _, event -> when (event.action) { MotionEvent.ACTION_DOWN -> { @@ -359,7 +342,24 @@ hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_IN, 1) } } - true + false + } + + binding.downScaleButton.setOnTouchListener { _, event -> + when (event.action) { + MotionEvent.ACTION_DOWN -> { + if (isPreviewSuccess && isScaleButtonUp) { + hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 0) + isScaleButtonUp = false + } + } + + MotionEvent.ACTION_UP -> { + isScaleButtonUp = true + hkSDK.NET_DVR_PTZControl(previewHandle, PTZCommand.ZOOM_OUT, 1) + } + } + false } } diff --git a/app/src/main/res/drawable/selector_scale_button.xml b/app/src/main/res/drawable/selector_scale_button.xml new file mode 100644 index 0000000..7273700 --- /dev/null +++ b/app/src/main/res/drawable/selector_scale_button.xml @@ -0,0 +1,16 @@ + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/app/src/main/res/layout/activity_main.xml b/app/src/main/res/layout/activity_main.xml index f5ccfd0..41ff10a 100644 --- a/app/src/main/res/layout/activity_main.xml +++ b/app/src/main/res/layout/activity_main.xml @@ -272,7 +272,7 @@ @@ -287,14 +287,16 @@ android:layout_width="wrap_content" android:layout_height="match_parent" android:layout_marginTop="@dimen/dp_10" - android:background="@drawable/bg_stroke_layout_blue_10" - android:paddingHorizontal="@dimen/dp_20" - android:paddingVertical="@dimen/dp_10"> + android:background="@drawable/bg_stroke_layout_blue_10"> @@ -314,9 +316,13 @@ @@ -339,8 +345,7 @@