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.io.ByteArrayInputStream; | |
import java.io.IOException; | |
import java.io.InputStream; | |
import java.util.logging.Handler; | |
import java.util.logging.Level; | |
import java.util.logging.LogManager; | |
import java.util.logging.LogRecord; | |
import java.util.logging.Logger; | |
import android.util.Log; |
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
/* | |
* Copyright (C) 2013 Google, 2014 Stefano Dacchille | |
* | |
* 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 |
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
public class Transformers { | |
public static <T> Observable.Transformer<Iterable<T>, T> flatten() { | |
return new Observable.Transformer<Iterable<T>, T>() { | |
@Override | |
public Observable<T> call(Observable<Iterable<T>> iterableObservable) { | |
return iterableObservable.flatMap(new Func1<Iterable<T>, Observable<T>>() { | |
@Override | |
public Observable<T> call(Iterable<T> iterable) { | |
return Observable.from(iterable); |
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
public static Field getField(Class<?> clazz, String fieldName) { | |
Class<?> tmpClass = clazz; | |
do { | |
try { | |
Field f = tmpClass.getDeclaredField(fieldName); | |
f.setAccessible(true); | |
return f; | |
} catch (NoSuchFieldException e) { | |
tmpClass = tmpClass.getSuperclass(); | |
} |
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
#!/bin/sh | |
# License for any modification to the original (linked below): | |
# ---------------------------------------------------------------------------- | |
# "THE BEER-WARE LICENSE" (Revision 42): | |
# Sebastiano Poggi wrote this file. As long as you retain this notice you | |
# can do whatever you want with this stuff. If we meet some day, and you think | |
# this stuff is worth it, you can buy me a beer in return. | |
# ---------------------------------------------------------------------------- | |
# | |
# Based upon http://blog.pkh.me/p/21-high-quality-gif-with-ffmpeg.html |
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
public static final Locale FRENCH_LOCALE = new Locale("fr", "FR"); | |
@Rule | |
public ActivityTestRule<SplashScreenActivity> activityRule = new ActivityTestRule(SplashScreenActivity.class, true, true) { | |
@Override | |
protected void beforeActivityLaunched() { | |
super.beforeActivityLaunched(); | |
Locale.setDefault(FRENCH_LOCALE); |
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
public class Screenshot { | |
public static final String TAG = Screenshot.class.getSimpleName(); | |
public static void takeScreenshot(String name, Activity activity) { | |
String testDirPath = Environment.getExternalStorageDirectory().getAbsolutePath() + "/test-screenshots"; | |
File testDir = new File(testDirPath); | |
testDir.mkdirs(); | |
View scrView = activity.getWindow().getDecorView().getRootView(); |
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.annotation.TargetApi; | |
import android.database.Cursor; | |
import android.database.CursorWrapper; | |
import android.os.Build; | |
import java.lang.reflect.Field; | |
public class TypedCursor<T> extends CursorWrapper { | |
private Class<T> aClass; |
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.graphics.Rect; | |
import android.support.v7.widget.AppCompatAutoCompleteTextView; | |
import android.util.AttributeSet; | |
import android.view.View; | |
public class InstantAutoCompleteTextView extends AppCompatAutoCompleteTextView { | |
public InstantAutoCompleteTextView(Context context) { | |
super(context); |
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.graphics.Rect; | |
import android.support.v7.widget.AppCompatAutoCompleteTextView; | |
import android.util.AttributeSet; | |
import android.view.MotionEvent; | |
import android.view.View; | |
import android.view.inputmethod.InputMethodManager; | |
import android.widget.AdapterView; | |
// style it with @style/Widget.AppCompat.Spinner.Underlined |
OlderNewer