Skip to content

Instantly share code, notes, and snippets.

Android ADB over wifi

Some notes from my successes and failures.

Definitions

From the official docs

It is a client-server program that includes three components: >

@peter-tackage
peter-tackage / ViewModelClear.kt
Created April 17, 2020 11:12
Simulates teardown of Android ViewModel
fun ViewModel.tearDown() {
ViewModel::class.java.getDeclaredMethod("clear")
.apply { isAccessible = true }(this)
}
@peter-tackage
peter-tackage / Pager.java
Created November 4, 2015 17:39 — forked from mttkay/Pager.java
A simple Rx based pager
public class Pager<I, O> {
private static final Observable FINISH_SEQUENCE = Observable.never();
private PublishSubject<Observable<I>> pages;
private Observable<I> nextPage = finish();
private Subscription subscription = Subscriptions.empty();
private final PagingFunction<I> pagingFunction;
private final Func1<I, O> pageTransformer;
@peter-tackage
peter-tackage / strings.xml
Created March 6, 2015 14:00
Formatted links in Android resources
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string formatted="false" name="html_link"><![CDATA[<a href=\"%s\">%s</a>]]></string>
</resources>
@peter-tackage
peter-tackage / Incrementer.java
Created March 27, 2014 20:54
Integer array incrementer
public class Incrementer {
public static int[] increment(int[] input) {
int index = input.length -1;
while(++input[index] % 10 == 0) {
input[index] = input[index] % 10;
if(index == 0) {
int[] result = new int[input.length + 1];
result[0] = 1;
return result;
}
@peter-tackage
peter-tackage / gist:9250638
Created February 27, 2014 14:02
Flipview from Android Youtube examples
/*
* Copyright 2012 Google Inc. All Rights Reserved.
*
* 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
@peter-tackage
peter-tackage / gist:7168528
Last active December 26, 2015 14:49
Cancellable Target Callback for Square Picasso
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
public class CancelableTarget implements Target {
protected Target mTarget;
private boolean mIsCancelled;