@@ -3,8 +3,6 @@ package com.aitsuki.swipe
3
3
import android.annotation.SuppressLint
4
4
import android.content.Context
5
5
import android.util.AttributeSet
6
- import android.util.Log
7
- import android.util.SparseIntArray
8
6
import android.view.*
9
7
import androidx.core.view.GravityCompat
10
8
import androidx.core.view.ViewCompat
@@ -60,7 +58,6 @@ class SwipeLayout @JvmOverloads constructor(
60
58
private var rightMenu: View ? = null
61
59
private val designer: Designer
62
60
private var initDesigner = false
63
- private var firstLayout = true
64
61
65
62
var swipeEnable = true
66
63
set(value) {
@@ -121,10 +118,6 @@ class SwipeLayout @JvmOverloads constructor(
121
118
val contentView = contentView ? : return
122
119
val activeMenu = activeMenu ? : return
123
120
when {
124
- firstLayout -> {
125
- onScreen = 0f
126
- openState = 0
127
- }
128
121
animate -> {
129
122
openState = openState or FLAG_IS_CLOSING
130
123
dragger.smoothSlideViewTo(contentView, paddingLeft, contentView.top)
@@ -148,10 +141,6 @@ class SwipeLayout @JvmOverloads constructor(
148
141
val left = if (activeMenu == leftMenu) activeMenu.width + paddingLeft
149
142
else - activeMenu.width + paddingLeft
150
143
when {
151
- firstLayout -> {
152
- onScreen = 1f
153
- openState = FLAG_IS_OPENED
154
- }
155
144
animate -> {
156
145
openState = openState or FLAG_IS_OPENING
157
146
dragger.smoothSlideViewTo(contentView, left, contentView.top)
@@ -405,11 +394,6 @@ class SwipeLayout @JvmOverloads constructor(
405
394
return activeMenu == dragger.findTopChildUnder(x, y)
406
395
}
407
396
408
- override fun onAttachedToWindow () {
409
- super .onAttachedToWindow()
410
- firstLayout = true
411
- }
412
-
413
397
override fun onDetachedFromWindow () {
414
398
if (openState and FLAG_IS_CLOSING == FLAG_IS_CLOSING ) {
415
399
dragger.abort()
@@ -418,7 +402,6 @@ class SwipeLayout @JvmOverloads constructor(
418
402
ViewCompat .offsetLeftAndRight(it, paddingLeft - it.left)
419
403
}
420
404
}
421
- firstLayout = true
422
405
super .onDetachedFromWindow()
423
406
}
424
407
@@ -566,7 +549,6 @@ class SwipeLayout @JvmOverloads constructor(
566
549
designer.onLayout(it, contentView.right, parentTop, parentRight, parentBottom)
567
550
}
568
551
}
569
- firstLayout = false
570
552
}
571
553
572
554
override fun generateDefaultLayoutParams (): ViewGroup .LayoutParams {
0 commit comments