Skip to content

Instantly share code, notes, and snippets.

Daniel Huckaby DHuckaby

Block or report user

Report or block DHuckaby

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View SmoothCircularIndeterminateProgressDrawable.java
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();
View gist:5107998

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 Feb 12, 2013
PhotupBitmapOptionsFactory.java
View 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 Oct 30, 2012
This generator can construct headlines and news articles by randomly composing sentences.
View NonsenseGenerator.java
/*
* 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 Oct 19, 2012
Forwards compatible version of the ClipboardManager for preserving the api on new versions of the os.
View ClipboardManagerCompat.java
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 Oct 19, 2012
A drawable wrapper that caches the drawing layer, used for caching gradients on older devices.
View CachingDrawable.java
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);
View TwitLongerHelper.java
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 Oct 11, 2015
Disable overscrolling on newer platforms, disable excess scrolling on certain Samsung devices
View OverscrollUtilities.java
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 Oct 19, 2012
Extract urls from plaintext
View Extractor.java
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();
You can’t perform that action at this time.