Skip to content

Instantly share code, notes, and snippets.

View minsoopark's full-sized avatar

Minsoo Park minsoopark

View GitHub Profile
@minsoopark
minsoopark / ObjectSerializer.kt
Last active May 15, 2016 12:32
Object serialize helper in Kotlin
public class ObjectSerializer {
companion object {
public fun serialize(obj: Any?) : String {
if (obj == null) {
return ""
}
var baos = ByteArrayOutputStream()
var oos = ObjectOutputStream(baos)
oos.writeObject(obj)
public class SquareImageView extends ImageView {
public SquareImageView(Context context) {
this(context, null);
}
public SquareImageView(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
public SquareImageView(Context context, AttributeSet attrs, int defStyle) {
@minsoopark
minsoopark / CollectionUtil.java
Created January 9, 2015 06:42
Collection Utility
public class CollectionUtil {
public interface PropertyGetter <T, U> {
public U getProperty(T from);
}
public static <T, U> List<T> getPropertiesFromList(List<U> list, PropertyGetter<U, T> getter) {
List<T> result = new ArrayList<T>();
for (U object : list) {
result.add(getter.getProperty(object));
}
@minsoopark
minsoopark / FilteringAdapter.java
Last active January 11, 2016 01:21
Android Filtering List Adapter
// ~~
public abstract class FilteringAdapter<T> extends BaseAdapter implements Filterable {
public interface StringGetter<T> {
String getString(T from);
}
protected Context context;
protected List<T> origin;