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.javarush.task.task18.task1809; | |
/* | |
Реверс файла | |
*/ | |
import java.io.BufferedReader; | |
import java.io.FileInputStream; | |
import java.io.FileOutputStream; | |
import java.io.InputStreamReader; |
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.javarush.task.task18.task1821; | |
/* | |
Встречаемость символов | |
*/ | |
import java.io.FileInputStream; | |
import java.util.Map; | |
import java.util.TreeMap; |
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.Window | |
import android.view.WindowManager | |
import android.view.WindowManager.LayoutParams.SOFT_INPUT_STATE_UNSPECIFIED | |
import androidx.lifecycle.Lifecycle | |
import androidx.lifecycle.LifecycleObserver | |
import androidx.lifecycle.OnLifecycleEvent | |
fun Window?.getSoftInputMode(): Int { | |
return this?.attributes?.softInputMode ?: SOFT_INPUT_STATE_UNSPECIFIED | |
} |
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.os.Bundle | |
import android.util.Log | |
import androidx.appcompat.app.AppCompatActivity | |
import androidx.lifecycle.lifecycleScope | |
import kotlinx.android.synthetic.main.activity_main.* | |
import kotlinx.coroutines.Dispatchers | |
import kotlinx.coroutines.ExperimentalCoroutinesApi | |
import kotlinx.coroutines.FlowPreview | |
import kotlinx.coroutines.InternalCoroutinesApi | |
import kotlinx.coroutines.channels.BroadcastChannel |
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 com.redmadrobot.inputmask.MaskedTextChangedListener | |
import com.redmadrobot.inputmask.helper.AffinityCalculationStrategy | |
import com.redmadrobot.inputmask.model.Notation | |
class NonRemovePrefixTextChangedListener( | |
primaryFormat: String, | |
affineFormats: List<String> = emptyList(), |
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 const val REPO_DEFAULT_RETRY_COUNT = 5 // 62 sec total ~1 min | |
private val zipper = BiFunction { t: Throwable, u: Int -> Pair(t, u) } | |
fun Completable.networkStateRetry(retryAttempts: Int = REPO_DEFAULT_RETRY_COUNT): Completable = | |
retryWhen { | |
// retryAttempts + 1 для того чтобы была выброшена ошибка | |
it.zipWith(Flowable.range(1, retryAttempts + 1), zipper) | |
.flatMap { result -> | |
val delayTime = 1L * 2.0.pow(result.second.toDouble()).roundToLong() | |
return@flatMap ( |
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.content.Context | |
import android.util.AttributeSet | |
import android.view.ViewTreeObserver | |
import androidx.cardview.widget.CardView | |
import ru.dpd.core.extension.getViewVisibilityPercent | |
class PercentVisibleCardView @JvmOverloads constructor( | |
context: Context, attrs: AttributeSet? = null | |
) : CardView(context, attrs) { |
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
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" | |
package="appPackage"> | |
<application | |
android:name=".app.App" | |
android:allowBackup="true" | |
android:icon="@mipmap/ic_launcher" | |
android:label="@string/app_name" | |
android:networkSecurityConfig="@xml/network_security_config" |
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.annotation.SuppressLint | |
import android.net.ConnectivityManager | |
import android.net.Network | |
import android.net.NetworkCapabilities | |
import android.net.NetworkRequest | |
import android.os.Build | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.channels.BufferOverflow | |
import kotlinx.coroutines.flow.Flow | |
import kotlinx.coroutines.flow.MutableSharedFlow |
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.annotation.SuppressLint | |
import android.net.ConnectivityManager | |
import android.net.Network | |
import android.net.NetworkCapabilities | |
import android.net.NetworkRequest | |
import android.os.Build | |
import io.reactivex.rxjava3.core.Observable | |
import io.reactivex.rxjava3.subjects.BehaviorSubject | |
import timber.log.Timber | |
import java.util.concurrent.atomic.AtomicInteger |
OlderNewer