This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.view.MotionEvent; | |
public class RotateGestureDetector { | |
public static interface OnRotateListener { | |
boolean onRotate(float degrees, float focusX, float focusY); | |
} | |
public static class SimpleOnRotateGestureDetector implements OnRotateListener { | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.List; | |
import android.content.Context; | |
import android.graphics.Bitmap; | |
import android.graphics.Bitmap.Config; | |
import android.graphics.Canvas; | |
import android.graphics.Paint; | |
import android.graphics.PorterDuff.Mode; | |
import android.graphics.PorterDuffXfermode; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import android.view.View; | |
import android.view.ViewGroup; | |
import android.widget.BaseAdapter; | |
public abstract class AbstractListAdapter<T, V extends View> extends BaseAdapter { | |
private List<T> list = Collections.emptyList(); | |
@Override |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
LOCAL_PATH := $(call my-dir) | |
include $(CLEAR_VARS) | |
LOCAL_MODULE := NativeApplication | |
LOCAL_SRC_FILES := NativeApplication.c | |
LOCAL_SHARED_LIBRARIES := gstreamer_android | |
LOCAL_LDLIBS := -landroid | |
include $(BUILD_SHARED_LIBRARY) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.ArrayList; | |
import java.util.Collections; | |
import java.util.List; | |
import java.util.Random; | |
import org.json.JSONException; | |
import org.json.JSONObject; | |
import android.app.Activity; | |
import android.app.PendingIntent; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ImageView view = new ImageView(context) { | |
final RectF r = new RectF(); | |
@Override | |
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { | |
Drawable d = getDrawable(); | |
if (d != null) { | |
r.set(0, 0, d.getIntrinsicWidth(), d.getIntrinsicHeight()); | |
getImageMatrix().mapRect(r); | |
setMeasuredDimension((int) r.width(), (int) r.height()); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const LETTERS = ['0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', 'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z']; | |
const IDX_0 = LETTERS.indexOf('0'); | |
const IDX_9 = LETTERS.indexOf('9'); | |
const IDX_a = LETTERS.indexOf('a'); | |
const IDX_z = LETTERS.indexOf('z'); | |
const IDX_A = LETTERS.indexOf('A'); | |
const IDX_Z = LETTERS.indexOf('Z'); | |
function keysGen(len, min, max, count) { | |
if (Math.pow(max - min + 1, len) < count) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function each(arr, iterator, onEnd) { | |
var endIdx = arr.length - 1; | |
arr.forEach(function(i, idx) { | |
iterator.apply(this, [i, idx, | |
function() { | |
if (idx === endIdx) { | |
if ( typeof onEnd === 'function') { | |
setImmediate(onEnd); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
TwitterAuthDialogFragment dialog = TwitterAuthDialogFragment_.builder() | |
.consumerKey("xxxxx") | |
.consumerSecret("yyyyy") | |
.callbackUrl("http://xxxxx/yyyy") | |
.build(); | |
dialog.setCallbacks(new TwitterAuthDialogFragment.Callbacks() { | |
@Override | |
public void onAccessTokenAvailable(String accessToken, String accessTokenSecret) { | |
// save accessToken & accessTokenSecret or do something | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import android.content.Context; | |
import android.content.res.TypedArray; | |
import android.util.AttributeSet; | |
import android.widget.SeekBar; | |
public class FloatSeekBar extends SeekBar { | |
private float max = 1.0f; | |
private float min = 0.0f; | |
public FloatSeekBar(Context context, AttributeSet attrs, int defStyle) { |
OlderNewer