SlidingLinearLayout yEs
This commit is contained in:
parent
f4e7ac4f25
commit
d83c780d88
|
@ -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
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -26,7 +26,7 @@
|
||||||
android:visibility="gone"
|
android:visibility="gone"
|
||||||
tools:visibility="visible"/>
|
tools:visibility="visible"/>
|
||||||
|
|
||||||
<LinearLayout
|
<com.vanced.manager.ui.core.SlidingLinearLayout
|
||||||
android:id="@+id/home_main_wrapper"
|
android:id="@+id/home_main_wrapper"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
@ -69,7 +69,7 @@
|
||||||
android:layout_marginTop="@dimen/stdp"
|
android:layout_marginTop="@dimen/stdp"
|
||||||
android:layout_marginEnd="@dimen/stdp" />
|
android:layout_marginEnd="@dimen/stdp" />
|
||||||
|
|
||||||
</LinearLayout>
|
</com.vanced.manager.ui.core.SlidingLinearLayout>
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue