Created
May 14, 2019 05:17
-
-
Save cdsap/2cf5e59da45db2f7cb6f9b6e0228f2e3 to your computer and use it in GitHub Desktop.
conf
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
allprojects { | |
// Libraries scope | |
repositories { | |
google() | |
jcenter() | |
} | |
} | |
buildscript { | |
repositories { | |
jcenter() | |
google() | |
mavenCentral( | |
) | |
maven { | |
url = uri("https://plugins.gradle.org/m2/") | |
} | |
} | |
dependencies { | |
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.3.31") | |
classpath("com.android.tools.build:gradle:3.2.1") | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* You should keep maximum build logic in buildSrc | |
* | |
* https://docs.gradle.org/current/userguide/organizing_gradle_projects.html#sec:build_sources | |
* | |
*/ | |
plugins { | |
`kotlin-dsl` // To use some groovy to kotlin utilities | |
groovy | |
id("java-gradle-plugin") // To facilitate the register of the custom plugins https://docs.gradle.org/current/userguide/java_gradle_plugin.html | |
} | |
/** | |
* This block allow the declaration of the custom plugin. | |
* The id is the name to use in the plugins container to apply this plugin sample: | |
* | |
* plugins { | |
* id("com.android.application") | |
* } | |
* | |
* https://docs.gradle.org/current/userguide/java_gradle_plugin.html | |
*/ | |
/*gradlePlugin { | |
// Define the id of the custom Plugins which will be use in build.gradle (id("app-android")) | |
plugins { | |
create("cardioskin-android") { | |
id = "app-android" | |
implementationClass = "sample.AndroidPlugin" | |
} | |
} | |
}*/ | |
repositories { | |
// gradle plugins scope | |
google() | |
jcenter() | |
} | |
buildscript { | |
repositories { | |
jcenter() | |
mavenCentral() | |
google() | |
} | |
dependencies { | |
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.61") | |
} | |
} | |
allprojects { | |
// Libraries scope | |
repositories { | |
google() | |
jcenter() | |
} | |
} | |
configurations.all { | |
resolutionStrategy.cacheChangingModulesFor(0, "seconds") | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import timoptr.multiselectablelist.Libs | |
plugins { | |
id("com.android.application") | |
id("kotlin-android") | |
id("kotlin-android-extensions") | |
id("kotlin-kapt") | |
} | |
android { | |
compileSdkVersion(28) | |
defaultConfig { | |
applicationId = "timoptr.githubexplorer" | |
minSdkVersion(21) | |
targetSdkVersion(28) | |
versionCode = 1 | |
versionName = "1.0" | |
} | |
buildTypes { | |
getByName("release") { | |
isMinifyEnabled = false | |
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro") | |
} | |
} | |
dataBinding { | |
isEnabled = true | |
} | |
} | |
dependencies { | |
implementation("org.jetbrains.kotlin:kotlin-stdlib:1.3.31") | |
implementation(Libs.designLib) | |
implementation(Libs.supportV4) | |
implementation(Libs.appCompatLib) | |
implementation(Libs.constraintLayout) | |
implementation(Libs.pagingLib) | |
implementation(Libs.lifecycleRuntime) | |
implementation(Libs.lifecycleExtension) | |
implementation(project(":multiselectablerecyclerview")) | |
implementation(Libs.rxJava) | |
implementation(Libs.rxAndroid) | |
implementation(Libs.rxKotlin) | |
implementation(Libs.rxLint) | |
implementation(Libs.retrofitRxAdapter) | |
implementation(Libs.retrofit) | |
implementation(Libs.gson) | |
implementation(Libs.gsonConverter) | |
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.2.1") | |
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.2.1") | |
implementation(Libs.leakCanary) | |
add("androidTestImplementation", Libs.testRunner) | |
add("androidTestImplementation", Libs.testExtJunit) { | |
exclude(module = "junit") // bug in beta01 where junit dependencies isn't resolve well | |
} | |
add("androidTestImplementation", Libs.espressoCore) | |
add("androidTestImplementation", Libs.testRules) | |
testImplementation(Libs.jUnit) | |
testImplementation(Libs.kotlinTest) | |
testImplementation(Libs.kotlinTestJunit) | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package timoptr.multiselectablelist.sample | |
import android.os.Bundle | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.lifecycle.Observer | |
import androidx.lifecycle.ViewModelProviders | |
import androidx.recyclerview.widget.DividerItemDecoration | |
import androidx.recyclerview.widget.LinearLayoutManager | |
import io.reactivex.disposables.CompositeDisposable | |
import kotlinx.android.synthetic.main.activity_demo.* | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.SupervisorJob | |
import timoptr.multiselectablelist.adapter.SelectableAdapter | |
import timoptr.multiselectablelist.sample.adapter.GithubAdapter | |
import timoptr.multiselectablelist.sample.repository.GithubRepositoryOverAPI | |
import timoptr.multiselectablelist.sample.viewmodel.DemoViewModel | |
import kotlin.coroutines.CoroutineContext | |
/** | |
* @author Nibeaudeau Timothy <[email protected]> | |
* @version 1.0 | |
* on 03/12/2017 for MultiSelectableRecycleListView with IntelliJ IDEA. | |
*/ | |
class DemoActivity : AppCompatActivity(), CoroutineScope { | |
private lateinit var viewModel: DemoViewModel | |
private val subscriber = CompositeDisposable() | |
override val coroutineContext: CoroutineContext | |
get() = Dispatchers.Main + job | |
private val job = SupervisorJob() | |
override fun onCreate(savedInstanceState: Bundle?) { | |
super.onCreate(savedInstanceState) | |
setContentView(R.layout.activity_demo) | |
viewModel = ViewModelProviders.of(this, DemoViewModel.Factory(GithubRepositoryOverAPI(subscriber))).get(DemoViewModel::class.java) | |
initListMulti() | |
} | |
override fun onDestroy() { | |
super.onDestroy() | |
subscriber.clear() | |
} | |
private fun initListMulti() { | |
val adapter = GithubAdapter(SelectableAdapter.Selection.MULTIPLE) | |
listMulti.adapter = adapter | |
listMulti.layoutManager = LinearLayoutManager(this) | |
listMulti.addItemDecoration(DividerItemDecoration(this, DividerItemDecoration.VERTICAL)) | |
viewModel.repositories.observe(this, Observer { | |
adapter.submitList(it) | |
}) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment