diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index b0236e9c..f24f203f 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -31,7 +31,7 @@ debugTests: interruptible: true stage: test script: - - ./gradlew -Pci --console=plain :app:testDebug + - ./gradlew -Pci --console=plain :app:testDebug -x lint emulatorTest: @@ -41,13 +41,13 @@ emulatorTest: - echo no | avdmanager create avd --force --name "api-${API_LEVEL}" --abi "${TARGET}/${ARCH}" --package "system-images;android-${API_LEVEL};${TARGET};${ARCH}" - $ANDROID_SDK_ROOT/emulator/emulator -avd "api-${API_LEVEL}" -no-window -gpu swiftshader_indirect -no-snapshot -noaudio -no-boot-anim -camera-back none & - chmod +x android-wait-for-emulator.sh - - ./gradlew build + - ./gradlew build -x lint - ./android-wait-for-emulator.sh - adb shell settings put global window_animation_scale 0.0 - adb shell settings put global transition_animation_scale 0.0 - adb shell settings put global animator_duration_scale 0.0 - - ./gradlew build connectedCheck connectedStagingAndroidTest jacocoTestReport + - ./gradlew build connectedCheck connectedStagingAndroidTest jacocoTestReport -x lint - cat app/build/reports/jacoco/jacocoTestReport/html/index.html | grep -o 'Total[^%]*%' diff --git a/app/src/androidTest/java/com/h/pixeldroid/IntentTest.kt b/app/src/androidTest/java/com/h/pixeldroid/IntentTest.kt index 2ba72bcd..55696c3f 100644 --- a/app/src/androidTest/java/com/h/pixeldroid/IntentTest.kt +++ b/app/src/androidTest/java/com/h/pixeldroid/IntentTest.kt @@ -83,7 +83,7 @@ class IntentTest { "https://testing2.pixeldroid.org/storage/avatars/default.jpg?v=0", "https://testing2.pixeldroid.org/storage/avatars/default.jpg?v=0", "", "", false, emptyList(), null, - "2021-02-11T23:44:03.000000Z", 0, 1, 1, + "2021-02-11T23:44:03.000000Z", 0, 1, 2, null, null, false, null) val expectedIntent: Matcher = CoreMatchers.allOf( IntentMatchers.hasExtra(ACCOUNT_TAG, account) diff --git a/app/src/main/java/com/h/pixeldroid/posts/NestedScrollableHost.kt b/app/src/main/java/com/h/pixeldroid/posts/NestedScrollableHost.kt index 2a99aa95..49b3ac60 100644 --- a/app/src/main/java/com/h/pixeldroid/posts/NestedScrollableHost.kt +++ b/app/src/main/java/com/h/pixeldroid/posts/NestedScrollableHost.kt @@ -21,7 +21,6 @@ import android.util.AttributeSet import android.view.MotionEvent import android.view.View import android.view.ViewConfiguration -import android.widget.FrameLayout import androidx.constraintlayout.widget.ConstraintLayout import androidx.viewpager2.widget.ViewPager2 import androidx.viewpager2.widget.ViewPager2.ORIENTATION_HORIZONTAL @@ -52,6 +51,8 @@ class NestedScrollableHost : ConstraintLayout { return v as? ViewPager2 } + var doubleTapCallback: ((Unit) -> Unit)? = null + private val child: View? get() = if (childCount > 0) getChildAt(0) else null init { @@ -75,14 +76,17 @@ class NestedScrollableHost : ConstraintLayout { private fun handleInterceptTouchEvent(e: MotionEvent) { val orientation = parentViewPager?.orientation ?: return + if (e.action == MotionEvent.ACTION_DOWN) { + initialX = e.x + initialY = e.y + doubleTapCallback?.invoke(Unit) + } // Early return if child can't scroll in same direction as parent if (!canChildScroll(orientation, -1f) && !canChildScroll(orientation, 1f)) { return } if (e.action == MotionEvent.ACTION_DOWN) { - initialX = e.x - initialY = e.y parent.requestDisallowInterceptTouchEvent(true) } else if (e.action == MotionEvent.ACTION_MOVE) { val dx = e.x - initialX diff --git a/app/src/main/java/com/h/pixeldroid/posts/StatusViewHolder.kt b/app/src/main/java/com/h/pixeldroid/posts/StatusViewHolder.kt index 5d7efa3d..d5b5b89e 100644 --- a/app/src/main/java/com/h/pixeldroid/posts/StatusViewHolder.kt +++ b/app/src/main/java/com/h/pixeldroid/posts/StatusViewHolder.kt @@ -467,7 +467,7 @@ class StatusViewHolder(val binding: PostFragmentBinding) : RecyclerView.ViewHold //Activate double tap liking var clicked = false - binding.postPager.setOnClickListener { + binding.postPagerHost.doubleTapCallback = { lifecycleScope.launchWhenCreated { //Check that the post isn't hidden if(binding.sensitiveWarning.visibility == View.GONE) {