Skip to content

Instantly share code, notes, and snippets.

View DHuckaby's full-sized avatar

Daniel Huckaby DHuckaby

View GitHub Profile
public class SmoothCircularIndeterminateProgressBarDrawable
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();

Twitter公式クライアントのコンシューマキー

Twitter for iPhone

Consumer key: IQKbtAYlXLripLGPWd0HUA
Consumer secret: GgDYlkSvaPxGxC4X8liwpUoqKwwr3lCADbz8A7ADU

Twitter for Android

Consumer key: 3nVuSoBZnx6U4vzUxf5w
Consumer secret: Bcs59EFbbsdF6Sl9Ng71smgStWEGwXXKSjYvPVt7qys

Twitter for iPad

Consumer key: CjulERsDeqhhjSme66ECg

@DHuckaby
DHuckaby / PhotupBitmapOptionsFactory.java
Created February 12, 2013 23:21
PhotupBitmapOptionsFactory.java
public class PhotupBitmapOptionsFactory implements BitmapOptionsFactory {
private static int MAX_DIMEN = 512;
@Override
public Options newOptionsFromStream(InputStream inputStream, int width, int height) {
BitmapFactory.Options bitmapFactoryOptions = new BitmapFactory.Options();
final int maxDim;
if (height > 0 && width > 0) {
@DHuckaby
DHuckaby / NonsenseGenerator.java
Created October 30, 2012 13:26
This generator can construct headlines and news articles by randomly composing sentences.
/*
* Copyright (C) 2011 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
@DHuckaby
DHuckaby / ClipboardManagerCompat.java
Created October 19, 2012 18:49
Forwards compatible version of the ClipboardManager for preserving the api on new versions of the os.
public class ClipboardManagerCompat {
public static ClipboardManager getInstance(Context context) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
return new DeprecatedClipboardManager(context);
} else {
return new HoneycombClipboardManager(context);
}
}
@DHuckaby
DHuckaby / CachingDrawable.java
Created October 19, 2012 18:48
A drawable wrapper that caches the drawing layer, used for caching gradients on older devices.
public class CachingDrawable extends Drawable {
private final Drawable mDrawable;
private final Config mConfig;
private Bitmap mBitmap;
public CachingDrawable(Drawable drawable) {
this(drawable, Config.ARGB_8888);
@DHuckaby
DHuckaby / TwitLongerHelper.java
Created October 19, 2012 18:47
TwitLonger utility
public class TwitLongerHelper {
private static final String UTF_8 = "UTF-8";
private String api_key;
private String application;
private String username;
public TwitLongerHelper(String api_key, String application, String username) {
this.api_key = api_key;
@DHuckaby
DHuckaby / OverscrollUtilities.java
Last active October 11, 2015 21:08
Disable overscrolling on newer platforms, disable excess scrolling on certain Samsung devices
public class OverscrollUtilities {
public static void disableOverscrollMode(View view) {
if (view instanceof ListView) {
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB && "samsung".equalsIgnoreCase(Build.MANUFACTURER)) {
try {
ListView listView = (ListView) view;
Method setEnableExcessScroll = ListView.class.getMethod("setEnableExcessScroll", Boolean.TYPE);
if (setEnableExcessScroll != null) {
setEnableExcessScroll.invoke(listView, Boolean.FALSE);
@DHuckaby
DHuckaby / Extractor.java
Created October 19, 2012 18:44
Extract urls from plaintext
public class Extractor {
public static ArrayList<String> extract(String text) {
ArrayList<String> links = new ArrayList<String>();
String regex = "\\(?\\b(http://|www[.])[-A-Za-z0-9+&@#/%?=~_()|!:,.;]*[-A-Za-z0-9+&@#/%=~_()|]";
Pattern p = Pattern.compile(regex);
Matcher m = p.matcher(text);
while (m.find()) {
String urlStr = m.group();