Skip to content

Instantly share code, notes, and snippets.

View damianflannery's full-sized avatar

Damian Flannery damianflannery

View GitHub Profile
@chris95x8
chris95x8 / UIActivity.java
Created December 13, 2014 22:35
FAB expand
package com.materialdesign.chris.materialdesignexperimenting;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.app.Activity;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.view.ViewAnimationUtils;
@Aracem
Aracem / ParallaxPageTransformer.java
Last active March 8, 2023 17:28
Parallax transformer for ViewPagers that let you set different parallax effects for each view in your Fragments.
package com.aracem.utils.animations.pagetransformation;
import org.jetbrains.annotations.NotNull;
import android.support.v4.view.ViewPager;
import android.view.View;
import java.util.ArrayList;
import java.util.List;
@hvisser
hvisser / Example.java
Created September 14, 2014 18:17
Another example of "embedding" entities in another Cupboard entity
// TypeToken is a Gson class
Type type = new TypeToken<List<Author>>(){}.getType();
GsonFieldConverterFactory factory = new GsonFieldConverterFactory(type);
// Register the factory and set the instance as the global Cupboard instance
CupboardFactory.setCupboard(new CupboardBuilder().registerFieldConverterFactory(factory).build());
@chrisbanes
chrisbanes / SystemUiHelper.java
Last active March 2, 2024 18:57
SystemUiHelper
/*
* Copyright (C) 2014 The Android Open Source Project
*
* 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
@mauimauer
mauimauer / AA-AndroidWearCrashlytics.md
Last active November 24, 2021 09:58
Forward Wear Crashed to Smartphone/Tablet for reporting via Crashlytics (or other Crash Analytics solutions)

Send uncaught Exceptions from Android Wear to Android

This is a short Gist showing how I transmit any uncaught exceptions happening in the Wearable part of my App to the connected Smartphone/Tablet. This is necessary because Android Wear devices are not directly connected to the Internet themselves.

##Wear

  • WearApp.java
  • AndroidManifest.xml
  • ErrorService.java
public class CircularProgressDrawable extends Drawable
implements Animatable {
private static final Interpolator ANGLE_INTERPOLATOR = new LinearInterpolator();
private static final Interpolator SWEEP_INTERPOLATOR = new DecelerateInterpolator();
private static final int ANGLE_ANIMATOR_DURATION = 2000;
private static final int SWEEP_ANIMATOR_DURATION = 600;
private static final int MIN_SWEEP_ANGLE = 30;
private final RectF fBounds = new RectF();
@richardleggett
richardleggett / AutoHighlightImageButton
Last active December 16, 2015 01:38
Android ImageButton that automatically darkens on press, as with iOS UIButton's default highlight. The draw() method is overridden to alpha out the button if disabled. The idea is you quickly get button states without providing state list drawables.
// if you're wanting to put these inside an AdapterView, replace ImageButton below with ImageView
public class AutoHighlightImageButton extends ImageButton {
private boolean mIsPressed;
public AutoHighlightImageButton(Context context) {
super(context);
init();
}
public AutoHighlightImageButton(Context context, AttributeSet attrs) {
// Includes functions for exporting active sheet or all sheets as JSON object (also Python object syntax compatible).
// Tweak the makePrettyJSON_ function to customize what kind of JSON to export.
var FORMAT_ONELINE = 'One-line';
var FORMAT_MULTILINE = 'Multi-line';
var FORMAT_PRETTY = 'Pretty';
var LANGUAGE_JS = 'JavaScript';
var LANGUAGE_PYTHON = 'Python';
@mttkay
mttkay / gist:1105281
Created July 25, 2011 21:30
Workaround for Android issue 9656
public class MyLibrary {
public static final String XMLNS = "http://mylib.com/schema"
}
// in widget class
public class MyWidget {
public MyWidget(Context context, AttributeSet attrs) {
// don't use obtainStyledAttributes, but getAttributeResourceValue:
int myAttr = attrs.getAttributeResourceValue(MyLibrary.XMLNS, "myAttr", -1);