Giter Club home page Giter Club logo

android-zanpakuto's Introduction

Android zanpakuto kit

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/'
    }
}

Core

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
}

Animation

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

Lifecycle

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'
}

View

Provides some Android View extensions

Viewbinding

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() {
         …
    }

    …
}

Databinding

Provides some Android Databinding extensions

dependencies {
    implementation 'cn.alvince.zanpakuto:databinding:0.1-SNAPSHOT'
    implementation 'cn.alvince.zanpakuto:view:0.1-SNAPSHOT'
}

Rxjava2

Provides some RxJava2 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'
}

License

Under Apache 2.0

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.