Skip to content

Instantly share code, notes, and snippets.

@gsavvid
gsavvid / publishMavenBintray.gradle
Last active November 2, 2022 12:48 — forked from Robyer/maven-publish-helper-usage.gradle
Gradle script for publishing Android Kotlin libraries to a Bintray repository using maven-publish plugin. With dependencies (also handling transitive: false and custom exclude rules), including sources and javadoc.
/**
* Publish Android Kotlin Library Helper
*
* This Gradle script is based on https://gist.github.com/Robyer/a6578e60127418b380ca133a1291f017.
* The difference is that:
* 1. It uses Dokka for generating Kotlin Javadoc.
* 2. It uses Jfrog's plugin for publishing to Bintray. If you don't want to publish to Bintray, simply remove all the Bintray-related code.
*
* NOTE: You need to add Dokka and Bintray to your classpath for the two plugins to work.
* Update the buildscript in your project's build.gradle with the following:
@magneticflux-
magneticflux- / LiveDataUtils.kt
Last active February 3, 2023 19:08
Helpful Android-Kotlin LiveData utilities
//--------------------------------
// CHECK THE COMMENTS FOR UPDATES!
//--------------------------------
/*
* Copyright (C) 2017 Mitchell Skaggs, Keturah Gadson, Ethan Holtgrieve, Nathan Skelton, Pattonville School District
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
@harmittaa
harmittaa / .travis.yml
Last active November 22, 2020 05:38
Example .travis.yml file for Android
# Tutorial here: https://medium.com/@harmittaa/travis-ci-android-example-357f6e632fc4
language: android
sudo: required
jdk: oraclejdk8
before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
@ultraon
ultraon / build.gradle
Last active August 19, 2020 18:10
Good example of the merged Jacoco code covarage Gradle configuration
apply plugin: 'com.android.application'
apply from: "$rootDir/coverage.gradle"
//...
android {
//...
buildTypes {
//...
debug {
@ricalo
ricalo / .bashrc
Last active April 30, 2024 15:15
Use git-bash from Android Studio terminal
if [ ! -z "${IDE}" -a "${IDE}" == "AndroidStudio" ]; then
cd $OLDPWD;
fi
@mjdetullio
mjdetullio / android-sonar.gradle
Last active August 27, 2020 19:53
Configuring Android project for SonarQube
import com.android.build.gradle.AppPlugin
task consolidateJunitXml {
description 'Copies JUnit XML reports into a single directory so SonarQube can import them all'
doLast {
def dest = file("${buildDir}/allJunit")
delete dest
copy {
from "${buildDir}/test-results/debug"
into dest
@alphamu
alphamu / CreditCardEditText.java
Last active October 13, 2023 09:53
A simple EditText view for use with Credit Cards. It shows an image of the credit card on the right hand side.
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.AppCompatEditText;
import android.util.AttributeSet;
import android.util.SparseArray;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@mobilemind
mobilemind / git-tag-delete-local-and-remote.sh
Last active May 21, 2024 10:21
how to delete a git tag locally and remote
# delete local tag '12345'
git tag -d 12345
# delete remote tag '12345' (eg, GitHub version too)
git push origin :refs/tags/12345
# alternative approach
git push --delete origin tagName
git tag -d tagName
@MartinMReed
MartinMReed / icu_android.sh
Last active August 11, 2022 22:05
Compile ICU for Android NDK
#!/bin/sh
NDK_ROOT=/tools/android/android-ndk-r6b
NDK_TOOLCHAIN_BIN=$NDK_ROOT/toolchains/arm-linux-androideabi-4.4.3/prebuilt/darwin-x86/bin
SDK_ROOT=$NDK_ROOT/platforms/android-8/arch-arm
ICU_PATH=/Users/mreed/Desktop/icu
ICU_FLAGS="-I$ICU_PATH/source/common/ -I$ICU_PATH/source/tools/tzcode/"
export CPPFLAGS="--sysroot=$SDK_ROOT -D__STDC_INT64__ $ICU_FLAGS -I$SDK_ROOT/usr/include/ -I$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/include/ -I$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/libs/armeabi/include/"
export LDFLAGS="--sysroot=$SDK_ROOT -L$NDK_ROOT/sources/cxx-stl/gnu-libstdc++/libs/armeabi/"
@chadmaughan
chadmaughan / pre-commit.sh
Last active November 25, 2022 00:38
A git pre commit hook that runs the test task with the gradle wrapper
#!/bin/sh
# this hook is in SCM so that it can be shared
# to install it, create a symbolic link in the projects .git/hooks folder
#
# i.e. - from the .git/hooks directory, run
# $ ln -s ../../git-hooks/pre-commit.sh pre-commit
#
# to skip the tests, run with the --no-verify argument
# i.e. - $ 'git commit --no-verify'