Skip to content

Commit aef4c54

Browse files
committed
Changed the startExpanded function to always animate after 200ms
1 parent bc69c8b commit aef4c54

4 files changed

Lines changed: 9 additions & 4 deletions

File tree

.idea/misc.xml

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

app/src/main/res/layout/activity_main.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,7 @@
5555
android:layout_marginRight="20dp"
5656
android:layout_marginBottom="10dp"
5757
app:expandOnClick="true"
58+
app:startExpanded="true"
5859
app:expandableCardRipple="true"
5960
app:expandableCardRadius="6dp"
6061
app:expandableCardStrokeWidth="1dp"

expandablecardview/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ apply plugin: 'kotlin-android-extensions'
55
ext {
66
PUBLISH_GROUP_ID = 'host.stjin'
77
PUBLISH_ARTIFACT_ID = 'expandable-cardview'
8-
PUBLISH_VERSION = '1.3.0-beta01'
8+
PUBLISH_VERSION = '1.3.0-beta02'
99
}
1010

1111
android {

expandablecardview/src/main/java/host/stjin/expandablecardview/ExpandableCardView.kt

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import android.content.Context
55
import android.content.res.TypedArray
66
import android.graphics.Typeface
77
import android.graphics.drawable.Drawable
8+
import android.os.Handler
89
import android.text.TextUtils
910
import android.util.AttributeSet
1011
import android.view.LayoutInflater
@@ -164,8 +165,11 @@ class ExpandableCardView @JvmOverloads constructor(context: Context, attrs: Attr
164165
setInnerView(innerViewRes)
165166

166167
if (startExpanded) {
167-
animDuration = 0
168-
expand()
168+
val handler = Handler()
169+
handler.postDelayed({
170+
expand()
171+
}, 200)
172+
169173
}
170174

171175
if (expandOnClick) {

0 commit comments

Comments
 (0)