Skip to content

Commit

Permalink
- Added @keep annotation for companion object
Browse files Browse the repository at this point in the history
- Correct casting of parent view in animateContentIn
- Added fourth LinearLayout constructor
  • Loading branch information
tingyik90 committed May 11, 2019
1 parent 53c3781 commit c4a1fb7
Showing 1 changed file with 15 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -1,14 +1,18 @@
package com.tingyik90.snackprogressbar

import android.annotation.SuppressLint
import android.annotation.TargetApi
import android.content.Context
import android.util.AttributeSet
import android.util.TypedValue
import android.view.MotionEvent
import android.view.VelocityTracker
import android.view.View
import android.view.ViewGroup
import android.widget.*
import android.widget.ImageView
import android.widget.LinearLayout
import android.widget.ProgressBar
import android.widget.TextView
import androidx.annotation.ColorRes
import androidx.annotation.Keep
import androidx.coordinatorlayout.widget.CoordinatorLayout
Expand All @@ -32,7 +36,16 @@ class SnackProgressBarLayout : LinearLayout, ContentViewCallback {

constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr)

@TargetApi(21)
constructor(
context: Context,
attrs: AttributeSet?,
defStyleAttr: Int,
defStyleRes: Int
) : super(context, attrs, defStyleAttr, defStyleRes)

/* companion object */
@Keep
companion object {

internal const val ACTION_DOWN = 123
Expand Down Expand Up @@ -277,7 +290,7 @@ class SnackProgressBarLayout : LinearLayout, ContentViewCallback {
)
val parent = parent as? View
val bottomMargin = if (parent != null) {
val layoutParams = parent.layoutParams as FrameLayout.LayoutParams
val layoutParams = parent.layoutParams as MarginLayoutParams
layoutParams.bottomMargin
} else {
0
Expand Down

0 comments on commit c4a1fb7

Please sign in to comment.