Skip to content

Commit c3053c3

Browse files
authored
Merge pull request #13 from aitsuki/fix-12
Fix #12
2 parents 5d4d533 + ca33d35 commit c3053c3

File tree

1 file changed

+0
-18
lines changed

1 file changed

+0
-18
lines changed

library/src/main/java/com/aitsuki/swipe/SwipeLayout.kt

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,6 @@ package com.aitsuki.swipe
33
import android.annotation.SuppressLint
44
import android.content.Context
55
import android.util.AttributeSet
6-
import android.util.Log
7-
import android.util.SparseIntArray
86
import android.view.*
97
import androidx.core.view.GravityCompat
108
import androidx.core.view.ViewCompat
@@ -60,7 +58,6 @@ class SwipeLayout @JvmOverloads constructor(
6058
private var rightMenu: View? = null
6159
private val designer: Designer
6260
private var initDesigner = false
63-
private var firstLayout = true
6461

6562
var swipeEnable = true
6663
set(value) {
@@ -121,10 +118,6 @@ class SwipeLayout @JvmOverloads constructor(
121118
val contentView = contentView ?: return
122119
val activeMenu = activeMenu ?: return
123120
when {
124-
firstLayout -> {
125-
onScreen = 0f
126-
openState = 0
127-
}
128121
animate -> {
129122
openState = openState or FLAG_IS_CLOSING
130123
dragger.smoothSlideViewTo(contentView, paddingLeft, contentView.top)
@@ -148,10 +141,6 @@ class SwipeLayout @JvmOverloads constructor(
148141
val left = if (activeMenu == leftMenu) activeMenu.width + paddingLeft
149142
else -activeMenu.width + paddingLeft
150143
when {
151-
firstLayout -> {
152-
onScreen = 1f
153-
openState = FLAG_IS_OPENED
154-
}
155144
animate -> {
156145
openState = openState or FLAG_IS_OPENING
157146
dragger.smoothSlideViewTo(contentView, left, contentView.top)
@@ -405,11 +394,6 @@ class SwipeLayout @JvmOverloads constructor(
405394
return activeMenu == dragger.findTopChildUnder(x, y)
406395
}
407396

408-
override fun onAttachedToWindow() {
409-
super.onAttachedToWindow()
410-
firstLayout = true
411-
}
412-
413397
override fun onDetachedFromWindow() {
414398
if (openState and FLAG_IS_CLOSING == FLAG_IS_CLOSING) {
415399
dragger.abort()
@@ -418,7 +402,6 @@ class SwipeLayout @JvmOverloads constructor(
418402
ViewCompat.offsetLeftAndRight(it, paddingLeft - it.left)
419403
}
420404
}
421-
firstLayout = true
422405
super.onDetachedFromWindow()
423406
}
424407

@@ -566,7 +549,6 @@ class SwipeLayout @JvmOverloads constructor(
566549
designer.onLayout(it, contentView.right, parentTop, parentRight, parentBottom)
567550
}
568551
}
569-
firstLayout = false
570552
}
571553

572554
override fun generateDefaultLayoutParams(): ViewGroup.LayoutParams {

0 commit comments

Comments
 (0)