Skip to content

Instantly share code, notes, and snippets.

View passiondroid's full-sized avatar
🏠
Working from home

Arif Khan passiondroid

🏠
Working from home
View GitHub Profile
plugins {
id(BuildPlugins.androidApplication)
id(BuildPlugins.kotlinAndroid)
id(BuildPlugins.kotlinAndroidExtensions)
}
android {
compileSdkVersion(AndroidSdk.compile)
defaultConfig {
applicationId = "com.gradle.kotlindsl"
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
google()
jcenter()
}
dependencies {
classpath (BuildPlugins.androidGradlePlugin)
const val kotlinVersion = "1.3.21"
object BuildPlugins {
object Versions {
const val buildToolsVersion = "3.3.1"
}
const val androidGradlePlugin = "com.android.tools.build:gradle:${Versions.buildToolsVersion}"
const val kotlinGradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
repositories {
jcenter()
}
plugins {
`kotlin-dsl`
}
kotlinDslPluginOptions {
experimentalWarning.set(false)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
apply from: 'dependencies.gradle'
repositories {
google()
jcenter()
}
dependencies {
ext {
minSdkVersionAndroid = 15
targetSdkVersionAndroid = 28
compileSdkVersionAndroid = 28
buildToolsVersion = '3.3.1'
jetpackVersion = '1.0.0-beta01'
constraintLayoutVersion = '1.1.2'
kotlinVersion = '1.3.21'
espressoVersion = '3.1.0-alpha4'
@passiondroid
passiondroid / ListAdapterActivity.kt
Last active July 30, 2018 17:07
Sample Activity showing the use of ListAdapter
class MainActivity : AppCompatActivity() {
private val adapter = SampleListAdapter()
private var list: ArrayList<Item>? = null
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
recyclerview.layoutManager = LinearLayoutManager(this, LinearLayoutManager.VERTICAL, false)
#if (${PACKAGE_NAME} && ${PACKAGE_NAME} != "")package ${PACKAGE_NAME}#end
import android.support.v7.recyclerview.extensions.ListAdapter
import android.support.v7.util.DiffUtil
import android.support.v7.widget.RecyclerView
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
class ${NAME} : ListAdapter<${Model_Class}, ${NAME}.ItemViewholder>(DiffCallback()) {
android {
defaultConfig {
}
signingConfigs {
release {
val signing = project.rootProject.properties("signing.properties")
if (signing != null) {
public interface MoviesService {
@GET("v2/movies/trending")
Call<List<Movie>> getMovies();
@GET("v2/movies/{movieId}/casts")
Call<List<Cast>> getCasts(@Path(movieId) String movieId);
}