Skip to content

Instantly share code, notes, and snippets.

View xanderblinov's full-sized avatar

Alexander Blinov xanderblinov

View GitHub Profile
Team : Перцы
List :
- Не забыть
- Не забить
private const val WAITER_TIMEOUT_S: Long = 10L
private const val WAITER_FREQUENCY_MS: Long = 50L
private const val VISIBLE_EXCEPTION = "'view has effective visibility=VISIBLE' doesn't match the selected view."
fun KRecyclerView.waitForChildVisible(position: Int, timeoutS: Long = WAITER_TIMEOUT_S) {
doWaitForMatchingView(timeoutS) {
childAt<KRecyclerItem<Unit>>(position) {
isVisible()
@xanderblinov
xanderblinov / RecyclerExtentions.kt
Created May 8, 2019 13:25
Pagination extantion for Kakao test
fun RecyclerActions.scrollToEndWithPagination() {
scrollToEnd()
view.perform(ViewActions.swipeUp())
}
fun <T : KRecyclerItem<T>> KRecyclerView.paginateUntilChildMatching(
childMatcher: ViewBuilder.() -> Unit,
timeoutS: Long = WAITER_TIMEOUT_S) {
while (true) {
{
    "items": [
        {
            "experiment_name": "short_builder_in_app",
            "user_is_affected": true,
            "paramteter" : 
            {
              "backurl": "/vacancies",
 "source" : 17
@xanderblinov
xanderblinov / HashSetUnitTest.kt
Last active February 10, 2018 11:04
HashSet and modifiable objects example
package com.test.hashset
import org.junit.Assert.assertFalse
import org.junit.Assert.assertTrue
import org.junit.Test
class HashSetUnitTest {
class Some(var a: Int, var b: Int) {
override fun equals(other: Any?): Boolean {
@xanderblinov
xanderblinov / App.kt
Created February 5, 2017 10:11
Component Dependency Injection
class App : Application() {
override fun onCreate() {
super.onCreate()
MvpFacade.init()
DI.init(this)
}
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_address_search_manual)
val address = intent.getSerializableExtra(KEY_BUNDLE_ADDRESS) as Address?
getPresenter().init(address, intent.getBooleanExtra(KEY_BUNDLE_WAITING_FOR_RESULT, false))
initViews()
}
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_address_search_manual)
val address = intent.getSerializableExtra(KEY_BUNDLE_ADDRESS) as Address?
getPresenter().init(address, intent.getBooleanExtra(KEY_BUNDLE_WAITING_FOR_RESULT, false))
initViews()
}
@xanderblinov
xanderblinov / MvpFragment
Created November 26, 2016 10:15
How to prevent Moxy's delegate onDestroy call of fragment in backstack while configuration changing.
public void onDestroy() {
super.onDestroy();
boolean anyParentIsRemoving = false;
for (Fragment parent = this.getParentFragment(); !anyParentIsRemoving && parent != null;
parent = parent.getParentFragment()) {
anyParentIsRemoving = parent.isRemoving();
}