View MockkAndroidLog.kt
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
// JUnit5 test extension | |
// | |
// usage: | |
// | |
// @ExtendWith(MockkAndroidLog::class) | |
// class TestClass { | |
// ... | |
// } | |
import android.util.Log | |
import io.mockk.clearStaticMockk |
View DisableAnimationsRule.kt
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
package com.orderbird.testing | |
import android.app.Activity | |
import androidx.test.ext.junit.rules.ActivityScenarioRule | |
import androidx.test.platform.app.InstrumentationRegistry | |
import androidx.test.uiautomator.UiDevice | |
import com.orderbird.testing.AnimationScaleSettings.disableAnimations | |
import com.orderbird.testing.AnimationScaleSettings.restoreAnimations | |
import org.junit.rules.RuleChain | |
import org.junit.rules.TestRule |
View Brewfile
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
cask_args appdir: "/Applications" | |
# Apps | |
cask "google-chrome" |
View AssetsMocksHttpClient.kt
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
package com.example.android.testing.blueprint | |
import android.content.res.AssetManager | |
import okhttp3.Interceptor | |
import okhttp3.MediaType.Companion.toMediaType | |
import okhttp3.OkHttpClient | |
import okhttp3.Protocol | |
import okhttp3.Request | |
import okhttp3.Response | |
import okhttp3.ResponseBody.Companion.toResponseBody |
View FindViewKtx.kt
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.app.Activity | |
import android.view.View | |
import androidx.annotation.IdRes | |
import androidx.fragment.app.Fragment | |
fun <T : View> Activity.findView(@IdRes res : Int) : Lazy<T> { | |
@Suppress("UNCHECKED_CAST") | |
return lazy(LazyThreadSafetyMode.NONE){ findViewById<T>(res) } | |
} |
View DiffUtilKtx.kt
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 androidx.recyclerview.widget.DiffUtil | |
import kotlin.reflect.KProperty1 | |
@Suppress("NOTHING_TO_INLINE") | |
inline fun <T : Any, R: Any> byProperty(kProperty: KProperty1<T, R>): (T, T) -> Boolean = | |
{ old, new -> kProperty.get(old) == kProperty.get(new) } | |
@Suppress("FunctionName") | |
inline fun <T : Any> DiffItemCallback( | |
crossinline areItemsTheSame: (T, T) -> Boolean, |
View DiffObservableListKtx.kt
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 androidx.databinding.ObservableList | |
import androidx.recyclerview.widget.DiffUtil | |
import me.tatarka.bindingcollectionadapter2.collections.AsyncDiffObservableList | |
import me.tatarka.bindingcollectionadapter2.collections.DiffObservableList | |
@Suppress("NOTHING_TO_INLINE", "FunctionName") | |
inline fun <T : Any> DiffObservableList( | |
itemCallback: DiffUtil.ItemCallback<T>, | |
async: Boolean = true | |
): DiffList<T> = |
View DatePickerBindingAdapter.kt
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
@BindingAdapter("date") | |
fun setDate(datePicker: DatePicker, value: LocalDate) { | |
if (value != LocalDate.of(datePicker.year, datePicker.month + 1, datePicker.dayOfMonth)) { | |
datePicker.updateDate(value.year, value.monthValue - 1, value.dayOfMonth) | |
} | |
} | |
@BindingAdapter(value = ["dateAttrChanged", "onDateChanged"], requireAll = false) | |
fun setDateChangeListener( | |
datePicker: DatePicker, |
View CalendarKtx.kt
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
private inline val Calendar.year: Int | |
get() = get(Calendar.YEAR) | |
private inline val Calendar.month: Int | |
get() = get(Calendar.MONTH) | |
private inline val Calendar.day: Int | |
get() = get(Calendar.DAY_OF_MONTH) |
View ic_android_black_24dp.xml
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
<vector xmlns:android="http://schemas.android.com/apk/res/android" | |
android:width="24dp" | |
android:height="24dp" | |
android:tint="?attr/colorControlNormal" | |
android:viewportHeight="24.0" | |
android:viewportWidth="24.0"> | |
<path | |
android:fillColor="#ff000000" | |
android:pathData="M6,18c0,0.55 0.45,1 1,1h1v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L11,19h2v3.5c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5L16,19h1c0.55,0 1,-0.45 1,-1L18,8L6,8v10zM3.5,8C2.67,8 2,8.67 2,9.5v7c0,0.83 0.67,1.5 1.5,1.5S5,17.33 5,16.5v-7C5,8.67 4.33,8 3.5,8zM20.5,8c-0.83,0 -1.5,0.67 -1.5,1.5v7c0,0.83 0.67,1.5 1.5,1.5s1.5,-0.67 1.5,-1.5v-7c0,-0.83 -0.67,-1.5 -1.5,-1.5zM15.53,2.16l1.3,-1.3c0.2,-0.2 0.2,-0.51 0,-0.71 -0.2,-0.2 -0.51,-0.2 -0.71,0l-1.48,1.48C13.85,1.23 12.95,1 12,1c-0.96,0 -1.86,0.23 -2.66,0.63L7.85,0.15c-0.2,-0.2 -0.51,-0.2 -0.71,0 -0.2,0.2 -0.2,0.51 0,0.71l1.31,1.31C6.97,3.26 6,5.01 6,7h12c0,-1.99 -0.97,-3.75 -2.47,-4.84zM10,5L9,5L9,4h1v1zM15,5h-1L14,4h1v1z" /> | |
</vector> |
NewerOlder