This file contains 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
class RegisterViewModel( | |
naviComponent: NaviComponent | |
) : ViewModel by ViewModelImpl(naviComponent) { | |
val name = ObservableString("") | |
val email = ObservableString("") | |
val password = ObservableString("") | |
var location: LocationModel? = null | |
val locationName = ObservableString("") | |
This file contains 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
/ideate | |
"location": { | |
"longitude": 106.808536, | |
"latitude": -6.213988999999999, | |
"title": "JCC Senayan", | |
"address": "RT.1/RW.3, Gelora, Tanah Abang, Kota Jakarta Pusat, Daerah Khusus Ibukota Jakarta 10270, Indonesia", | |
"place_id": "ChIJLdsYtq32aS4RqOzRPJVoE14" | |
} | |
/project |
This file contains 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
/** | |
* Single value repository that don't accept null as value | |
*/ | |
interface SingleValueRepo<Value : Any> { | |
/** | |
* Saves [value] on given [io.reactivex.Scheduler] | |
*/ | |
fun save(value: Value): Single<Value> | |
/** |
This file contains 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
fun copy(fd: FileDescriptor, file: File) { | |
Okio.source(FileInputStream(fd)).use { source -> | |
Okio.buffer(Okio.sink(file)).use { buffer -> buffer.writeAll(source) } | |
} | |
} |
This file contains 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 com.ninetyseconds.auckland.core.glide | |
import android.content.Context | |
import android.graphics.Bitmap | |
import android.media.MediaMetadataRetriever | |
import com.bumptech.glide.Glide | |
import com.bumptech.glide.GlideBuilder | |
import com.bumptech.glide.Priority | |
import com.bumptech.glide.load.data.DataFetcher | |
import com.bumptech.glide.load.model.GenericLoaderFactory |
This file contains 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
interface UploadApi { | |
@PUT fun uploadFile(@Url url: String, @Body file: RequestBody): Observable<Response<Any>> | |
} |
This file contains 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
fun requestBody(fd: FileDescriptor) = object : RequestBody() { | |
override fun contentType(): MediaType = MediaType.parse("multipart/form-data") | |
override fun writeTo(sink: BufferedSink) { | |
Okio.source(FileInputStream(fd)).use { source -> | |
sink.writeAll(source) | |
} | |
} | |
} |
This file contains 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 java.util.NoSuchElementException | |
sealed class Optional<T : Any>(private val value: T?) { | |
constructor() : this(null) | |
fun get(): T { | |
value ?: throw NoSuchElementException("No value present") | |
return value | |
} |
This file contains 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 android.animation.TypeEvaluator; | |
import android.animation.ValueAnimator; | |
import static java.lang.Math.pow; | |
public class GammaEvaluator implements TypeEvaluator { | |
private static final GammaEvaluator sInstance = new GammaEvaluator(); | |
/** |
This file contains 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 com.ninetyseconds.auckland.core.databindings | |
import android.databinding.* | |
import android.databinding.Observable.OnPropertyChangedCallback | |
import android.os.Parcelable | |
import io.reactivex.Observable | |
import io.reactivex.Observable.create | |
import org.funktionale.option.toOption | |
import java.lang.Math.max | |
import java.lang.Math.min |