Skip to content

Instantly share code, notes, and snippets.

/*
*
<declare-styleable name="GridSpanLayout">
<attr name="rows" format="integer" />
<attr name="columns" format="integer" />
<attr name="column" format="integer" />
<attr name="row" format="integer" />
<attr name="columnSpan" format="integer" />
<attr name="rowSpan" format="integer" />
@pskink
pskink / VG.java
Last active August 29, 2015 14:07
// ViewDragHelper test
public class VG extends ViewGroup {
private static final String TAG = "VG";
private final ViewDragHelper mDragHelper;
private Rect[] mBounds = new Rect[4];
public VG(Context context) {
super(context);
int[] colors = {Color.RED, Color.GREEN, Color.BLUE, Color.YELLOW};
for (int i = 0; i < 4; i++) {
TextView tv = new TextView(getContext());
@pskink
pskink / ColorFilterGenerator.java
Created May 14, 2015 06:37
ColorFilter Generator
package com.example.app.myapplication;
import android.graphics.ColorFilter;
import android.graphics.ColorMatrix;
import android.graphics.ColorMatrixColorFilter;
public class ColorFilterGenerator {
private static double DELTA_INDEX[] = {
0, 0.01, 0.02, 0.04, 0.05, 0.06, 0.07, 0.08, 0.1, 0.11,
package com.example.app.myapplication;
import android.content.Context;
import android.util.AttributeSet;
import android.view.View;
/*
res/layout/fsvt.xml test layout file:
<?xml version="1.0" encoding="utf-8"?>
package com.example.app.myapplication;
import android.content.Context;
import android.support.v4.widget.ViewDragHelper;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
public abstract class FlexScrollView extends ViewGroup {
@pskink
pskink / ColumnExtenderCursor.java
Created August 9, 2015 06:07
ColumnExtenderCursor
package com.example.app.myapplication;
import android.database.Cursor;
import android.database.CursorWrapper;
public class ColumnExtenderCursor extends CursorWrapper {
private final String[] columnNames;
public ColumnExtenderCursor(Cursor cursor, String... newColumns) {
@pskink
pskink / ghost_contact_cursor
Created September 30, 2015 07:58
ghost contact cursor
// add in Activity#onCreate
ListView lv = new ListView(this);
setContentView(lv);
Uri uri = ContactsContract.Contacts.CONTENT_URI;
Wrapper c = Wrapper.query(getContentResolver(), uri, null, null, null, ContactsContract.Contacts.DISPLAY_NAME, getResources());
String[] from = {
ContactsContract.Contacts.DISPLAY_NAME,
Wrapper.PHONES,
};
abstract class DecoratedDrawable extends LevelListDrawable {
public DecoratedDrawable(Context ctx, int resId) {
TypedArray typedArray = ctx.obtainStyledAttributes(new int[] {resId});
Drawable drawable = typedArray.getDrawable(0);
typedArray.recycle();
if (drawable == null) {
drawable = ctx.getResources().getDrawable(resId);
}
init(drawable);
}
class CircleBitmapDrawable extends Drawable {
Bitmap bitmap;
Paint maskPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
Paint borderPaint = new Paint(Paint.ANTI_ALIAS_FLAG);
float side;
float radius;
public CircleBitmapDrawable(Bitmap wrappedBitmap, float borderWidth, int borderColor) {
bitmap = wrappedBitmap;
borderPaint.setStyle(Paint.Style.STROKE);
import 'dart:async';
import 'dart:math';
import 'package:flutter/material.dart';
import 'package:flutter/widgets.dart';
import 'package:quiver/cache.dart';
import 'package:quiver/collection.dart';
/*
class LazyList extends StatefulWidget {