Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@
build/
.DS_Store
*.iml
/sample/keys/
/sample/properties/
20 changes: 14 additions & 6 deletions android-reactive-location/build.gradle
Original file line number Diff line number Diff line change
@@ -1,27 +1,35 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
apply plugin: 'maven'

android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion

defaultConfig {
minSdkVersion 14
minSdkVersion 16
targetSdkVersion rootProject.ext.targetSdkVersion
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}

//TODO: local maven deployment

dependencies {
compile 'com.google.android.gms:play-services-location:11.0.4'
compile 'com.google.android.gms:play-services-places:11.0.4'
compile 'io.reactivex.rxjava2:rxjava:2.0.5'
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "androidx.core:core-ktx:1.3.2"

implementation ('com.google.android.gms:play-services-location:17.1.0'){
exclude group: 'com.google.android.gms', module: 'play-services-places'
}
implementation 'com.google.android.libraries.places:places:2.4.0'
implementation 'io.reactivex.rxjava2:rxjava:2.2.20'
implementation 'io.reactivex.rxjava2:rxandroid:2.1.1'
}

// Comment this to deploy to local maven repository
Expand Down
5 changes: 1 addition & 4 deletions android-reactive-location/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="pl.charmas.android.reactivelocation2">

<application></application>
</manifest>
<manifest package="pl.charmas.android.reactivelocation2"/>

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
package pl.charmas.android.reactivelocation2

import com.google.android.gms.common.data.DataBuffer
import io.reactivex.Observable
import io.reactivex.ObservableEmitter
import io.reactivex.disposables.Disposables

/**
* Util class that creates observable from buffer.
*/
object DataBufferObservable {
/**
* Creates observable from buffer. On unsubscribe buffer is automatically released.
*
* @param buffer source buffer
* @param <T> item type
* @return observable that emits all items from buffer and on unsubscription releases it
</T> */
fun <T> from(buffer: DataBuffer<T>): Observable<T> {
return Observable.create { emitter ->
emitter.setDisposable(Disposables.fromAction { buffer.release() })
for (item in buffer) {
if (!emitter.isDisposed) {
if (item != null) {
emitter.onNext(item)
}
}
}
if (!emitter.isDisposed) {
emitter.onComplete()
}
}
}
}
Loading