zanpakuto
is a suite of libraries to help app-development, similar Android-Jetpack
snapshot, add config:
repositories {
maven {
url 'https://s01.oss.sonatype.org/content/repositories/snapshots/'
}
}
Provides some useful infras functions
dependencies {
implementation 'cn.alvince.zanpakuto:core:1.0.1' // require Kotlin 1.6
// or deps lower version of Kotlin
implementation 'cn.alvince.zanpakuto:core-stdlib1.3:1.0.0' // Kotlin 1.3
}
Fast create & play view animation
val animation = alphaAnimation {
// changeAlpha(0.3F, 1F)
from = 0.3F
to = 1.0F
} // create an AlphaAnimation
val animation = view.alpha {
from = 0.3F
to = 1.0F
} // create and play animation directly
Provides some Android Lifecycle
based components, and exensions for lifecycle
dependencies {
implementation 'cn.alvince.zanpakuto:lifecycle:1.0.0.f' // require Kotlin 1.6
implementation 'cn.alvince.zanpakuto:core:1.0.0.f' // deps on lib-core
// or deps lower version of Kotlin
implementation 'cn.alvince.zanpakuto:lifecycle-stdlib1.3:1.0.0' // Kotlin 1.3
implementation 'cn.alvince.zanpakuto:core-stdlib1.3:1.0.0'
}
Provides some Android View
extensions
Provides some Android Viewbinding
extensions
dependencies {
implementation 'cn.alvince.zanpakuto:viewbinding:0.1-SNAPSHOT'
}
for Activity
class MyActivity : ComponentActivity(), ActivityViewBinding<MyActivityBinding> by ActivityBinding() {
override fun onCreate(savedInstanceState: Bundle?) {
…
// replace setContentView(), and hold binding instance
inflate(
inflate = { MyActivityBinding.inflate(layoutInflater) },
/* option: */onClear = { it.onClear() },
) { binding ->
// init with binding
…
}
…
}
// Optional: perform clear binding
private fun MyActivityBinding.onClear() {
…
}
…
}
for Fragment
class MyFragment : Fragment(), FragmentViewBinding<MyFragmentBinding> by FragmentBinding() {
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?): View =
inflate(
inflate = { MyFragmentBinding.inflate(inflater, container, false) },
/* option: */onClear = { it.onClear() },
) {
// init binding, views and states here
}
// Optional: perform clear binding
private fun MyFragmentBinding.onClear() {
…
}
…
}
Provides some Android Databinding
extensions
dependencies {
implementation 'cn.alvince.zanpakuto:databinding:0.1-SNAPSHOT'
implementation 'cn.alvince.zanpakuto:view:0.1-SNAPSHOT'
}
Provides some RxJava
2 based components and extensions
dependencies {
implementation 'cn.alvince.zanpakuto:core:1.0.0' // required
implementation 'cn.alvince.zanpakuto:lifecycle:1.0.0' // required
implementation 'cn.alvince.zanpakuto:rxjava2:1.0.0-SNAPSHOT'
}
Under Apache 2.0