Instantly share code, notes, and snippets.

View config.ini
cat less ~/.android/avd/Nexus_5X_API_24.avd/config.ini
cat: less: No such file or directory
AvdId=Nexus_5X_API_24
PlayStore.enabled=false
abi.type=armeabi-v7a
avd.ini.displayname=Nexus 5X API 24
avd.ini.encoding=UTF-8
disk.dataPartition.size=800M
fastboot.chosenSnapshotFile=
fastboot.forceChosenSnapshotBoot=no
View gist:4dff6c4ba428b611981ba76ffd79af80
Observable<DownloadState> observable =
Observable.interval(PROGRESS_INTERVAL_MILLIS, TimeUnit.MILLISECONDS)
.flatMap(new Function<Long, ObservableSource<DownloadState>>() {
@Override
public ObservableSource<DownloadState> apply(Long aLong) throws Exception {
DownloadManager.Query query = new DownloadManager.Query();
query.setFilterById(downloadId);
Cursor cursor = getDownloadManager().query(query);
if (!cursor.moveToFirst()) {
cursor.close();
View ShadowEMVideoView.java
@Implements(com.devbrackets.android.exomedia.EMVideoView.class)
public class ShadowEMVideoView extends ShadowRelativeLayout {
public static final int STOP = 0;
public static final int START = 1;
public static final int SUSPEND = 2;
public static final int PAUSE = 3;
private int currentState = -1;
private int prevState;
View strip_play_services.gradle
def toCamelCase(String string) {
String result = ""
string.findAll("[^\\W]+") { String word ->
result += word.capitalize()
}
return result
}
afterEvaluate { project ->
Configuration runtimeConfiguration = project.configurations.getByName('compile')
View ListScrollingUtils
public void scrollToPosition(ListView lv, int position, boolean clipToPadding) {
scrollToPositionFromTop(lv, position, 0, clipToPadding);
}
public void scrollToPositionFromTop(ListView lv, int item, int y, boolean clipToPadding) {
//Had to apply this offset if clipToPadding="false"
if (!clipToPadding) {
item -= lv.getPaddingTop();
}
this.setSelectionFromTop(position, y);