Skip to content
This repository has been archived by the owner on Jul 4, 2024. It is now read-only.

Commit

Permalink
fixing some bugs & preparing for new release
Browse files Browse the repository at this point in the history
  • Loading branch information
roiacult committed Dec 29, 2019
1 parent 6b52db2 commit f434877
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 14 deletions.
1 change: 1 addition & 0 deletions app/src/main/res/layout/search.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
app:toolbarId="@id/toolbar"
app:peekHeight="200dp"
app:menuDrawable="@drawable/filter_variant"
app:disable_when_open="false"
android:layout_width="match_parent"
android:layout_height="match_parent">
<include
Expand Down
29 changes: 15 additions & 14 deletions backdrop/src/main/java/com/roacult/backdrop/BackdropLayout.kt
Original file line number Diff line number Diff line change
Expand Up @@ -126,17 +126,18 @@ class BackdropLayout @JvmOverloads constructor(context: Context, attribute : Att

onBackdropChangeStateListener?.invoke(state)

if(disableWhenOpened) disableFrontLayout(state == State.OPEN)
when(state) {
State.OPEN -> {
getToolbar()?.setNavigationIcon(closeIcon)
val transitionHeight = getTransitionHeight()
if(withAnimation) startTranslateAnimation(transitionHeight)
else {
getFrontLayout().translationY = transitionHeight
getDisablingView().translationY = transitionHeight
getDisablingView().alpha = calculateAlphaVlue(transitionHeight)
getDisablingView().visible(true)
if(disableWhenOpened) {
getDisablingView().translationY = transitionHeight
getDisablingView().alpha = calculateAlphaVlue(transitionHeight)
getDisablingView().visible(true)
}
}
}

Expand All @@ -145,9 +146,11 @@ class BackdropLayout @JvmOverloads constructor(context: Context, attribute : Att
if(withAnimation) startTranslateAnimation(0F)
else {
getFrontLayout().translationY = 0F
getDisablingView().translationY = 0F
getDisablingView().alpha = 0F
getDisablingView().visible(false)
if(disableWhenOpened) {
getDisablingView().translationY = 0F
getDisablingView().alpha = 0F
getDisablingView().visible(false)
}
}
}
}
Expand Down Expand Up @@ -210,9 +213,11 @@ class BackdropLayout @JvmOverloads constructor(context: Context, attribute : Att
addUpdateListener {
val translation = it.animatedValue as Float
getFrontLayout().translationY = translation
getDisablingView().visible(translation != 0F )
getDisablingView().translationY = translation
getDisablingView().alpha = calculateAlphaVlue(translation)
if(disableWhenOpened) {
getDisablingView().visible(translation != 0F)
getDisablingView().translationY = translation
getDisablingView().alpha = calculateAlphaVlue(translation)
}
}
start()
}
Expand All @@ -225,8 +230,4 @@ class BackdropLayout @JvmOverloads constructor(context: Context, attribute : Att
private fun getTransitionHeight(): Float {
return Math.min(getBackLayout().height.toFloat(),height - peeckHeight)
}

private fun disableFrontLayout(disable:Boolean ){
//TODO disable
}
}

0 comments on commit f434877

Please sign in to comment.