Research
Security News
Malicious npm Package Targets Solana Developers and Hijacks Funds
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
com.github.zcweng:switch-button
Advanced tools
SwitchButton.An *beautiful+lightweight+custom-style-easy* switch widget for Android
SwitchButton.An beautiful+lightweight+custom-style-easy switch widget for Android,minSdkVersion >= 14
issues welcome~
-depend without third-part library
-without raw files(pictures/drawables etc...), only one java and style.xml file
-drag switch supported
gradle:
repositories {
mavenCentral()
jcenter()
}
...
dependencies {
implementation 'com.github.zcweng:switch-button:0.0.3@aar'
}
layout.xml:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:orientation="vertical">
<com.suke.widget.SwitchButton
android:id="@+id/switch_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</LinearLayout>
Java:
SwitchButton switchButton = (com.suke.widget.SwitchButton)
findViewById(R.id.switch_button);
switchButton.setChecked(true);
switchButton.isChecked();
switchButton.toggle(); //switch state
switchButton.toggle(false);//switch without animation
switchButton.setShadowEffect(true);//disable shadow effect
switchButton.setEnabled(false);//disable button
switchButton.setEnableEffect(false);//disable the switch animation
switchButton.setOnCheckedChangeListener(new SwitchButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(SwitchButton view, boolean isChecked) {
//TODO do your job
}
});
Kotlin:
val switchButton = findViewById<View>(R.id.switch_button) as SwitchButton
switchButton.isChecked = true
switchButton.isChecked
switchButton.toggle() //switch state
switchButton.toggle(false) //switch without animation
switchButton.setShadowEffect(true) //disable shadow effect
switchButton.isEnabled = false //disable button
switchButton.setEnableEffect(false) //disable the switch animation
switchButton.setOnCheckedChangeListener(object : SwitchButton.OnCheckedChangeListener {
override fun onCheckedChanged(view: SwitchButton?, isChecked: Boolean) {
//TODO do your job
}
})
More Style:
<attr name="sb_shadow_radius" format="reference|dimension"/> 阴影半径
<attr name="sb_shadow_offset" format="reference|dimension"/> 阴影偏移
<attr name="sb_shadow_color" format="reference|color"/> 阴影颜色
<attr name="sb_uncheck_color" format="reference|color"/> 关闭颜色
<attr name="sb_checked_color" format="reference|color"/> 开启颜色
<attr name="sb_border_width" format="reference|dimension"/> 边框宽度
<attr name="sb_checkline_color" format="reference|color"/> 开启指示器颜色
<attr name="sb_checkline_width" format="reference|dimension"/> 开启指示器线宽
<attr name="sb_uncheckcircle_color" format="reference|color"/> 关闭指示器颜色
<attr name="sb_uncheckcircle_width" format="reference|dimension"/> 关闭指示器线宽
<attr name="sb_uncheckcircle_radius" format="reference|dimension"/>关闭指示器半径
<attr name="sb_checked" format="reference|boolean"/> 是否选中
<attr name="sb_shadow_effect" format="reference|boolean"/> 是否启用阴影
<attr name="sb_effect_duration" format="reference|integer"/> 动画时间,默认300ms
<attr name="sb_button_color" format="reference|color"/> 按钮颜色
<attr name="sb_show_indicator" format="reference|boolean"/> 是否显示指示器,默认true:显示
<attr name="sb_background" format="reference|color"/> 背景色,默认白色
<attr name="sb_enable_effect" format="reference|boolean"/> 是否启用特效,默认true
MIT, See the [LICENSE] file for details.
FAQs
SwitchButton.An *beautiful+lightweight+custom-style-easy* switch widget for Android
We found that com.github.zcweng:switch-button 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
A malicious npm package targets Solana developers, rerouting funds in 2% of transactions to a hardcoded address.
Security News
Research
Socket researchers have discovered malicious npm packages targeting crypto developers, stealing credentials and wallet data using spyware delivered through typosquats of popular cryptographic libraries.
Security News
Socket's package search now displays weekly downloads for npm packages, helping developers quickly assess popularity and make more informed decisions.