Skip to content

Instantly share code, notes, and snippets.

View GuilhE's full-sized avatar

Guilherme Delgado GuilhE

View GitHub Profile
@GuilhE
GuilhE / bitbucket-pipelines.yml
Last active July 7, 2022 21:27
Bitbucket pipeline for Android Firebase App Distribution
image: bitbucketpipelines/android-ci-image
pipelines:
tags:
firebase-*:
- step:
name: Setup & Deploy
image: java:8 #remove this line if plugin "com.starter.easylauncher" isn't used
caches:
- android-sdk
@GuilhE
GuilhE / build.gradle.kts
Last active February 18, 2022 09:48
Gradle configurations to be used with bitbucket-pipelines.yml or firebaseLocalDistribution.sh
import com.android.build.gradle.internal.dsl.SigningConfig
import java.io.FileInputStream
import java.util.*
signingConfigs {
if (File("signing.properties").exists()) {
create("releaseDistribution") {
val prop = Properties().apply { load(FileInputStream(File("signing.properties"))) }
storeFile = File(prop.getProperty("keystorePath"))
storePassword = prop.getProperty("keystorePassword")
@GuilhE
GuilhE / firebaseLocalDistribution.sh
Last active April 8, 2021 17:10
Firebase App Distribution (locally)
#!/bin/bash
BOLD=$(tput bold)
NORMAL=$(tput sgr0)
PROPERTY_FILE=local.properties
function getProperty() {
PROP_KEY=$1
# shellcheck disable=SC2002
PROP_VALUE=$(cat $PROPERTY_FILE | grep -w "$PROP_KEY" | cut -d'=' -f2-)
echo "$PROP_VALUE"
@GuilhE
GuilhE / deploy-bintray.gradle.kts
Created February 5, 2021 12:18
Gradle configurations to deploy both to Bintray and Maven
import com.jfrog.bintray.gradle.BintrayExtension
import com.jfrog.bintray.gradle.BintrayPlugin
import java.io.FileInputStream
import java.util.*
buildscript {
repositories {
jcenter()
}
@GuilhE
GuilhE / travis.yml
Last active May 3, 2020 17:15
Travis CI for testing with emulator and update jacocoTestReport to codecov
language: android
dist: trusty
notifications:
email: false
jdk:
- oraclejdk8
env:
@GuilhE
GuilhE / EndlessRecyclerOnScrollListener.kt
Last active March 21, 2020 21:30
Helper listener class to implement pagination
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
@Suppress("unused")
abstract class EndlessRecyclerOnScrollListener(
manager: LinearLayoutManager
) : RecyclerView.OnScrollListener() {
private var layoutManager: LinearLayoutManager = manager
@GuilhE
GuilhE / OperatorExtensions.kt
Last active March 21, 2020 21:30
Extension class to convert ReactiveX operators into Coroutines
import kotlinx.coroutines.*
fun throttleClick(scope: CoroutineScope = CoroutineScope(Dispatchers.Main), clickAction: (Unit) -> Unit): (Unit) -> Unit {
return throttleFirst(1_000, scope, clickAction)
}
/**
* Processes input data and passes the first data to [action] and skips all new data for the next [skipMs].
*/
fun <T> throttleFirst(skipMs: Long = 700L, scope: CoroutineScope = CoroutineScope(Dispatchers.Main), action: (T) -> Unit): (T) -> Unit {
@GuilhE
GuilhE / RxExtensions.kt
Created March 4, 2020 00:43
Helper compose functions for RxKotlin
import android.annotation.SuppressLint
import com.blissapplications.kotlin.core.common.threads.ReactivexThreadSchedulerProvider
import io.reactivex.Completable
import io.reactivex.Single
import io.reactivex.disposables.CompositeDisposable
import io.reactivex.disposables.Disposable
/**
* Examples of usage of this extensions functions:
*
@GuilhE
GuilhE / OperatorExtensionsTest.kt
Last active February 19, 2020 11:28
OperatorExtensions tests with MockK
import io.mockk.clearAllMocks
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.ExperimentalCoroutinesApi
import kotlinx.coroutines.delay
import kotlinx.coroutines.test.TestCoroutineDispatcher
import kotlinx.coroutines.test.resetMain
import kotlinx.coroutines.test.runBlockingTest
import kotlinx.coroutines.test.setMain
import org.assertj.core.api.Assertions.assertThat
import org.junit.jupiter.api.*
@GuilhE
GuilhE / build.gradle
Last active January 21, 2020 11:01
Project gradle settings (using dcendents.android-maven)
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
ext.kotlin_version = '1.3.61'
repositories {
google()
jcenter()
}
dependencies {