Skip to content

Instantly share code, notes, and snippets.

:shipit:
Shipping it

Stefan Hoth stefanhoth

:shipit:
Shipping it
Block or report user

Report or block stefanhoth

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View setup-android-sdk.bash
SDK_HOME_PATH="$HOME"
SDK_PATH="$SDK_HOME_PATH/android-sdk-linux"
# Needs to be updated when new releases are made
SDK_DOWNLOAD_URL="http://dl.google.com/android/android-sdk_r22.6.2-linux.tgz"
curl --location $SDK_DOWNLOAD_URL | tar -xz -C $SDK_HOME_PATH
# Just install platform-tools, build-tools & Android-19
# Filter names are from `android list sdk -e -a`
@stefanhoth
stefanhoth / LICENSE
Last active Oct 24, 2015
Rock Paper Scissors Lizard Spock - Android VectorDrawable definitions based on https://commons.wikimedia.org/wiki/File:Pierre_ciseaux_feuille_l%C3%A9zard_spock_aligned.svg
View LICENSE
http://creativecommons.org/licenses/by-sa/4.0/
Creative Commons Attribution-ShareAlike 4.0 International Public License
By exercising the Licensed Rights (defined below), You accept and agree to be bound by the terms and conditions of this Creative Commons Attribution-ShareAlike 4.0 International Public License ("Public License"). To the extent this Public License may be interpreted as a contract, You are granted the Licensed Rights in consideration of Your acceptance of these terms and conditions, and the Licensor grants You such rights in consideration of benefits the Licensor receives from making the Licensed Material available under these terms and conditions.
Section 1 – Definitions.
Adapted Material means material subject to Copyright and Similar Rights that is derived from or based upon the Licensed Material and in which the Licensed Material is translated, altered, arranged, transformed, or otherwise modified in a manner requiring permission under the Copyright and Similar Rights held by the Licen
@stefanhoth
stefanhoth / GradleWorkersPleaseStopTakingFocus.gradle
Last active Aug 29, 2015 — forked from artem-zinnatullin/GradleWorkersPleaseStopTakingFocus.gradle
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
View GradleWorkersPleaseStopTakingFocus.gradle
// You can place it in the root build.gradle
allprojects {
tasks.withType(JavaForkOptions) {
// Forked processes like GradleWorkerMain for tests won't steal focus!
jvmArgs '-Djava.awt.headless=true'
}
}
@stefanhoth
stefanhoth / device_provider.gradle
Last active Aug 29, 2015 — forked from frankiesardo/device_provider.gradle
Allow gradle to only use devices that meet your criteria
View device_provider.gradle
android {
...
deviceProvider new AwesomeDeviceProvider(getAdbExe())
}
class AwesomeDeviceProvider extends com.android.builder.testing.ConnectedDeviceProvider {
AwesomeDeviceProvider(File adbLocation) {
super(adbLocation)
}
@stefanhoth
stefanhoth / RootStatus.java
Last active Aug 29, 2015
How to detect if an app is launched on a potentially rooted phone in an non-invasive way. It could be improved by checking existence of known super user apk in the package manager and certain build tags of the ROM.
View RootStatus.java
package com.yourapp;
import java.io.File;
public final class RootStatus {
private static RootStatus instance;
private final boolean rooted;
View gist:5d6fa521aad322d15d44
// The Factory
public final class VehicleFactory {
// private constructor => can't be instanciated, final can't be extended since the constructor is not reachable for a subclass
private VehicleFactory (){
// no-op
}
public static Vehicel Vehicle produceVehicle(String name, String manufacturer, int horsepowerInPS){
return new Vehicle(name, manufacturer, horsepowerInPS);
@stefanhoth
stefanhoth / tools_override.xml
Last active Aug 29, 2015
Override a views visibility at design time using the tools namespace. See line 13 how and don't forget to add line 2. See http://tools.android.com/tips/layout-designtime-attributes for details.
View tools_override.xml
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<ImageView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/group_image"
@stefanhoth
stefanhoth / build.gradle
Last active Mar 3, 2017
Simple plugin for build.gradle to instruct Jetbrains IDEA-based IDEs (IntelliJ, Android Studio) to download sources of the dependencies. More settings can be found here: http://gradle.org/docs/current/dsl/org.gradle.plugins.ide.idea.model.IdeaModule.html
View build.gradle
// your code
apply from: "build-plugins/idea-gradle-sources.gradle"
@stefanhoth
stefanhoth / jack.bat
Last active Aug 29, 2015
Jack & Jill command line helpers. Put them in a directory in your PATH, e.g. <android-sdk>/. Use .bat files for Windows, .sh for Mac/Linux. More info in the documentation: http://tools.android.com/tech-docs/jackandjill
View jack.bat
@ECHO OFF
@REM Jack is only available from build tools version 21.1.0 and up. Install/Update via SDK Manager
SET BUILD_TOOLS_VERSION=21.1.2
java -jar %ANDROID_HOME%/build-tools/%BUILD_TOOLS_VERSION%/jack.jar %1 %2 %3 %4 %5 %6 %7 %8 %9
@stefanhoth
stefanhoth / build.gradle
Created Jun 11, 2014
AndroidDev / gradle: How to rename your output apk during build time to include details like the version.
View build.gradle
android {
// .. set up build flavors etc here
//instead of "app-release.apk" this method will rewrite the name to
// "MyCoolCompany-MyGreatProduct-v<defaultConfig.versionName>-RELEASE.apk which is much better suited for archiving and overall handling
// To restore the default behavior just delete the whole block below
applicationVariants.all { variant ->
def apk = variant.outputFile;
You can’t perform that action at this time.