Skip to content

Commit

Permalink
Add the possibility of disabling the status bar animation
Browse files Browse the repository at this point in the history
  • Loading branch information
André Sousa committed Oct 31, 2018
1 parent 408e0f4 commit 3538dd7
Showing 1 changed file with 6 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ abstract class SuperBottomSheetFragment : BottomSheetDialogFragment() {
private var propertyIsAlwaysExpanded = false
private var propertyIsSheetCancelableOnTouchOutside = true
private var propertyIsSheetCancelable = true
private var propertyAnimateStatusBar = true
private var propertyAnimateCornerRadius = true

// Bottom sheet properties
Expand All @@ -61,7 +60,11 @@ abstract class SuperBottomSheetFragment : BottomSheetDialogFragment() {
/** Methods from [BottomSheetDialogFragment] */

final override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
return SuperBottomSheetDialog(this.context!!, R.style.superBottomSheetDialog)
if (animateStatusBar()) {
return SuperBottomSheetDialog(this.context!!, R.style.superBottomSheetDialog)
}

return SuperBottomSheetDialog(this.context!!)
}

@CallSuper
Expand All @@ -78,7 +81,6 @@ abstract class SuperBottomSheetFragment : BottomSheetDialogFragment() {
propertyIsAlwaysExpanded = isSheetAlwaysExpanded()
propertyIsSheetCancelable = isSheetCancelable()
propertyIsSheetCancelableOnTouchOutside = isSheetCancelableOnTouchOutside()
propertyAnimateStatusBar = animateStatusBar()
propertyAnimateCornerRadius = animateCornerRadius()

// Set dialog properties
Expand Down Expand Up @@ -227,12 +229,7 @@ abstract class SuperBottomSheetFragment : BottomSheetDialogFragment() {
return
}

val color = if (!propertyAnimateStatusBar) {
calculateColor(propertyStatusBarColor, 0f)
} else {
calculateColor(propertyStatusBarColor, dim)
}

val color = calculateColor(propertyStatusBarColor, dim)
dialog.window!!.statusBarColor = color
}

Expand Down

0 comments on commit 3538dd7

Please sign in to comment.