Skip to content

Instantly share code, notes, and snippets.

View ed-george's full-sized avatar
🌍
Working remotely...

Ed Holloway-George ed-george

🌍
Working remotely...
View GitHub Profile
@tir38
tir38 / gist:3d03f5b94c30595fdeeb
Last active December 25, 2015 06:13
Extends Daniel Olshansky's DevByte example "ListView Expanding Cells Animation" to allow for custom collapsable height http://www.youtube.com/watch?v=mwE61B56pVQ http://developer.android.com/shareables/devbytes/ListViewExpandingCells.zip

In Daniel's example, all rows contain the same view, so their collapsed heights are all the same. However if you have different size collapsed rows, the animation will be jumpy. To fix this

  1. pull the cell height out of the constructor for ExpandableListItem:
public class ExpandableListItem implements OnSizeChangedListener {

    private String mTitle;
    private String mText;
 private boolean mIsExpanded;
@daichan4649
daichan4649 / MainActivity.java
Last active March 3, 2016 09:37
AsyncTask sample (non-retain Fragment)
package test.fragment.asynctask;
import test.fragment.R;
import android.app.Activity;
import android.os.Bundle;
import android.util.Log;
import android.view.View;
import android.view.View.OnClickListener;
public class MainActivity extends Activity {
@t-oster
t-oster / MakeBraceletRingWithDroidScript
Created February 20, 2015 14:21
This DroidScript (JavaScript for Android) makes my China Bluetooth Bracelet Vibrate whenever I want.
var btn;
var bt;
var txt;
//Called when application is started.
function OnStart()
{
//Create a layout with objects vertically centered.
lay = app.CreateLayout( "linear", "VCenter,FillXY" );
//Create a button 1/3 of screen width and 1/4 screen height.
@ryanbateman
ryanbateman / gist:6667995
Last active September 6, 2017 21:03
Basic BlurTransformer for Square's Picasso
import android.content.Context;
import android.graphics.Bitmap;
import android.renderscript.Allocation;
import android.renderscript.Element;
import android.renderscript.RenderScript;
import android.renderscript.ScriptIntrinsicBlur;
import com.squareup.picasso.Transformation;
public class BlurTransform implements Transformation {
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="red_50">#fde0dc</color>
<color name="red_100">#f9bdbb</color>
<color name="red_200">#f69988</color>
<color name="red_300">#f36c60</color>
<color name="red_400">#e84e40</color>
<color name="red_500">#e51c23</color>
<color name="red_600">#dd191d</color>
<color name="red_700">#d01716</color>
@f2prateek
f2prateek / ActivitySubscriptionManager.java
Last active October 23, 2017 14:30
Managing Subscriptions in Android with RxJava
/*
* Copyright 2014 Prateek Srivastava
*
* 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
@berkkaraoglu
berkkaraoglu / BorderedCircleTransform.java
Created November 14, 2014 09:12
BorderedCircleTransform for Picasso (Based on https://gist.github.com/julianshen/5829333)
import android.graphics.Bitmap;
import android.graphics.BitmapShader;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import com.squareup.picasso.Transformation;
public class CircleTransform implements Transformation {
private final int BORDER_COLOR = Color.WHITE;
@AAverin
AAverin / KotlinRxExt.kt
Last active April 17, 2020 11:09
Kotlin Rx Extensions
import rx.Observable
import rx.Observer
import rx.Subscriber
import rx.Subscription
import rx.functions.Action0
import rx.functions.Action1
fun <T> Observable<T>.uiSubscribe(schedulers: Schedulers, subscriber: Subscriber<in T>): Subscription {
return subscribeOn(schedulers.io)
.observeOn(schedulers.mainThread)
@cdsap
cdsap / AndroidManifest.xml
Last active January 7, 2021 17:59
Example ManifestPlaceHolder
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.myapplication" >
<application
android:allowBackup="true"
android:icon="@drawable/ic_launcher"
android:label="@string/app_name"
android:theme="@style/AppTheme" >
<activity
@chrisbanes
chrisbanes / KotterKnife.kt
Last active February 7, 2021 15:25
LifecycleAware KotterKnife
package kotterknife
import android.app.Activity
import android.app.Dialog
import android.app.DialogFragment
import android.app.Fragment
import android.arch.lifecycle.Lifecycle
import android.arch.lifecycle.LifecycleObserver
import android.arch.lifecycle.LifecycleOwner
import android.arch.lifecycle.OnLifecycleEvent