GithubHelp home page GithubHelp logo

netherdrake's Introduction

Netherdrake

Download

Ah yes. The utility hero that can carry, gank and support.

Anyway, this is a VIPER architecture library for Android that's easy to implement (maybe) and very manageable. This is a modularized style architecture, where one V must have its own IPER inside a package.

Now, each of us have a preferred style for implementing this architecture. Well, sorry to disappoint you but I like this style. If you don't like this, then go find other library that suits your style. I'm not Santa Claus. But, if you like this style, then proceed.

Installation

Easy peasy. Lemon squeezy.

implementation 'com.wynsel.netherdrake:netherdrake:0.0.2'

Usage

First, you need to create a package that defines the feature you want to implement in this view. This can be main, add something, show something. It's up to you. Right-click your packaging id, then New -> Package

Create three classes inside your newly created package. The names must relate to the package name, then add Presenter/Interactor suffixes.

e.g.

  • AddPersonActivity
  • AddPersonPresenter
  • AddPersonInteractor

Now, Extend 'em all.

View

// Activity
class AddPersonActivity: NetherActivity<AddPersonPresenter>() {

    override val getLayout: Int = R.layout.activity_add_person
    override val initializePresenter: AddPersonPresenter = AddPersonPresenter(this)

    override fun onViewReady() {

    }

    /*
    	Add modules below here!
    */
}
// Fragment
class AddPersonFragment: NetherFragment<AddPersonPresenter>() {

    override val getLayout: Int = R.layout.fragment_add_person
    override val initializePresenter: AddPersonPresenter = AddPersonPresenter(this)

    override fun beforeCreateView() {
        
    }

    override fun onViewReady() {
        
    }

    /*
    	Add modules below here!
    */
}
// Dialog
class AddPersonDialog: NetherDialog<AddPersonPresenter, AddPersonActivity.ViewHolder>() {

    override val getLayout: Int = R.layout.dialog_add_person
    override val initializePresenter: AddPersonPresenter = AddPersonPresenter(this)

    override val positiveButton: Buttons = Buttons("Ok", true) { d, w ->
        /*
        	Positive click
        */
    }
    override val negativeButton: Buttons? = null
    override val neutralButton: Buttons? = null
    
    override fun onCreateViewHolder(view: View): ViewHolder = ViewHolder(view)

    override fun onViewReady() {

    }

    inner class ViewHolder(v: View): NetherViewHolder(v) {
    	/*
    		Prepare forms
    	*/
    }

    /*
    	Add modules below here!
    */
}

Yeah, I know. I intentionally added view holder feature in this because of custom views.

Presenter

class AddPersonPresenter(view: AddPersonActivity): NetherPresenter<AddPersonActivity, AddPersonInteractor>(view) {

    override val initializeInteractor: AddPersonInteractor = AddPersonInteractor(this)

    // Manually set the router class to support routing.
    private val router = NetherRouter(baseActivity)

    override fun onPresenterReady() {

    }

    override fun onPresenterEnd() {

    }

    override fun afterActivitySet() {

    }

    /*
    	Add modules below here!
    */
}

The presenter can support interactor and router modules.

Interactor

class AddPersonInteractor(presenter: AddPersonPresenter): NetherInteractor<AddPersonPresenter>(presenter) {
    override fun onInteractorReady() {

    }

    /*
    	Add modules below here!
    */
}

netherdrake's People

Stargazers

Mike Lau avatar Zonily Jame avatar

Watchers

James Cloos avatar Chadwyn avatar

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.