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.os.SystemClock; | |
import com.android.volley.Cache; | |
import com.android.volley.VolleyLog; | |
import java.io.BufferedInputStream; | |
import java.io.BufferedOutputStream; | |
import java.io.EOFException; | |
import java.io.File; | |
import java.io.FileInputStream; |
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.support.test.espresso.NoMatchingViewException; | |
import android.support.test.espresso.ViewAssertion; | |
import android.support.v7.widget.RecyclerView; | |
import android.view.View; | |
import com.google.common.truth.Truth; | |
import java.util.ArrayList; | |
import org.hamcrest.Matcher; | |
import org.junit.Assert; |
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
/** | |
* An Espresso ViewAction that changes the orientation of the screen | |
*/ | |
public static class OrientationChangeAction implements ViewAction { | |
private final int orientation; | |
private OrientationChangeAction(int orientation) { | |
this.orientation = orientation; | |
} |
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
String[] nameProjection = new String[] { | |
ContactsContract.CommonDataKinds.StructuredName.GIVEN_NAME, | |
ContactsContract.CommonDataKinds.StructuredName.FAMILY_NAME | |
}; | |
final Cursor nameCursor = context.getContentResolver() | |
.query(ContactsContract.Data.CONTENT_URI, nameProjection, | |
ContactsContract.Data.LOOKUP_KEY + " = ? AND "+ ContactsContract.Data.MIMETYPE + " = ? ", | |
new String[] { contactLookupKey, ContactsContract.CommonDataKinds.StructuredName.CONTENT_ITEM_TYPE }, | |
null, null); |
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 random | |
colours_in_order = 'Red White Blue'.split() | |
def dutch_flag_sort(items): # O(n) time, O(1) space | |
lo, mid, hi = 0, 0, len(items) - 1 | |
while mid <= hi: | |
colour = items[mid] | |
if colour == 'Red': |