Skip to content

Instantly share code, notes, and snippets.

View johnjohndoe's full-sized avatar

Tobias Preuss johnjohndoe

View GitHub Profile
@chanakin
chanakin / MultiObjectAdapterRecyclerViewAdapter
Created August 26, 2015 19:27
This adapter wraps multiple adapters with different object types for use with a recyclerview.
import android.support.v7.widget.RecyclerView;
import android.util.SparseArray;
import android.view.ViewGroup;
/**
* Created by Chantell Osejo on 8/7/15.
* This adapter wraps multiple adapters with different object types for use with a recyclerview.
* Copyright (C) 2015 Chantell Osejo
*
* This program is free software: you can redistribute it and/or modify
[
{
"conference": "32C3",
"group": "Lecture Rooms",
"rooms": [
{
"slug": "hall1",
"schedulename": "Hall 1",
"thumb": "https://streaming.media.ccc.de/32c3/../thumbs/s1.png",
"link": "https://streaming.media.ccc.de/32c3/hall1/",
@Ghedeon
Ghedeon / filter_devices.groovy
Created July 22, 2015 12:40
Android Gradle (1.3.0-beta4). Filter multiple devices
project.afterEvaluate {
project.("connectedDebugAndroidTest").doFirst {
def originalProvider = deviceProvider
deviceProvider = [
getName : { originalProvider.getName() },
init : { originalProvider.init() },
terminate : { originalProvider.terminate() },
getDevices : { filterDevices(originalProvider.getDevices()) },
getTimeoutInMs: { originalProvider.getTimeoutInMs() },
isConfigured : { originalProvider.isConfigured() },
@cbeyls
cbeyls / ContentLoadingProgressBar.java
Last active December 20, 2021 22:16
ContentLoadingProgressBar implemented The Right Way™
package be.digitalia.common.widgets;
import android.content.Context;
import android.os.SystemClock;
import android.util.AttributeSet;
import android.view.View;
import android.widget.ProgressBar;
/**
* ContentLoadingProgressBar implements a ProgressBar that waits a minimum time to be
@plastiv
plastiv / Article.java
Created April 22, 2015 08:04
Retrofit multipart convertor
@MultipartBody
public class Article {
String author;
File photo;
}
@rharter
rharter / RevealDrawable.java
Created April 3, 2015 17:41
A Drawable that transitions between two child Drawables based on this Drawable's current level value. The idea here is that the center value (5000) will show the 'selected' Drawable, and any other value will show a transitional value between the 'selected' Drawable and the 'unselected' Drawable.
package com.pixite.fragment.widget;
import android.content.res.Resources;
import android.graphics.Canvas;
import android.graphics.ColorFilter;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.graphics.drawable.Drawable.Callback;
import android.view.Gravity;
@falkorichter
falkorichter / androidJarTasks.gradle
Last active August 29, 2015 14:18
Add all kinds of Jar tasks to your project
def generateJavadocJar = project.task("generateJavadocJars"){
description "Generate all Javadoc Jars of all Variants"
group 'jar'
}
def generateJavadoc = project.task("generateJavadocs"){
description "Generate all Javadoc of all Variants"
group 'jar'
}
@falkorichter
falkorichter / AndroidManifest.xml
Last active August 29, 2015 14:17
custom name for debug buildType
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application
android:label="${applicationLabel}">
<activity
android:label="${applicationLabel}">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
@jaredrummler
jaredrummler / MenuTint.java
Last active April 13, 2022 03:58
Helper class to set the color and transparency for menu icons in an ActionBar or Toolbar.
/*
* Copyright (C) 2015. Jared Rummler <jared.rummler@gmail.com>
*
* 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
@stefanhoth
stefanhoth / jack.bat
Last active August 29, 2015 14:11
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
@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