Skip to content

Commit

Permalink
- Added @keep annotation for companion object
Browse files Browse the repository at this point in the history
  • Loading branch information
tingyik90 committed May 11, 2019
1 parent 3c14116 commit 53c3781
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ class SnackProgressBar(@SnackProgressBarType private var type: Int, private var
annotation class SnackProgressBarType

/* companion object */
@Keep
companion object {

/**
* SnackProgressBar layout with message only.
*/
Expand All @@ -39,8 +41,11 @@ class SnackProgressBar(@SnackProgressBarType private var type: Int, private var
* SnackProgressBar layout with message and circular ProgressBar.
*/
const val TYPE_CIRCULAR = 300

/**
* Placeholder for no icon.
*/
internal const val DEFAULT_ICON_RES_ID = -1

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,9 @@ internal class SnackProgressBarCore private constructor(
private val runnable = Runnable { dismiss() }

/* companion object */
@Keep
companion object {

/**
* Prepares SnackProgressBarCore.
*
Expand Down Expand Up @@ -83,6 +85,7 @@ internal class SnackProgressBarCore private constructor(
snackProgressBarCore.updateTo(snackProgressBar)
return snackProgressBarCore
}

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,9 @@ class SnackProgressBarManager(providedView: View, lifecycleOwner: LifecycleOwner
}

/* companion object */
// @Keep annotation is required to prevent proguard from removing the companion object.
// See https://stackoverflow.com/a/53863656/3584439.
@Keep
companion object {

@Retention(AnnotationRetention.SOURCE)
Expand Down Expand Up @@ -112,6 +115,7 @@ class SnackProgressBarManager(providedView: View, lifecycleOwner: LifecycleOwner
* Default displayId
*/
private const val NO_DISPLAY_ID = -1

}

/* parameters */
Expand Down

0 comments on commit 53c3781

Please sign in to comment.