Skip to content

Instantly share code, notes, and snippets.

@consp1racy
consp1racy / ToolbarUtils.java
Last active Aug 29, 2015
Material Toolbar Utilities
View ToolbarUtils.java
import android.animation.LayoutTransition;
import android.annotation.TargetApi;
import android.app.ActionBar;
import android.app.Activity;
import android.content.Context;
import android.content.res.TypedArray;
import android.graphics.Color;
import android.graphics.PorterDuff;
import android.graphics.drawable.Drawable;
import android.os.Build;
View MaterialUtils.java
// ...
public static void fixToolbarOverflowButton(final Activity activity) {
if (Build.VERSION.SDK_INT >= 21) {
// the problem occurs only on LOLLIPOP when using native Toolbar and Action Bar
try {
final int abId = activity.getResources().getIdentifier("android:id/action_bar", null, null);
final Toolbar toolbar = (Toolbar) activity.getWindow().getDecorView().findViewById(abId);
final int moreId = activity.getResources().getIdentifier("android:string/action_menu_overflow_description", "string", null);
View Section2.java
package com.xwray.groupie;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.util.DiffUtil;
import android.support.v7.util.ListUpdateCallback;
import java.util.ArrayList;
import java.util.Collection;
@consp1racy
consp1racy / XpeceDrawableWrapper.java
Created Apr 19, 2015
How to get around wrapped drawables
View XpeceDrawableWrapper.java
package net.xpece.android.graphics.drawable;
import android.graphics.drawable.Drawable;
import android.util.Log;
import java.lang.reflect.Field;
/**
* Created by Eugen on 8. 3. 2015.
*/
View ProcessAwareApplication.java
import android.app.Application;
import android.content.Context;
import androidx.annotation.CallSuper;
import androidx.annotation.NonNull;
public class ProcessAwareApplication extends Application {
@Override
public Context getApplicationContext() {