SlidingLinearLayout yEs

This commit is contained in:
X1nto 2020-05-10 18:54:39 +04:00
parent f4e7ac4f25
commit d83c780d88
2 changed files with 35 additions and 2 deletions

View File

@ -0,0 +1,33 @@
package com.vanced.manager.ui.core
import android.content.Context
import android.util.AttributeSet
import android.widget.LinearLayout
open class SlidingLinearLayout: LinearLayout {
constructor(context: Context?) : super(context)
constructor(context: Context?, attrs: AttributeSet?) : super(
context,
attrs
)
var yFraction: Float
get() {
val height = height
return if (height != 0)
y / height
else
y
}
set(yFraction) {
val height = height
val newHeight =
if (height > 0)
yFraction * height
else
(-9999).toFloat()
y = newHeight
}
}

View File

@ -26,7 +26,7 @@
android:visibility="gone"
tools:visibility="visible"/>
<LinearLayout
<com.vanced.manager.ui.core.SlidingLinearLayout
android:id="@+id/home_main_wrapper"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -69,7 +69,7 @@
android:layout_marginTop="@dimen/stdp"
android:layout_marginEnd="@dimen/stdp" />
</LinearLayout>
</com.vanced.manager.ui.core.SlidingLinearLayout>
</LinearLayout>