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 | |
import androidx.compose.runtime.Composable | |
import androidx.compose.ui.Modifier | |
import androidx.compose.ui.platform.ComposeView | |
import androidx.compose.ui.viewinterop.AndroidView | |
@Composable | |
fun SoftwareLayerComposable( | |
modifier: Modifier = Modifier, |
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.graphics.Bitmap | |
import com.facebook.common.references.CloseableReference | |
import com.facebook.imagepipeline.bitmaps.PlatformBitmapFactory | |
import com.facebook.imagepipeline.request.BasePostprocessor | |
class CombinePostProcessors( | |
private val processors: List<BasePostprocessor> | |
) : BasePostprocessor() { |
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
/** | |
* A function that wraps another suspend function for exponential retry | |
* | |
* @param count number of retires | |
* @param initialDelay millis between retries | |
* @param maxDelay max millis of delay from exponential backoff strategy | |
* @param factor delay multiplier | |
* @param predicate true — need continue retries, false — rethrows Throwable to caller | |
* @param block function to execute | |
* |
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
// ======================= WINDOW INSETS ======================= | |
fun View.addSystemTopPadding( | |
targetView: View = this, | |
isConsumed: Boolean = false | |
) { | |
doOnApplyWindowInsets { _, insets, initialPadding -> | |
targetView.updatePadding( | |
top = initialPadding.top + insets.systemWindowInsetTop | |
) |
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.widget.FrameLayout | |
import androidx.core.view.ViewCompat | |
import androidx.core.view.WindowInsetsCompat | |
/** | |
* Before adding this: | |
* 1. In AndroidManifest in your <activity/> tag android:windowSoftInputMode="adjustResize" | |
* 2. Enable "EDGE-TO-EDGE" mode in your activity -> window.decorView.systemUiVisibility = decorView.systemUiVisibility or (View.SYSTEM_UI_FLAG_LAYOUT_HIDE_NAVIGATION or View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN or View.SYSTEM_UI_FLAG_LAYOUT_STABLE) |