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 { Pipe, PipeTransform } from '@angular/core'; | |
@Pipe({ | |
name: 'dynamicFilter' | |
}) | |
export class DynamicFilterPipe implements PipeTransform { | |
transform(items: any[], filter: any): any[] { | |
if (!items || !filter) { | |
return items; |
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.Color; | |
import android.graphics.LinearGradient; | |
import android.graphics.Paint; | |
import android.graphics.Rect; | |
import android.graphics.Shader; | |
import android.text.Layout; | |
import android.widget.TextView; | |
public class GradientTextViewUtil { |
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.Handler; | |
import androidx.lifecycle.LiveData; | |
import androidx.lifecycle.MediatorLiveData; | |
import androidx.lifecycle.Observer; | |
public class DebouncedLiveData<T> extends MediatorLiveData<T> { | |
private LiveData<T> mSource; | |
private int mDuration; |
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 androidx.paging.PageKeyedDataSource | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.launch | |
import kotlin.coroutines.CoroutineContext | |
abstract class CoroutinePageKeyedDataSource<K, V>(private val coroutineContext: CoroutineContext) : | |
PageKeyedDataSource<K, V>() { | |
private val job = Job() |
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 androidx.lifecycle.LiveData | |
import androidx.lifecycle.MediatorLiveData | |
import kotlinx.coroutines.CoroutineScope | |
import kotlinx.coroutines.Job | |
import kotlinx.coroutines.delay | |
import kotlinx.coroutines.launch | |
fun <T> LiveData<T>.debounce(duration: Long = 1000L, coroutineScope: CoroutineScope) = MediatorLiveData<T>().also { mld -> | |
val source = this |