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 class SimpleTextWatcher implements TextWatcher { | |
private BeforeTextChanged beforeTextChanged; | |
private OnTextChanged onTextChanged; | |
private AfterTextChanged afterTextChanged; | |
public SimpleTextWatcher(BeforeTextChanged beforeTextChanged) { | |
this.beforeTextChanged = beforeTextChanged; | |
} |
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
val ViewGroup.children: Iterable<View> | |
get() = (0 until childCount).map { getChildAt(it) } | |
// use: | |
linearLayout.children | |
.forEachIndexed { _, view -> | |
view.setOnClickListener {} | |
} |
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.text.Editable | |
import android.text.TextWatcher | |
import android.widget.EditText | |
import kotlin.math.max | |
import kotlin.math.min | |
/** | |
* Класс, предназначенный для форматирования тектового ввода в EditText | |
* @param editText поле ввода символов | |
* @param formatter метод форматирования исходной строки |
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
Dialog(context).apply { | |
setContentView(R.layout.dialog) | |
window?.setBackgroundDrawableResource(R.drawable.bg_dialog) | |
findViewById<ImageView>(R.id.ivClose).setOnClickListener { dismiss() } | |
findViewById<Button>(R.id.btnTry).setOnClickListener { dismiss() } | |
}.show() |
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.util.Log | |
fun Any?.printToLog(tag: String = "DEBUG_LOG") { | |
Log.d(tag, toString()) | |
} |
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.view.View | |
fun View.gone() = run { visibility = View.GONE } | |
fun View.visible() = run { visibility = View.VISIBLE } | |
fun View.invisible() = run { visibility = View.INVISIBLE } | |
infix fun View.visibleIf(condition: Boolean) = | |
run { visibility = if (condition) View.VISIBLE else View.GONE } |
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 | |
fun `$TestDescription$`() { | |
// ARRANGE | |
val sut: $TestModule$ = $TestModule$($Parameters$) | |
$END$ | |
// ACTION | |
// CHECK | |
} |
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
@Mock | |
private var $variable$: $variableType$ |
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
@RunWith(JUnit4::class) | |
class $TestClassName$Test { | |
@get:Rule | |
val mockitoRule: MockitoRule = MockitoJUnit.rule() | |
@Before | |
fun setUp() { | |
} |
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
sudo reflector --verbose -l 5 -p https --sort rate --save /etc/pacman.d/mirrorlist && sudo pacman -Syyu |
OlderNewer