class: center, middle, title-slide
This file contains hidden or 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.text.Selection; | |
import android.text.Spannable; | |
import android.text.SpannableStringBuilder; | |
import android.text.TextPaint; | |
import android.text.method.LinkMovementMethod; | |
import android.text.style.ClickableSpan; | |
import android.view.View; | |
import android.view.View.OnAttachStateChangeListener; | |
import android.widget.TextView; |
This file contains hidden or 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 | |
rm -rf app | |
mkdir -p app/src/main/java/com/mycompany/myapp | |
echo "import com.mycompany.myapp.R;" > app/src/main/java/com/mycompany/myapp/Test.java | |
echo "com.mycompany.myapp.SomeActivity" > app/AndroidManifest.xml |
This file contains hidden or 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
package com.mycompany.myapp.app; | |
import android.app.Application; | |
import android.content.Intent; | |
import com.google.android.gms.common.GooglePlayServicesUtil; | |
import com.google.android.gms.security.ProviderInstaller; | |
import com.google.android.gms.security.ProviderInstaller.ProviderInstallListener; | |
public class MainApplication extends Application { |
This file contains hidden or 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 com.google.gson.Gson; | |
import java.io.IOException; | |
public class GsonParser implements Parser { | |
@Override | |
public <T> T parse(String json, Class<T> clazz) throws IOException { | |
return new Gson().fromJson(json, clazz); | |
} | |
} |
This file contains hidden or 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
/** | |
* In the absence of Java 8, here is our Optional duplicated code. Other than the package name, | |
* this should be a subset of this API, http://docs.oracle.com/javase/8/docs/api/java/util/Optional.html | |
*/ | |
public final class Optional<T> { | |
public static <T> Optional<T> of(T value) { | |
if (value == null) { | |
return Optional.empty(); | |
} |
This file contains hidden or 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.app.Application; | |
import android.os.Bundle; | |
import com.google.analytics.tracking.android.EasyTracker; | |
public class MainApplication extends Application { | |
private boolean locationNeedsUpdated = true; | |
private int createdActivityInstanceCount = 0; | |
This file contains hidden or 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 void checkHasPermission(Context contxt, String permissionName) { | |
String packageName = context.getPackageName(); | |
PackageManager packageManager = context.getPackageManager(); | |
int permissionStatus = packageManager.checkPermission(permissionName, packageName); | |
if (permissionStatus != PackageManager.PERMISSION_GRANTED) { | |
throw new SecurityException("Application requires <uses-permission android:name=\"" + permissionName + "\" />"); | |
} | |
} |
This file contains hidden or 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
... | |
apply plugin: 'findbugs' | |
... | |
task findbugs(type: FindBugs, dependsOn: assembleDebug) { | |
excludeFilter file("${project.rootDir}/config/findbugs/exclude.xml") | |
classes = fileTree('build/intermediates/classes/debug/') // Varies based on your app build configs and flavors... | |
source = fileTree('src/main/java/') |
This file contains hidden or 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 | |
while true; do | |
sleep 3300 # 55 min * 60 sec | |
echo "Bouncing the wifi at `date`" | |
# You might need to change en1 to something else. | |
# ifconfig can tell you what network adapter to use | |
networksetup -setairportpower en1 off | |
sleep 2 |