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) 2016 Jeff Gilfelt. | |
* | |
* 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
#!/bin/bash | |
# How to install: | |
# exo-open "http://developer.android.com/sdk/index.html#Other" | |
# sudo apt-get install libav-tools imagemagick | |
# wget https://gist.githubusercontent.com/lorenzos/e8a97c1992cddf9c1142/raw/android-screen-to-gif.sh | |
# chmod a+x android-screen-to-gif.sh | |
# Help message | |
function usage() { |
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.util.Log; | |
import com.facebook.stetho.inspector.jsonrpc.JsonRpcPeer; | |
import com.facebook.stetho.inspector.protocol.ChromeDevtoolsMethod; | |
import org.json.JSONObject; | |
import java.util.regex.Matcher; | |
import java.util.regex.Pattern; | |
import timber.log.Timber; | |
/** | |
* Log things to console (hacked job). |
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.app.Activity; | |
import android.content.Context; | |
import android.hardware.display.DisplayManager; | |
import android.os.Bundle; | |
import android.view.Display; | |
/** | |
* A base activity for watch faces that have callbacks for the various screen states (dim, awake, and off) | |
* as well as a callback for when the watch face is removed. | |
* <p/> |
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
/** | |
* Creates a 'ghost' bitmap version of the given source drawable (ideally a BitmapDrawable). | |
* In the ghost bitmap, the RGB values take on the values from the 'color' argument, while | |
* the alpha values are derived from the source's grayscaled RGB values. The effect is that | |
* you can see through darker parts of the source bitmap, while lighter parts show up as | |
* the given color. The 'invert' argument inverts the computation of alpha values, and looks | |
* best when the given color is a dark. | |
*/ | |
private Bitmap createGhostIcon(Drawable src, int color, boolean invert) { | |
int width = src.getIntrinsicWidth(); |
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 QuickReturn { | |
private final static int ANIMATION_DURATION_MILLIS = 250; | |
private final ListView listView; | |
private final View quickReturnView; | |
private final View headerPlaceholder; | |
private int itemCount; | |
private int itemOffsetY[]; |
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/mkdir /tmp/rip 2> /dev/null | |
javac -d /tmp/rip $0 | |
java -cp /tmp/rip Rip "$@" | |
exit | |
*/ | |
import java.io.BufferedReader; | |
import java.io.IOException; | |
import java.io.InputStreamReader; | |
import java.util.*; | |
import java.util.regex.Matcher; |