Research
Security News
Malicious npm Packages Inject SSH Backdoors via Typosquatted Libraries
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
ru.turlir.android:verticalswipebehavior
Advanced tools
Implementation vertical swipe behavior for Coordinator Layout
VerticalSwipeBehavior is a small and flexible vertical swipe behavior for android CoordinatorLayout. Moves the released view at the given vertical position.
Check repository
allprojects {
repositories {
jcenter()
}
}
Add dependency in to build.gradle
dependencies {
implementation 'io.apiqa.android:verticalswipebehavior:1.0.0'
}
You should have CoordinatorLayout in parent view. Add tag
app:layout_behavior="io.apiqa.android.verticalswipe.VerticalSwipeBehavior"
to your banner.
Padding or margin is optional for positioning. View top is a start point for animation.
<androidx.coordinatorlayout.widget.CoordinatorLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/drag"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/drag_me"
app:layout_behavior="io.apiqa.android.verticalswipe.VerticalSwipeBehavior" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>
Set sideEffect
, clamp
and settle
into VerticalSwipeBehavior for customize banner movement.
val drag = findViewById<View>(R.id.drag)
VerticalSwipeBehavior.from(drag).apply {
sideEffect = NegativeFactorFilterSideEffect(AlphaElevationSideEffect())
clamp = BelowFractionalClamp(minFraction = 3f)
settle = SettleOnTopAction()
}
SideEffect
– Changes view properties depending on the progress of movement.
Default implementation AlphaElevationSideEffect
change alpha and elevation of view.
You may use NegativeFactorFilterSideEffect
for simple composition of behavior.
WithoutSideEffect
does not change any properties of view.
PropertySideEffect
- common way for changing several properties of view.class AlphaElevationSideEffect: SideEffect {
override fun apply(child: View, factor: Float) {
child.elevation = elevation * (1f - abs(factor)) // special for elevation-aware view
child.alpha = 1f - abs(factor)
}
}
VerticalClamp
– Have limits on moving view vertically.
It is often necessary to limit movement to a part of the height of view.
This is done by FractionClamp
. Also you can use SensitivityClamp
for tuning sensitivity.class FractionClamp(private val maxFraction: Float = 1f, private val minFraction: Float = 1f): VerticalClamp {
override fun constraint(height: Int, top: Int, dy: Int): Int {
val min = min(top, originTop + (height * minFraction).toInt())
return max(min, originTop - (height * maxFraction).toInt())
}
override fun downCast(distance: Int, top: Int, height: Int, dy: Int): Float {
return distance / (height * maxFraction)
}
override fun upCast(distance: Int, top: Int, height: Int, dy: Int): Float {
return distance / (height * minFraction)
}
}
PostAction
– Responsible for changing view position after swipe is completed.
ViewDragHelper is used for animation moving of view in consideration of pointer speed.
OriginSettleAction
moves the view to the starting position.class OriginSettleAction: PostAction {
override fun releasedBelow(helper: ViewDragHelper, diff: Int, child: View): Boolean {
return helper.settleCapturedViewAt(child.left, originTop)
}
override fun releasedAbove(helper: ViewDragHelper, diff: Int, child: View): Boolean {
return helper.settleCapturedViewAt(child.left, originTop)
}
}
FAQs
Implementation vertical swipe behavior for Coordinator Layout
We found that ru.turlir.android:verticalswipebehavior demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 0 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Research
Security News
Socket’s threat research team has detected six malicious npm packages typosquatting popular libraries to insert SSH backdoors.
Security News
MITRE's 2024 CWE Top 25 highlights critical software vulnerabilities like XSS, SQL Injection, and CSRF, reflecting shifts due to a refined ranking methodology.
Security News
In this segment of the Risky Business podcast, Feross Aboukhadijeh and Patrick Gray discuss the challenges of tracking malware discovered in open source softare.