Pager

Pager is a replacement for Cursor to provide paged access to a collection of data across process.

License

License

GroupId

GroupId

com.josesamuel
ArtifactId

ArtifactId

pager
Last Version

Last Version

1.0.4
Release Date

Release Date

Type

Type

aar
Description

Description

Pager
Pager is a replacement for Cursor to provide paged access to a collection of data across process.
Project URL

Project URL

https://github.com/josesamuel/pager/
Source Code Management

Source Code Management

https://github.com/josesamuel/pager/

Download pager

How to add to project

<!-- https://jarcasting.com/artifacts/com.josesamuel/pager/ -->
<dependency>
    <groupId>com.josesamuel</groupId>
    <artifactId>pager</artifactId>
    <version>1.0.4</version>
    <type>aar</type>
</dependency>
// https://jarcasting.com/artifacts/com.josesamuel/pager/
implementation 'com.josesamuel:pager:1.0.4'
// https://jarcasting.com/artifacts/com.josesamuel/pager/
implementation ("com.josesamuel:pager:1.0.4")
'com.josesamuel:pager:aar:1.0.4'
<dependency org="com.josesamuel" name="pager" rev="1.0.4">
  <artifact name="pager" type="aar" />
</dependency>
@Grapes(
@Grab(group='com.josesamuel', module='pager', version='1.0.4')
)
libraryDependencies += "com.josesamuel" % "pager" % "1.0.4"
[com.josesamuel/pager "1.0.4"]

Dependencies

compile (4)

Group / Artifact Type Version
com.android.support » support-annotations jar 27.0.2
com.josesamuel : parceler-api jar 1.0.0
com.josesamuel : remoter-annotations jar 1.1.5
org.jetbrains.kotlin : kotlin-stdlib-jre7 jar 1.2.41

Project Modules

There are no modules declared in this project.

Pager

Pager - An alternative to Cursor, providing paged access to a collection of data, which can be shared across a process.

Just like a Cursor, if Pager is shared across process through Binder (AIDL or Remoter), only a window of the original data is actually transferred acrossed the binder and rest is fetched as needed when they are accessed.

Why Pager

  • Unlike Cursor which represents a database row and only allows primitive access to each columns, Pager allows you to pass the actual object.
//----------------------------------
//Using Cursor will be something like this

Cursor cursor = getCursor();

//Traverse each row
if (cursor.moveToFirst()) {
	do{
		//primitive access to each coloumn 
		String name = cursor.getString(firstColumn);
		int age = cursor.getInt(secondColumn);
		
		//create your object from each column read
		Employee employee = new Employee(name, age)
		
		//do something with employee
	} while (cursor.moveToNext())
}

//----------------------------------

//Using Pager

Pager<Employee> employees = getEmployeePager(); //Local or Remoter service call
for(Employee employee: employees){
	//do something with employee
}
  • Pager allows you to notify the clients that a given data is replaced with another data. The change gets automatically refreshed at client.
  • Add or remove data at the source, or change the whole data source, which gets automatically refreshed at client.
    • No need of ContentObserver or requery.
    • The original Pager automatically reflect the updated data
  • Pass Pager across process using Remoter
@Remoter
public interface ISampleService {
    Pager<Employee> getEmployeePager();
}

Getting Pager

Gradle dependency

dependencies {
    implementation 'com.josesamuel:pager:1.0.4'
}

License

Copyright 2018 Joseph Samuel

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.

Versions

Version
1.0.4
1.0.3
1.0.2
1.0.1
1.0.0