Skip to content

Commit

Permalink
Merge pull request #13 from aitsuki/fix-12
Browse files Browse the repository at this point in the history
Fix #12
  • Loading branch information
aitsuki authored Oct 27, 2021
2 parents 5d4d533 + ca33d35 commit c3053c3
Showing 1 changed file with 0 additions and 18 deletions.
18 changes: 0 additions & 18 deletions library/src/main/java/com/aitsuki/swipe/SwipeLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ package com.aitsuki.swipe
import android.annotation.SuppressLint
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.util.SparseIntArray
import android.view.*
import androidx.core.view.GravityCompat
import androidx.core.view.ViewCompat
Expand Down Expand Up @@ -60,7 +58,6 @@ class SwipeLayout @JvmOverloads constructor(
private var rightMenu: View? = null
private val designer: Designer
private var initDesigner = false
private var firstLayout = true

var swipeEnable = true
set(value) {
Expand Down Expand Up @@ -121,10 +118,6 @@ class SwipeLayout @JvmOverloads constructor(
val contentView = contentView ?: return
val activeMenu = activeMenu ?: return
when {
firstLayout -> {
onScreen = 0f
openState = 0
}
animate -> {
openState = openState or FLAG_IS_CLOSING
dragger.smoothSlideViewTo(contentView, paddingLeft, contentView.top)
Expand All @@ -148,10 +141,6 @@ class SwipeLayout @JvmOverloads constructor(
val left = if (activeMenu == leftMenu) activeMenu.width + paddingLeft
else -activeMenu.width + paddingLeft
when {
firstLayout -> {
onScreen = 1f
openState = FLAG_IS_OPENED
}
animate -> {
openState = openState or FLAG_IS_OPENING
dragger.smoothSlideViewTo(contentView, left, contentView.top)
Expand Down Expand Up @@ -405,11 +394,6 @@ class SwipeLayout @JvmOverloads constructor(
return activeMenu == dragger.findTopChildUnder(x, y)
}

override fun onAttachedToWindow() {
super.onAttachedToWindow()
firstLayout = true
}

override fun onDetachedFromWindow() {
if (openState and FLAG_IS_CLOSING == FLAG_IS_CLOSING) {
dragger.abort()
Expand All @@ -418,7 +402,6 @@ class SwipeLayout @JvmOverloads constructor(
ViewCompat.offsetLeftAndRight(it, paddingLeft - it.left)
}
}
firstLayout = true
super.onDetachedFromWindow()
}

Expand Down Expand Up @@ -566,7 +549,6 @@ class SwipeLayout @JvmOverloads constructor(
designer.onLayout(it, contentView.right, parentTop, parentRight, parentBottom)
}
}
firstLayout = false
}

override fun generateDefaultLayoutParams(): ViewGroup.LayoutParams {
Expand Down

0 comments on commit c3053c3

Please sign in to comment.