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
Added in Android Jelly Bean (4.1) - API 16 : | |
Regular (default): | |
<item name="android:fontFamily">sans-serif</item> | |
<item name="android:textStyle">normal</item> | |
Italic: | |
<item name="android:fontFamily">sans-serif</item> | |
<item name="android:textStyle">italic</item> |
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
// Gradle Plugin 2.0+ | |
android { | |
defaultConfig { | |
vectorDrawables.useSupportLibrary = true | |
} | |
} | |
// Gradle Plugin 1.5 | |
android { | |
defaultConfig { |
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
@Rule | |
public ActivityTestRule activityRule = new ActivityTestRule<>( | |
MainActivity.class, | |
true, // initialTouchMode | |
false); // launchActivity. False to set intent per method |
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 someTest() { | |
Intents.init(); | |
onView(withId(R.id.some_id)).perform(click()); | |
Intents.release(); | |
} |
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 shouldSelectImageOnCamera() { | |
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, data); | |
intending(hasAction(MediaStore.ACTION_IMAGE_CAPTURE)).respondWith(result); | |
onView(withId(R.id.camera)).perform(click()); | |
} |
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 void shareImage(String text, Uri imageUri) { | |
Intent shareIntent = new Intent(); | |
shareIntent.setAction(Intent.ACTION_SEND); | |
shareIntent.putExtra(Intent.EXTRA_STREAM, imageUri); | |
shareIntent.setType("image/*"); | |
activity.startActivity(Intent.createChooser(shareIntent, text)); | |
} |
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 shouldShareImageFromGallery() { | |
Instrumentation.ActivityResult result = new Instrumentation.ActivityResult(Activity.RESULT_OK, data); | |
intending(hasAction(Intent.ACTION_CHOOSER)).respondWith(result); | |
onView(withId(R.id.share)).perform(click()); | |
intended(allOf( | |
hasExtras(allOf( |
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 static Intent getCallingIntent(Context context, ArrayList<GalleryPhoto> imagesOnDevice) { | |
Intent intent = new Intent(context, GalleryActivity.class); | |
intent.putParcelableArrayListExtra(EXTRA_IMAGES_ON_DEVICE, imagesOnDevice); | |
return intent; | |
} | |
... | |
@Test | |
public void someTest() { |
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
class SpannableTextView @JvmOverloads constructor( | |
context: Context, | |
attrs: AttributeSet? = null, | |
defStyle: Int = 0 | |
) : TextView(context, attrs, defStyle) { | |
fun setSpannableText(vararg texts: SpannableStyle) { | |
buildWith(breaker = " ", blocks = *texts) | |
} |