Skip to content

How to use Kotlinyan?

燒餅 edited this page Jun 1, 2017 · 2 revisions

Kotlinyan Library contains two modules now. There will be more functions and modules in the futrue.

According to your requirement, introduce these modules to your project.

  • library-common : Android Common Functions & Extensions
  • library-picasso-support : Picasso Extensions. Provide a easy way to lazy load images into ImageView.
  • library-recyclerview-support : RecyclerView Extensions. Provide OnLoadMoreListener

First, add it in your root build.gradle at the end of repositories:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

Add the dependency (according to your requirement):

dependencies {
    compile 'moe.feng.kotlinyan:kotlinyan-common:latest-version'
    compile 'moe.feng.kotlinyan:kotlinyan-picasso-support:latest-version'
}

Implement extensions to your classes:

class MainActivity: AppCompatActivity(), AndroidExtensions, ... {
    ...
}

目前 Kotlinyan 库由两个模块组成,未来会添加更多的模块、功能,可根据自身需求选择引入到自己的开发项目中。

  • library-common : Android 常用方法扩展
  • library-picasso-support : Picasso 扩展,为 ImageView 提供更加简单的 Lazy Load 方法
  • library-recyclerview-support : RecyclerView 扩展,提供了一个 onLoadMore 事件监听

导入时,先在项目根目录下的 build.gradle 加入下列代码:

allprojects {
	repositories {
		...
		maven { url 'https://jitpack.io' }
	}
}

再在应用 Module 的 build.gradle 中按需声明要依赖的模块:

dependencies {
    compile 'moe.feng.kotlinyan:kotlinyan-common:latest-version'
    compile 'moe.feng.kotlinyan:kotlinyan-picasso-support:latest-version'
}

在你的 Class 中声明 Extensions 的引用:

class MainActivity: AppCompatActivity(), AndroidExtensions, ... {
    ...
}
Clone this wiki locally