-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
279 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
app/src/main/java/io/github/a13e300/ro_tieba/misc/ContainerBehavior.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.github.a13e300.ro_tieba.misc | ||
|
||
import android.content.Context | ||
import android.util.AttributeSet | ||
import android.view.View | ||
import androidx.coordinatorlayout.widget.CoordinatorLayout | ||
import io.github.a13e300.ro_tieba.R | ||
|
||
class ContainerBehavior(context: Context, attrs: AttributeSet) : | ||
CoordinatorLayout.Behavior<View>(context, attrs) { | ||
override fun onMeasureChild( | ||
parent: CoordinatorLayout, | ||
child: View, | ||
parentWidthMeasureSpec: Int, | ||
widthUsed: Int, | ||
parentHeightMeasureSpec: Int, | ||
heightUsed: Int | ||
): Boolean { | ||
parent.onMeasureChild( | ||
child, | ||
parentWidthMeasureSpec, | ||
widthUsed, | ||
parentHeightMeasureSpec, | ||
heightUsed | ||
) | ||
return true | ||
} | ||
|
||
override fun onLayoutChild( | ||
parent: CoordinatorLayout, | ||
child: View, | ||
layoutDirection: Int | ||
): Boolean { | ||
parent.onLayoutChild(child, layoutDirection) | ||
child.offsetTopAndBottom(parent.findViewById<View>(R.id.list).top) | ||
return true | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.