🤵♂️
This file contains hidden or 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.animation.Animator | |
| import android.animation.ObjectAnimator | |
| import android.animation.ValueAnimator.AnimatorUpdateListener | |
| import android.content.Context | |
| import android.content.res.Resources | |
| import androidx.core.widget.NestedScrollView | |
| import android.util.AttributeSet | |
| import android.util.Log | |
| import android.view.MotionEvent | |
| import android.view.View |
This file contains hidden or 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 me.raghu.mvpassignment.util | |
| import androidx.recyclerview.widget.DiffUtil | |
| import androidx.recyclerview.widget.ListUpdateCallback | |
| import androidx.recyclerview.widget.RecyclerView | |
| import kotlinx.coroutines.* | |
| import kotlinx.coroutines.channels.Channel.Factory.CONFLATED | |
| import kotlinx.coroutines.channels.actor | |
| import java.util.* |
This file contains hidden or 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
| // edit /home/.bashrc and add the following lines | |
| JAVA_HOME='/home/raghu/jdk1.8.0_241' | |
| export JAVA_HOME | |
| export PATH=$PATH:$JAVA_HOME/bin | |
| FLUTTER_HOME='/home/raghu/flutter' | |
| export FLUTTER_HOME | |
| export PATH=$PATH:$FLUTTER_HOME/bin | |
| ANDROID_SDK_ROOT='/home/raghu/Android/Sdk' |
This file contains hidden or 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
| suspend fun <T> retryIO( | |
| times: Int = Int.MAX_VALUE, | |
| initialDelay: Long = 100, // 0.1 second | |
| maxDelay: Long = 1000, // 1 second | |
| factor: Double = 2.0, | |
| block: suspend () -> T): T | |
| { | |
| var currentDelay = initialDelay | |
| repeat(times - 1) { | |
| try { |
This file contains hidden or 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 InputStreamRequestBody extends RequestBody { | |
| private final MediaType contentType; | |
| private final ContentResolver contentResolver; | |
| private final Uri uri; | |
| public InputStreamRequestBody(MediaType contentType, ContentResolver contentResolver, Uri uri) { | |
| if (uri == null) throw new NullPointerException("uri == null"); | |
| this.contentType = contentType; | |
| this.contentResolver = contentResolver; | |
| this.uri = uri; |
This file contains hidden or 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
| inline fun <refied T: Any> Context.openActivity(noinline init: Intent.()-> Unit = {}){ | |
| val intent == newIntent<T>(this) | |
| intent.init() | |
| startActivity(intent) | |
| } | |
| inline <refied T: Any> fun newIntent(context: Context): Int{ | |
| Intent(context.T::class.kava) |
This file contains hidden or 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.content.Context | |
| import android.graphics.* | |
| import android.util.AttributeSet | |
| import android.view.View | |
| import androidx.core.content.ContextCompat | |
| import bg.dihanov.customviewexamples.R | |
| import bg.dihanov.customviewexamples.px | |
| import kotlin.math.max | |
| import kotlin.math.min |
This file contains hidden or 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
| flow<String> { | |
| // suspending call here | |
| emit("Foo") | |
| } | |
| .onStart { // show loading } | |
| .onCompletion { // hide loading } | |
| .catch { // exception handling } | |
| .onEach { // equivalent to rx onNext } | |
| .launchIn(yourScope) |
This file contains hidden or 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
| # Add a new remote upstream repository | |
| git remote add upstream https://github.com/ORIGINAL_OWNER/ORIGINAL_REPOSITORY.git | |
| # Sync your fork | |
| git fetch upstream | |
| git checkout master | |
| git merge upstream/master |