Sample rectangle-making code. Presented at The Dalvik Underground, April 7, 2014.
Questions? Get in touch.
import com.google.common.base.Joiner; | |
import com.google.common.primitives.Ints; | |
import java.util.Arrays; | |
public class GrimePuz { | |
public static void main(String[] args) { | |
int[] n = new int[10]; | |
int[] counts = new int[10]; | |
n[0] = 1; | |
while (n[0] < 10) { |
/** | |
* Attempts to set copy into a TextView using the normal copy. If it ends up | |
* wrapping onto more than one line, uses the short copy alternative instead. | |
* @param textView The TextView (or Button or whatever) to setText on. | |
* @param normalCopyResId The preferred copy string resource id. | |
* @param shortCopyResId The alternate (shorter) copy string resource id. | |
*/ | |
public static void maybeUseShorterCopy(final TextView textView, | |
@StringRes final int normalCopyResId, | |
@StringRes final int shortCopyResId) { |
# -*- coding: utf-8; mode: conf -*- | |
include "%L" | |
<Multi_key> <s> <h> <r> <u> <g>: "¯\\_(ツ)_/¯" | |
<Multi_key> <s> <a> <d>: "😿" |
<!DOCTYPE html> | |
<html> | |
<head> | |
<title>multipart test</title> | |
<meta charset='utf-8'> | |
</head> | |
<body> | |
<h1>multipart test</h1> | |
<form action='/test' enctype='multipart/form-data' method='post'> | |
<p> |
import com.squareup.okhttp.Request; | |
import oauth.signpost.AbstractOAuthConsumer; | |
import oauth.signpost.http.HttpRequest; | |
public class OkHttpOAuthConsumer extends AbstractOAuthConsumer { | |
public OkHttpOAuthConsumer(String consumerKey, String consumerSecret) { | |
super(consumerKey, consumerSecret); | |
} | |
@Override |
Sample rectangle-making code. Presented at The Dalvik Underground, April 7, 2014.
Questions? Get in touch.
-----BEGIN PGP PUBLIC KEY BLOCK----- | |
Version: GnuPG v1.4.15 (GNU/Linux) | |
mQGiBDg7OBsRBACAs3JXjvGJ0aKvqA4rIhQUipA86wfq6x3Q9Iji3V2ZQplUIVZy | |
SD/Pg2WZsG45tjpfV5RBmo721lrhAZBpdvnjAFuUFHN9dtv7GwXad4Z0hPCMWXVu | |
jInsshhVpNj1aPrRGXpRKDGRkdxAX0MCGMozSckekogGmKw4ZdBQ8RkPgwCgwsVD | |
KrZqzliuwBbUxboLr3e+dksD/jbzjR/1/vzrQ+a33hu+el84VEEz3UR+GfYcOlRb | |
ZAVUuKwkJeYNy9U96Bp1UM5tAZ63bvPAJ2KkzhUbztmRHu+hrNudNk3+jMy4CzUe | |
4jaPeNBJmZZk4kXPrcANxAD180aTmBzmWj2N+phHplD6lQw2do6MlXtz5aCCo2pj | |
9lvZA/wJjYao5YGm/cON1vS9/cGNQURxt0VLSoRli5xJukELezCnxCNeC8oE7owr |
/** | |
* Work around a bug in Android 4.3 | |
*/ | |
public static CharSequence fixFontColor(CharSequence seq, int color) { | |
if (Build.VERSION.SDK_INT < 18 || !(seq instanceof Spanned)) | |
return seq; | |
Spannable txt = (seq instanceof Spannable ? (Spannable)seq : new SpannableString(seq)); | |
for (ForegroundColorSpan ann : txt.getSpans(0, txt.length(), ForegroundColorSpan.class)) { | |
if (ann.getForegroundColor() != color) { | |
int start = txt.getSpanStart(ann), end = txt.getSpanEnd(ann), flags = txt.getSpanFlags(ann); |
@Override | |
public boolean onOptionsItemSelected(MenuItem item) { | |
switch (item.getItemId()) { | |
case android.R.id.home: | |
onBackPressed(); // OMG THIS IS SO WRONG BUT ALSO SO RIGHT | |
return true; | |
// other cases... | |
} | |
} |