Skip to content

Instantly share code, notes, and snippets.

View intrications's full-sized avatar

Michael Basil intrications

View GitHub Profile
package com.fewlaps.android.quitnow.base.customview;
import android.os.Handler;
import android.view.View;
/**
* A simple way to call the common new Handler().postDelayed(..., time);
* to show the Ripple animation completely and then run a Runnable. This class
* have to be used like a {@link android.view.View.OnClickListener}
*
@dmytrodanylyk
dmytrodanylyk / ShadowLayout.java
Last active August 29, 2015 14:15
ShadowLayout
public class ShadowLayout extends FrameLayout implements ViewGroup.OnHierarchyChangeListener {
private int mBackgroundColor;
private int mShadowColor;
private float mShadowRadius;
private float mCornerRadius;
private float mDx;
private float mDy;
private Paint mPaint;
@Aracem
Aracem / AnimationViewUtils
Created March 19, 2015 15:40
Tada Animation from Cyrill Mottier
package com.aracem.utils.animation;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.Keyframe;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
@Takhion
Takhion / styles.xml
Created June 3, 2015 15:16
Custom dialog Activity style
<?xml version="1.0" encoding="utf-8"?>
<resources xmlns:tools="http://schemas.android.com/tools">
<style name="CustomDialog" parent="@style/Base.Theme.AppCompat.Light.Dialog.FixedSize">
<item name="android:windowCloseOnTouchOutside">false</item>
<item name="android:windowBackground">@android:color/transparent</item>
<item name="android:windowIsFloating">false</item>
<item name="android:windowIsTranslucent">true</item>
<item name="android:windowClipToOutline">false</item>
@Takhion
Takhion / AndroidManifest.xml
Created June 1, 2015 16:34
Task killer for Android
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
<application>
<activity android:name=".TaskKiller"/>
</application>
class LoginActivity extends Activity {
// Setup stuff
@Override
public void onResume() {
// Subscribe to the login view submit
AppObservable.bindActivity(this, loginView.getUserCredentialsObservable().subscribeOn(mainThread()))
.doOnNext(loginView.showProgress(true))
.flatMap(creds -> getTokenObservable(creds))
.subscribe(this::handleSuccess)
@jgilfelt
jgilfelt / mapimports.sh
Created September 13, 2012 15:23
Toggle Google/Amazon Android map imports
#!/bin/bash
A_IMPORT="import com.amazon.geo.maps"
G_IMPORT="import com.google.android.maps"
A_VIEW="com.amazon.geo.maps.MapView"
G_VIEW="com.google.android.maps.MapView"
if [ "$1" = "a" ]; then
FR=$G_IMPORT
@ManuelPeinado
ManuelPeinado / IsPastTest.java
Created November 1, 2012 16:32
See if a certain time has already passed in a given time zone
public class IsPastTest {
public static final String SPAIN = "Europe/Madrid";
public static final String PORTUGAL = "Europe/Lisbon";
public boolean isPast(int year, int month, int day, int hour, int minute) {
return isPast(year, month, day, hour, minute, null);
}
public boolean isPast(int year, int month, int day, int hour, int minute, String timeZone) {
@jdamcd
jdamcd / gist:4224231
Created December 6, 2012 12:52
Thumbnail scaling for Android notfications
public class NotificationThumbnailHelper {
private float targetWidth;
private float targetHeight;
public NotificationThumbnailHelper(Context context) {
targetWidth = getTargetWidth(context);
targetHeight = getTargetHeight(context);
}
@seratch
seratch / build.gradle
Created December 8, 2012 05:41
Tweet from Gradle
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath group: 'org.twitter4j', name: 'twitter4j-core', version: '3.0.2'
}
}
import twitter4j.*