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
class Fragment() { | |
private fun initViews() = with(binding) { | |
pager.setPageTransformer { page, pos -> | |
if (pos == 0.0F) { | |
updatePagerHeightForChild(page, pager) | |
} | |
} | |
} |
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
internal class SavedState : BaseSavedState { | |
var isExpanded: Boolean = false | |
constructor(superState: Parcelable) : super(superState) | |
constructor(source: Parcel) : super(source) { | |
isExpanded = source.readBoolean() | |
} | |
constructor(source: Parcel?, loader: ClassLoader?) : super(source, loader) |
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.Intent | |
import android.os.Bundle | |
import android.os.Parcelable | |
import timber.log.Timber | |
import java.io.Serializable | |
inline fun <reified T : Parcelable> Bundle.putWithClassNameKey(parcelable: T?) { | |
parcelable?.let { putParcelable(T::class.java.simpleName, parcelable) } | |
} |
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.os.Parcelable | |
import java.io.Serializable | |
import androidx.fragment.app.Fragment | |
import kotlin.properties.ReadWriteProperty | |
import kotlin.reflect.KProperty | |
class FragmentArgumentDelegate<T : Any> : | |
ReadWriteProperty<Fragment, T> { |
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.ContentValues | |
import android.graphics.Bitmap | |
import android.os.Build | |
import android.provider.MediaStore | |
import androidx.fragment.app.Fragment | |
import timber.log.Timber | |
import java.io.IOException | |
/** |
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 |
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
<?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.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
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 ( |
NewerOlder