Initial commit of paging component.
This commit introduces a paging component to enable gradual, lazy
loading from large data sources, including Room queries.
The primary entry points are:
1) CountedDataSource, the base class for defining a countable (i.e.
fixed, known size) source of items, such as a Database query.
2) LazyList, the lazy-loading List-like component which pages content
in on a background thread from a CountedDataSource.
3) LiveLazyListProvider, the class which produces DataSources, and
presents a LiveData<LazyList<T>>.
4) LazyListAdapterHelper, which takes a LiveData<LazyList>, and
presents the data simply to an adapter. It computes differences
between versions with DiffUtil, and signalling updates to the adapter.
Currently, Room only presents a limit-offset query as an easy means to
get a LiveData of a LazyList, but it's possible to write a custom data
source to page in data from keyed (including composite-keyed) queries.
Test: new tests
Change-Id: I415879a032d83786d734c26c429828da3b8bc76a
diff --git a/paging/runtime/build.gradle b/paging/runtime/build.gradle
new file mode 100644
index 0000000..6255f83
--- /dev/null
+++ b/paging/runtime/build.gradle
@@ -0,0 +1,86 @@
+/*
+ * Copyright (C) 2017 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+import com.android.builder.core.BuilderConstants
+apply plugin: 'com.android.library'
+apply plugin: 'maven'
+
+android {
+ compileSdkVersion tools.current_sdk
+ buildToolsVersion tools.build_tools_version
+
+ defaultConfig {
+ minSdkVersion flatfoot.min_sdk
+ targetSdkVersion tools.current_sdk
+ versionCode 1
+ versionName "1.0"
+
+ testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
+ }
+
+ buildTypes.all {
+ consumerProguardFiles 'proguard-rules.pro'
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ }
+ }
+
+ testOptions {
+ unitTests.returnDefaultValues = true
+ }
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_7
+ targetCompatibility JavaVersion.VERSION_1_7
+ }
+}
+
+dependencies {
+ compile project(":arch:runtime")
+ compile project(":paging:common")
+ compile project(":lifecycle:runtime")
+ compile project(':lifecycle:extensions')
+
+ compile libs.support.recyclerview
+ testCompile libs.junit
+ androidTestCompile libs.mockito_core
+ androidTestCompile libs.dexmaker_mockito
+ testCompile libs.support.annotations
+
+ androidTestCompile libs.junit
+ androidTestCompile(libs.test_runner) {
+ exclude module: 'support-annotations'
+ }
+ androidTestCompile(libs.espresso_core, {
+ exclude group: 'com.android.support', module: 'support-annotations'
+ })
+
+}
+
+archivesBaseName = "runtime"
+
+createAndroidCheckstyle(project)
+
+android.libraryVariants.all { variant ->
+ def name = variant.buildType.name
+ def suffix = name.capitalize()
+ project.tasks.create(name: "jar${suffix}", type: Jar){
+ dependsOn variant.javaCompile
+ from variant.javaCompile.destinationDir
+ destinationDir new File(project.buildDir, "libJar")
+ }
+}