From 1ae9a57b570e26cd108c90ec7d2b32924db6615a Mon Sep 17 00:00:00 2001 From: albexk Date: Tue, 22 Oct 2024 14:19:44 +0300 Subject: [PATCH] Fix merge --- client/android/gradle.properties | 2 +- .../src/org/amnezia/vpn/AmneziaActivity.kt | 61 ------------------- client/cmake/android.cmake | 2 +- 3 files changed, 2 insertions(+), 63 deletions(-) diff --git a/client/android/gradle.properties b/client/android/gradle.properties index ce651e1c..5a27838c 100644 --- a/client/android/gradle.properties +++ b/client/android/gradle.properties @@ -33,7 +33,7 @@ android.library.defaults.buildfeatures.androidresources=false # For development copy and set local values for these parameters in local.properties #androidCompileSdkVersion=android-34 #androidBuildToolsVersion=34.0.0 -#qtMinSdkVersion=26 +#qtMinSdkVersion=24 #qtTargetSdkVersion=34 #androidNdkVersion=26.1.10909125 #qtTargetAbiList=x86_64 diff --git a/client/android/src/org/amnezia/vpn/AmneziaActivity.kt b/client/android/src/org/amnezia/vpn/AmneziaActivity.kt index 68a5c37b..30bf09a3 100644 --- a/client/android/src/org/amnezia/vpn/AmneziaActivity.kt +++ b/client/android/src/org/amnezia/vpn/AmneziaActivity.kt @@ -19,7 +19,6 @@ import android.os.Looper import android.os.Message import android.os.Messenger import android.provider.Settings -import android.view.MotionEvent import android.view.WindowManager.LayoutParams import android.webkit.MimeTypeMap import android.widget.Toast @@ -695,66 +694,6 @@ class AmneziaActivity : QtActivity() { } } - // workaround for a bug in Qt that causes the mouse click event not to be handled - // also disable right-click, as it causes the application to crash - private var lastButtonState = 0 - private fun MotionEvent.fixCopy(): MotionEvent = MotionEvent.obtain( - downTime, - eventTime, - action, - pointerCount, - (0 until pointerCount).map { i -> - MotionEvent.PointerProperties().apply { - getPointerProperties(i, this) - } - }.toTypedArray(), - (0 until pointerCount).map { i -> - MotionEvent.PointerCoords().apply { - getPointerCoords(i, this) - } - }.toTypedArray(), - metaState, - MotionEvent.BUTTON_PRIMARY, - xPrecision, - yPrecision, - deviceId, - edgeFlags, - source, - flags - ) - - private fun handleMouseEvent(ev: MotionEvent, superDispatch: (MotionEvent?) -> Boolean): Boolean { - when (ev.action) { - MotionEvent.ACTION_DOWN -> { - lastButtonState = ev.buttonState - if (ev.buttonState == MotionEvent.BUTTON_SECONDARY) return true - } - - MotionEvent.ACTION_UP -> { - when (lastButtonState) { - MotionEvent.BUTTON_SECONDARY -> return true - MotionEvent.BUTTON_PRIMARY -> { - val modEvent = ev.fixCopy() - return superDispatch(modEvent).apply { modEvent.recycle() } - } - } - } - } - return superDispatch(ev) - } - - override fun dispatchTouchEvent(ev: MotionEvent?): Boolean { - if (ev != null && ev.getToolType(0) == MotionEvent.TOOL_TYPE_MOUSE) { - return handleMouseEvent(ev) { super.dispatchTouchEvent(it) } - } - return super.dispatchTouchEvent(ev) - } - - override fun dispatchTrackballEvent(ev: MotionEvent?): Boolean { - ev?.let { return handleMouseEvent(ev) { super.dispatchTrackballEvent(it) }} - return super.dispatchTrackballEvent(ev) - } - /** * Utils methods */ diff --git a/client/cmake/android.cmake b/client/cmake/android.cmake index 34ca5bff..c96d9ab8 100644 --- a/client/cmake/android.cmake +++ b/client/cmake/android.cmake @@ -1,6 +1,6 @@ message("Client android ${CMAKE_ANDROID_ARCH_ABI} build") -set(APP_ANDROID_MIN_SDK 26) +set(APP_ANDROID_MIN_SDK 24) set(ANDROID_PLATFORM "android-${APP_ANDROID_MIN_SDK}" CACHE STRING "The minimum API level supported by the application or library" FORCE)