Skip to content

Instantly share code, notes, and snippets.

View almozavr's full-sized avatar

Oleksii Malovanyi almozavr

  • Lviv, UA
View GitHub Profile
@almozavr
almozavr / app_build.gradle
Created June 26, 2014 08:13
Workaround to bypass library's BuildConfig.DEBUG (always true, always release build type) via custom variable
// Application
apply plugin: 'android'
repositories {
mavenCentral()
}
android {
compileSdkVersion rootProject.ext.compileSdkVersion
buildToolsVersion rootProject.ext.buildToolsVersion
@almozavr
almozavr / ObjectGsonParceler.java
Last active September 30, 2020 16:53
Parcelable helper to wrap object convertable with gson
public class ObjectGsonParceler {
private final Gson gson;
public ObjectGsonParceler(Gson gson) {
this.gson = gson;
}
public Parcelable wrap(Object instance) {
try {
String json = encode(instance);
@almozavr
almozavr / jacoco.gradle
Last active January 5, 2021 12:37
Gradle Jacoco config for Android (3.x plugin) with kotlin and custom excludes support
apply plugin: "jacoco"
jacoco {
toolVersion = deps.test.jacocoVersion
}
tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
}
@almozavr
almozavr / DelegatingPagingSource.Kt
Created October 8, 2021 13:26
Link ContainerHost intent capabilities with the Paging library
package com.example.paging
import androidx.paging.PagingSource
import androidx.paging.PagingState
import org.orbitmvi.orbit.ContainerHost
import org.orbitmvi.orbit.syntax.simple.SimpleSyntax
import org.orbitmvi.orbit.syntax.simple.intent
import kotlin.coroutines.resume
import kotlin.coroutines.resumeWithException
import kotlin.coroutines.suspendCoroutine
@almozavr
almozavr / FixedSwitchPreference.java
Last active November 28, 2022 15:46
FixedSwitchPreference
public class FixedSwitchPreference extends SwitchPreference {
/**
* Construct a new SwitchPreference with the given style options.
*
* @param context The Context that will style this preference
* @param attrs Style attributes that differ from the default
* @param defStyle Theme attribute defining the default style options
*/
public FixedSwitchPreference(Context context, AttributeSet attrs, int defStyle) {