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
// | |
// SheetState.swift | |
// | |
// Created by Ariful Jannat Arif on 11/30/23. | |
// | |
import SwiftUI | |
/// A generic type representing a boolean value that can also hold associated data of type `T`. | |
struct SheetState<T: Equatable>: DynamicProperty, Equatable { |
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.viewbinding.ViewBinding | |
abstract class BaseObservableFragment<V : ViewBinding, ListenerType>(inflater: Inflate<V>) : | |
BaseFragment<V>(inflater) { | |
private val listeners = hashSetOf<ListenerType>() | |
fun notify(data: (ListenerType) -> Unit) { |
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
fun View.animateView(xTranslate: Float = 0f, yTranslate: Float = 0f, endAlpha: Float = 0f, duration: Long = 300, onEnd: (() -> Unit)? = null) = | |
try { | |
val listener = object : Animator.AnimatorListener { | |
override fun onAnimationStart(p0: Animator?) { | |
} | |
override fun onAnimationEnd(p0: Animator?) { | |
onEnd?.invoke() |
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.view.LayoutInflater | |
import android.view.View | |
import android.view.ViewGroup | |
import androidx.activity.OnBackPressedCallback | |
import androidx.fragment.app.Fragment | |
import androidx.viewbinding.ViewBinding | |
typealias Inflate<T> = (LayoutInflater, ViewGroup?, Boolean) -> 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.util.Log | |
import com.google.firebase.remoteconfig.FirebaseRemoteConfig | |
import kotlin.math.max | |
object RcConfig { | |
private val remoteConfig: FirebaseRemoteConfig = FirebaseRemoteConfig.getInstance() | |
init { | |
remoteConfig.setDefaultsAsync(getRemoteDefaults()) |
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
sealed class ResultData<out T> { | |
object Loading : ResultData<Nothing>() | |
data class Success<out T>(val data: T) : ResultData<T>() | |
data class Error(val throwable: Exception? = null, val message: String? = null) : | |
ResultData<Nothing>() | |
fun isLoading() = this is Loading | |
fun isSuccess() = this is Success | |
fun isError() = this is Error | |
} |
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.Log | |
import com.google.gson.Gson | |
import java.io.File | |
class ModelPersistHelper<T>( | |
private val context: Context, | |
private val gson: Gson, | |
private val clazz: Class<T> |