Skip to content

nyssance/genos

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

Genos

Release

πŸ‘Š Genos makes it very easy to build better mobile apps more quickly and with less code. For more information please see the website.


Installation

root build.gradle

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url 'https://jitpack.io' }
    }
}
implementation 'com.nyssance.genos:genos:2.0.2'

root build.gradle.kts

allprojects {
    repositories {
        google()
        mavenCentral()
        maven { url = uri("https://jitpack.io") }
    }
}
dependencies {
    implementation("com.nyssance.genos:genos:2.0.2")
}

Features

Genos integrate google architecture. just use. if your need learn more info about how genos work, and mvvm, repository , viewmodel etc., see link

1.Rules

2.How to use

Create a list fragment, override three methods, 15 lines code, that's all you need to do.

import genos.ui.fragment.generic.List
import genos.ui.viewholder.Holder

class UserList : List<User, Holder>() {
    override fun onCreate() {
        call = API.userList(page) // A retrofit call of this fragment.
    }

    override fun onDisplayItem(item: User, viewHolder: Holder, viewType: Int) {
        with(viewHoloder) {
            icon?.setImage(item.avatarUrl)
            title?.text = item.username
        }
    }

    override fun onOpenItem(item: User) {
        // StartActivity or do anything when click item.
    }
}

class UserListActivity : AppBarActivity() {
    override fun onCreateFragment() = UserList()
}

Create a bottom navigation with four buttons, 10 lines.

// If you need a drawer navigation, use `MainActivity : DrawerActivity`
class MainActivity : TabBarActivity(mapOf(
        R.id.navigation_1 to UserList(),
        R.id.navigation_2 to PlaceholderFragment.instance("2"),
        R.id.navigation_3 to PlaceholderFragment.instance("3"),
        R.id.navigation_4 to PlaceholderFragment.instance("4")
)) {
    override fun onCreate(savedInstanceState: Bundle?) {
        super.onCreate(savedInstanceState)
        with(Global) { // Config
            APP_SCHEME = "genos-sample"
        }
        router() // Set router
    }
}

Tutorial

Develop an app in 10 minutes.

Architecture

genos
β”œβ”€β”€ Global.kt                               Global config.
β”œβ”€β”€ Helper.kt
β”œβ”€β”€ extension
β”‚         β”œβ”€β”€ Fragment+Extension.kt
β”‚         β”œβ”€β”€ ImageView+Extension.kt
β”‚         └── String+Extension.kt
β”œβ”€β”€ model
β”‚         β”œβ”€β”€ BaseItem.kt
β”‚         └── Item.kt
β”œβ”€β”€ repository
β”‚         β”œβ”€β”€ HttpRepository.kt                   Default http repository.
β”‚         β”œβ”€β”€ HttpUtil.kt
β”‚         β”œβ”€β”€ IRepository.kt
β”‚         β”œβ”€β”€ NetworkState.kt
β”‚         └── Status.kt
β”œβ”€β”€ ui
β”‚         β”œβ”€β”€ BaseAdapter.kt                      Default Adapter for list fragment.
β”‚         β”œβ”€β”€ BaseViewModel.kt                    Default ViewModel for list and detail fragment.
β”‚         β”œβ”€β”€ activity
β”‚         β”‚         β”œβ”€β”€ AppBarActivity.kt               Activity with an app bar.
β”‚         β”‚         β”œβ”€β”€ CollapsingActivity.kt           Activity with a collapsing app bar.
β”‚         β”‚         β”œβ”€β”€ DrawerActivity.kt               Activity with drawer.
β”‚         β”‚         β”œβ”€β”€ TabBarActivity.kt               Activity with bottom navigation.
β”‚         β”‚         β”œβ”€β”€ WebActivity.kt
β”‚         β”‚         β”œβ”€β”€ base                            Design your activity by extends activity in base.
β”‚         β”‚         β”‚      β”œβ”€β”€ BaseActivity.kt
β”‚         β”‚         β”‚      β”œβ”€β”€ ContainerActivity.kt
β”‚         β”‚         β”‚      └── NavigationActivity.kt
β”‚         β”œβ”€β”€ fragment
β”‚         β”‚         β”œβ”€β”€ ActionSheet.kt
β”‚         β”‚         β”œβ”€β”€ Dialog.kt
β”‚         β”‚         β”œβ”€β”€ PlaceholderFragment.kt
β”‚         β”‚         β”œβ”€β”€ ViewPagerFragment.kt            Fragment with a view pager.
β”‚         β”‚         β”œβ”€β”€ base                            Design your fragment by extends fragment in base.
β”‚         β”‚         β”‚         β”œβ”€β”€ BaseFragment.kt
β”‚         β”‚         β”‚         β”œβ”€β”€ ListFragment.kt
β”‚         β”‚         β”‚         β”œβ”€β”€ LoaderFragment.kt
β”‚         β”‚         β”‚         β”œβ”€β”€ ObjectFragment.kt
β”‚         β”‚         β”‚         └── RecyclerViewFragment.kt
β”‚         β”‚         └── generic
β”‚         β”‚             β”œβ”€β”€ Detail.kt                   Fragment for detail.
β”‚         β”‚             β”œβ”€β”€ GridViewList.kt             Fragment with a grid layout, user for grid list.
β”‚         β”‚             β”œβ”€β”€ List.kt                     Fragment with a linear layout, use for stand list, one item per line.
β”‚         β”‚             β”œβ”€β”€ StaggeredGridViewList.kt    Fragment with a staggered grid layout, use for waterfall list.
β”‚         β”‚             └── TableViewDetail.kt
β”‚         └── viewholder
β”‚             β”œβ”€β”€ BaseHolder.kt                   Base holder.
β”‚             └── Holder.kt                       A holder with icon, title, subtitle, accessory.
└── vendor
          └── Retrofit.kt

Syntactic sugar

ifBlank, orEmpty

Vendor

License

Genos is released under the GPLv3 license. See LICENSE for details.