Merge branch 'master' into profile_feed

This commit is contained in:
mjaillot 2021-03-26 14:13:56 +01:00
commit 3972ffd093
4 changed files with 12 additions and 8 deletions

View File

@ -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[^%]*%'

View File

@ -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<Intent> = CoreMatchers.allOf(
IntentMatchers.hasExtra(ACCOUNT_TAG, account)

View File

@ -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

View File

@ -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) {