Skip to content

Instantly share code, notes, and snippets.

package com.ewintory.udacity.popularmovies.ui.adapter;
import android.graphics.PorterDuff;
import android.support.annotation.NonNull;
import android.support.v4.app.Fragment;
import android.support.v7.graphics.Palette;
import android.support.v7.widget.RecyclerView;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageButton;
@artem-zinnatullin
artem-zinnatullin / GradleWorkersPleaseStopTakingFocus.gradle
Created July 21, 2015 19:58
Prevent Gradle Workers from taking focus! #DevelopersLikeComfort
// 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'
}
}
@faizsiddiqui
faizsiddiqui / SimpleTabLayout.java
Last active October 15, 2020 14:30
Android Sliding TabLayout with Icons.
package com.example.simpletablayout;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.support.design.widget.TabLayout;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import android.support.v4.view.ViewPager;
import android.support.v7.app.AppCompatActivity;
@Gregadeaux
Gregadeaux / JsonApiConverter.java
Last active April 15, 2016 15:25
JSONAPI Converter for RetroFit with RxJava and RetroLambda
package ai.cometandroid.network;
import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import com.google.gson.internal.LinkedHashTreeMap;
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
@dlew
dlew / gist:3fee09af5ff946997551
Last active December 24, 2017 05:04
Android library artifact tasks
if (project.android.hasProperty('libraryVariants')) {
android.libraryVariants.all { variant ->
Task javadocTask = task("generate${variant.name.capitalize()}Javadoc", type: Javadoc) {
group = 'artifact'
description "Generates Javadoc for $variant.name"
// Source files from the variant
source = variant.javaCompiler.source
// Classpath from the variant + android.jar
@trevorrjohn
trevorrjohn / HexagonImageView.java
Last active March 12, 2021 01:05
Example hexagon image view
package com.playdraft.hexigonimageview;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.CornerPathEffect;
import android.graphics.Paint;
import android.graphics.Path;
import android.graphics.PorterDuff;
@yqritc
yqritc / gist:ccca77dc42f2364777e1
Last active March 29, 2024 10:25
Equal column spacing for Android RecyclerView GridLayoutManager by using custom ItemDecoration

ItemOffsetDecoration

public class ItemOffsetDecoration extends RecyclerView.ItemDecoration {

    private int mItemOffset;

    public ItemOffsetDecoration(int itemOffset) {
        mItemOffset = itemOffset;
    }
@patrickhammond
patrickhammond / EspressoTestRule.java
Last active September 2, 2018 12:14
Hacking through Espresso issues...
import android.app.Activity;
import android.app.Instrumentation;
import android.app.KeyguardManager;
import android.app.KeyguardManager.KeyguardLock;
import android.content.Context;
import android.content.pm.PackageManager;
import android.os.IBinder;
import android.os.PowerManager;
import android.os.PowerManager.WakeLock;
import android.support.test.InstrumentationRegistry;
@massenz
massenz / gtest-install.rst
Last active December 19, 2022 09:14
Describes how to install and run GTest, a Google framework to conduct unit testing in C++

Build and install Google Test

Download the latest_ (1.7.0) from Google Code (Q: where is it going to live, once GCode shuts down?)

Then follow the primer_, but more to the point, the README (YMMV) Having installed CLion and cmake, this is how I built gtest:

brew install cmake
cd gtest-1.7.0
@JakeWharton
JakeWharton / build.gradle
Created March 29, 2015 06:34
A Gradle task for installing all application variants at once. Placed in the public domain.
def installAll = tasks.create('installAll')
installAll.description = 'Install all applications.'
android.applicationVariants.all { variant ->
installAll.dependsOn(variant.install)
// Ensure we end up in the same group as the other install tasks.
installAll.group = variant.install.group
}