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 MissingXmlHeaderDetector extends ResourceXmlDetector { | |
public static final Issue ISSUE_MISSING_XML_HEADER = Issue.create( | |
"MissingXmlHeader", | |
"Flags xml files that don't have a header.", | |
"An xml file should always have the xml header to declare that it is an xml file despite the file ending.", | |
Category.CORRECTNESS, 10, Severity.ERROR, | |
new Implementation(MissingXmlHeaderDetector.class, Scope.RESOURCE_FILE_SCOPE)); | |
@Override |
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 | |
EMULATOR_NAME=$1 | |
USER_NAME=$2 | |
ENVIRONMENT=$3 | |
# Start an emulator | |
${ANDROID_HOME}/tools/emulator -avd ${EMULATOR_NAME} -wipe-data & | |
EMULATOR_PID=$! | |
# Wait for Android to finish booting |
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
gradlew with --refresh-dependencies |
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
@Test | |
public void testRxjavaThreading() throws InterruptedException { | |
final BlockingQueue<Runnable> tasks = new LinkedBlockingQueue<>(); | |
System.out.println("Caller thread: " + Thread.currentThread().getName()); | |
final Disposable subscribe = Observable.fromCallable( | |
new Callable<Integer>() { | |
@Override | |
public Integer call() throws Exception { | |
System.out.println("Observable thread: " + Thread.currentThread().getName()); |
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.graphics.Bitmap; | |
import android.graphics.Canvas; | |
import android.graphics.Color; | |
import android.graphics.Paint; | |
import android.graphics.Path; | |
import android.os.Bundle; | |
import android.support.v7.app.ActionBarActivity; | |
import android.view.MotionEvent; | |
import android.view.View; |
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
final ViewTreeObserver vto = myview.getViewTreeObserver(); | |
vto.addOnGlobalLayoutListener(new OnGlobalLayoutListener() { | |
@SuppressLint("NewApi") | |
@Override | |
public void onGlobalLayout() { | |
// do stuff | |
// remove this layout listener - as it will run every time the view updates | |
if (myview.getViewTreeObserver().isAlive()) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { |
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
// Create new image target | |
final SimpleImageTarget newTarget = new SimpleImageTarget( | |
clusterItem.getSpot(), marker, markerImageView, iconGenerator); | |
// Store target reference - remove later | |
if (!imageTargets.containsKey(clusterItem.getSpot().getId())) { | |
imageTargets.put(clusterItem.getSpot().getId(), newTarget); | |
} | |
// Kick off image loading |
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
android { | |
... | |
debug { | |
debuggable true | |
... | |
ext.betaDistributionGroupAliases = "Android-Test" | |
} | |
... | |
project.android.applicationVariants.all { variant -> | |
variant.preBuild.doLast { |
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.graphics.Rect; | |
import android.view.TouchDelegate; | |
import android.view.View; | |
import com.google.common.base.Optional; | |
import com.google.common.base.Preconditions; | |
/** | |
* Utility used to extend the touchable area around a view in a viewgroup | |
* Usage: TouchAreaExtender.Builder.with(mReJamCaptionInput) |
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 PhoneNumberFormatter { | |
private final String simCountryIso; | |
private final Map<String, String> countryCodeMap = Collections.unmodifiableMap( | |
new HashMap<String, String>() {{ | |
put("GB", "44"); | |
put("US", "1"); | |
}}); |