Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View Popalay's full-sized avatar
🇺🇦

Denys Nykyforov Popalay

🇺🇦
View GitHub Profile
-
алярмово: швидко, негайно, терміново
андрути: вафлі
аусвайс: пропуск, посвідчення
афини: чорниця
ашош: звичайно
баба: гора, височина, великодня паска
багна: болото, волога місцевість
багрівка: смерекова смола
бадилля: сухі стебла рослин
{
"$schema": "https://raw.githubusercontent.com/jsonresume/resume-schema/v1.0.0/schema.json",
"basics": {
"name": "Denys Nykyforov",
"label": "Software Engineer",
"image": "",
"email": "popalay1@gmail.com",
"phone": "+38 (066) 527-82-43",
"url": "",
"summary": "A forward-thinking developer offering more than seven years of experience in designing, building, testing and supporting Android applications. Adaptable and able to quickly pick up new techniques. Having much experience of creating solutions to complex problems.",
class Solution {
public List<List<Integer>> combinationSum(int[] candidates, int target) {
return new ArrayList<>(findComb(candidates, target));
}
Set<List<Integer>> findComb(int[] candidates, int target){
Set<List<Integer>> result = new HashSet<List<Integer>>();
for(int i = 0; i < candidates.length; i++){
if(candidates[i] == target){
@Popalay
Popalay / DecimalDigitsInputFilter
Created July 23, 2019 10:06
Set limit of digits after decimal point
class DecimalDigitsInputFilter(val decimalDigits: Int) : InputFilter {
override fun filter(source: CharSequence, start: Int, end: Int, dest: Spanned, dstart: Int, dend: Int): CharSequence? =
if (dstart > dest.indexOf('.') &&
dest.toString().substringAfter('.', "").length > decimalDigits - 1
) "" else null
}
@Popalay
Popalay / PrefixInputFilter
Created July 23, 2019 10:05
Set static prefix
class PrefixInputFilter(private val prefix: String) : InputFilter {
override fun filter(source: CharSequence, start: Int, end: Int, dest: Spanned?, dstart: Int, dend: Int): CharSequence? {
val newStart = max(prefix.length, dstart)
val newEnd = max(prefix.length, dend)
return if (newStart != dstart || newEnd != dend) {
val builder = SpannableStringBuilder(dest)
builder.replace(newStart, newEnd, source)
if (source is Spanned) {
TextUtils.copySpansFrom(source, 0, source.length, null, builder, newStart)
@Popalay
Popalay / UnselectablePrefixSpanWatcher
Last active July 23, 2019 10:04
Set unselectable part of text:
import android.text.Selection
import android.text.SpanWatcher
import android.text.Spannable
import kotlin.math.max
class UnselectablePrefixSpanWatcher(private val prefix: String) : SpanWatcher {
override fun onSpanAdded(text: Spannable, what: Any, start: Int, end: Int) = Unit
override fun onSpanRemoved(text: Spannable, what: Any, start: Int, end: Int) = Unit
@Popalay
Popalay / UnselectablePrefixSpanWatcher
Created July 23, 2019 10:04
Set un selectable part of text:
import android.text.Selection
import android.text.SpanWatcher
import android.text.Spannable
import kotlin.math.max
class UnselectablePrefixSpanWatcher(private val prefix: String) : SpanWatcher {
override fun onSpanAdded(text: Spannable, what: Any, start: Int, end: Int) = Unit
override fun onSpanRemoved(text: Spannable, what: Any, start: Int, end: Int) = Unit
import android.animation.Animator
import android.animation.AnimatorListenerAdapter
import android.animation.AnimatorSet
import android.animation.ObjectAnimator
import android.annotation.TargetApi
import android.graphics.Outline
import android.graphics.Rect
import android.os.Build
import android.transition.Transition
import android.transition.TransitionValues
@Popalay
Popalay / View
Created July 21, 2017 10:34
KotlinSample
import android.arch.lifecycle.ViewModelProvider
import android.arch.lifecycle.ViewModelProviders
import android.content.Context
import android.content.Intent
import android.databinding.DataBindingUtil
import android.graphics.Color
import android.os.Bundle
import android.view.View
import com.popalay.cardme.R
import com.popalay.cardme.databinding.ActivityHolderDetailsBinding
private void refitText(String text, int textWidth) {
if (textWidth <= 0) {
return;
}
final int targetWidth = textWidth - getPaddingLeft() - getPaddingRight();
float hi = 1f;
float lo = 0f;
float textWidthCalculated;
while (hi - lo > 0.1) {