Skip to content

Instantly share code, notes, and snippets.

View hameno's full-sized avatar

Philip Porto Schiffer hameno

View GitHub Profile
@hameno
hameno / Bug.kt
Last active June 10, 2017 23:37
Bug with Kotlin + Moshi
import com.squareup.moshi.Json
import com.squareup.moshi.KotlinJsonAdapterFactory
import com.squareup.moshi.Moshi
import org.junit.Test
data class DataClass(
@Json(name = "par1") val par1: String?,
@Json(name = "par2") val par2: String?,
@Json(name = "par3") val par3: String?,
@Json(name = "par4") val par4: String?,
@hameno
hameno / DatabaseMigration.java
Created July 26, 2019 10:30 — forked from ChristophKaser/DatabaseMigration.java
Room Database Migration Utility
package cc.gunz.mobilecatalog.database.base;
import android.database.Cursor;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.HashMap;
import java.util.HashSet;
import java.util.LinkedHashMap;
@hameno
hameno / publishMavenLocal.gradle
Last active November 26, 2019 13:54 — forked from Robyer/maven-publish-helper-usage.gradle
Gradle script for publishing Android library to local Maven repository using maven-publish plugin. With dependencies (also handling transitive: false and custom exclude rules), including sources and javadoc.
apply plugin: 'maven-publish'
project.afterEvaluate {
def androidExtension = project.extensions.findByName("android")
if (androidExtension.hasProperty('libraryVariants')) {
androidExtension.libraryVariants.all { final variant ->
task("${variant.name}Javadoc", type: Javadoc) {
description "Generates Javadoc for ${variant.name}."
failOnError = false
source = variant.javaCompile.source
@hameno
hameno / ExtendedFileProvider
Last active January 12, 2022 10:47
"Enhanced" FileProvider with support for external secondary paths (based on 27.0.2)
/*
* Copyright (C) 2013 The Android Open Source Project
*
* 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