I hereby claim:
- I am ditn on github.
- I am ditn (https://keybase.io/ditn) on keybase.
- I have a public key ASDV52_00ivgIYPfFgWITbZmwdNHhnc2JMPd8nOigAy1Xwo
To claim this, I am signing this object:
Verifying that "iateyourmic.id" is my Blockstack ID. https://onename.com/iateyourmic |
I hereby claim:
To claim this, I am signing this object:
fun printString(string: String) = println(string) | |
/** | |
* Prints successfully | |
*/ | |
Observable.just("Test string") | |
.doOnNext{ printString(it) } | |
.subscribe() |
<?xml version="1.0" encoding="utf-8"?> | |
<font-family xmlns:app="http://schemas.android.com/apk/res-auto" | |
app:fontProviderAuthority="com.google.android.gms.fonts" | |
app:fontProviderPackage="com.google.android.gms" | |
app:fontProviderQuery="Montserrat" | |
app:fontProviderCerts="@array/com_google_android_gms_fonts_certs"> | |
</font-family> |
fun loadFont(context: Context, font: CustomFont, func: (Typeface) -> Unit) { | |
val handlerThread = HandlerThread("fonts").apply { start() } | |
val handler = Handler(handlerThread.looper) | |
val request = FontRequest( | |
"com.google.android.gms.fonts", | |
"com.google.android.gms", | |
font.query, | |
R.array.com_google_android_gms_fonts_certs | |
) |
/** | |
* Loads a font via the Support Library downloadable font system and applies it to a TextView. If this | |
* function fails, it will do so silently. | |
* | |
* @param customFont A [CustomFont] object that encapsulates the query to be sent to the fonts provider | |
*/ | |
fun TextView.setCustomFont(customFont: CustomFont) { | |
loadFont(context, customFont) { | |
this.typeface = it | |
} |
class ExampleTest { | |
@Mock private var subject: ClassToTest? | |
@Before | |
fun setUp() { | |
MockitoAnnotations.initMocks(this) | |
} | |
@Test |
class ExampleTest { | |
private val subject: ClassToTest = mock() | |
@Test | |
fun `verify this causes that`() { | |
// Arrange | |
val aValue = 10 | |
whenever(mockedClass.getValue()).thenReturn(aValue) | |
// Act |
val builder = NotificationCompat.Builder(context, NOTIFICATION_CHANNEL_ID) | |
.setSmallIcon(icon) | |
// Excluded for brevity | |
.setContentText(text) | |
if (AndroidUtils.is19orHigher()) { | |
builder.setVibrate(longArrayOf(100)) | |
} else { | |
builder.setVibrate(longArrayOf()) | |
} |
private fun NotificationCompat.Builder.ternaryBuilder( | |
predicate: () -> Boolean, | |
trueFunc: NotificationCompat.Builder.() -> NotificationCompat.Builder, | |
falseFunc: NotificationCompat.Builder.() -> NotificationCompat.Builder | |
): NotificationCompat.Builder = if (predicate()) this.trueFunc() else this.falseFunc() |