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.content.Intent; | |
import android.os.Bundle; | |
import android.support.v4.app.Fragment; | |
import java.util.ArrayList; | |
import java.util.HashMap; | |
import java.util.List; | |
import java.util.Map; | |
import org.robolectric.annotation.Implementation; | |
import org.robolectric.annotation.Implements; | |
import org.robolectric.shadows.ShadowApplication; |
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.support.design.widget.TextInputLayout; | |
import org.robolectric.annotation.Implements; | |
import org.robolectric.annotation.RealObject; | |
import org.robolectric.shadows.ShadowViewGroup; | |
@Implements(TextInputLayout.class) | |
public class ShadowTextInputLayout extends ShadowViewGroup { | |
@RealObject private TextInputLayout realTextInputLayout; |
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 java.io.ByteArrayOutputStream; | |
import java.io.PrintStream; | |
import org.junit.rules.ExternalResource; | |
import org.robolectric.shadows.ShadowLog; | |
public class RobolectricLoggingRule extends ExternalResource { | |
PrintStream loggingStream; | |
ByteArrayOutputStream loggingOutputStream; | |
PrintStream defaultStream; |
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
// Replace the location of the nexus repository with your specific location. | |
// To enable this: gradlew build -I init.gradle | |
// This will now have gradle use the mirrors first and jcenter and other repositories second if it can't find the artifacts. | |
// Make sure your mirror Jcenter in your nexus repository. | |
allprojects{ | |
buildscript{ | |
repositories{ | |
maven{ url 'http://localhost:8081/nexus/content/groups/public' } | |
} |
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
Intent intent = new Intent(Intent.ACTION_OPEN_DOCUMENT); | |
intent.addCategory(Intent.CATEGORY_OPENABLE); | |
intent.setType("*/*"); | |
intent.putExtra(Intent.EXTRA_ALLOW_MULTIPLE, true); | |
// In code that handles the result returned to process the files: | |
ClipData clipData = intent.getClipData(); |
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
# Copyright (c) 2013 Embark Mobile | |
# Modified to work with Eclipse HIPP instance by David Carver | |
# Licensed under the MIT License. | |
# https://github.com/embarkmobile/android-sdk-installer | |
set +e | |
#detecting os | |
os=linux | |
if [[ `uname` == 'Darwin' ]]; then |
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
/** | |
* The MIT License (MIT) | |
* Copyright (c) 2014 David Carver | |
* Permission is hereby granted, free of charge, to any person obtaining | |
* a copy of this software and associated documentation files (the | |
* "Software"), to deal in the Software without restriction, including | |
* without limitation the rights to use, copy, modify, merge, publish, | |
* distribute, sublicense, and/or sell copies of the Software, and to | |
* permit persons to whom the Software is furnished to do so, subject to | |
* the following conditions: |
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
<!-- | |
Include the following snippet in a profile or as part of your standard build. | |
It will parse out the POM version number and then use it to update the | |
version number in your AndroidManfiest.xml. It will also increment the | |
versionCode based on the version number. | |
No more manually having to update the vesion number as part of a release!! Yipee! | |
--> | |
<plugin> |
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.content.SharedPreferences; | |
import android.graphics.Bitmap; | |
import android.graphics.drawable.BitmapDrawable; | |
import android.graphics.drawable.Drawable; | |
import android.graphics.drawable.TransitionDrawable; | |
import android.preference.PreferenceManager; | |
import android.view.View; | |
/** | |
* A runnable that transitions between a drawable and a bitmap. |
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
/* | |
* Verifies that an activities runOnUiThread method is called and that | |
* appropriate class is called. In most cases we don't care about | |
* actually executing the runOnUiThread, just that it got called. | |
* By mocking out the Activity, we can use Mockito's verify method to | |
* make sure the method was called, with the expected Runnable class implementation | |
* passed into it. | |
* | |
* By doing this we avoid having to pause Robolectrics's UIScheduler and BackgroundSchedulers | |
* and then kick off the task. Since in this case it isn't actually necessary to run the code as it |