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 org.gradle.api.Project | |
// Create the BOM file | |
val bomFile = project.file("dependencies.bom") | |
// Get all dependencies of the project | |
val dependencies = project.configurations.getByName("implementation").allDependencies | |
// Write the dependencies to the BOM file | |
bomFile.writeText(dependencies.joinToString("\n")) |
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
/** | |
* Made by cbedoy | |
*/ | |
val dimenRatio = mapOf( | |
"mdp" to .8F, "hdp" to .9f, "xhdp" to 1f, "xxhdp" to 1.1f, "xxxhdp" to 1.2f | |
) | |
fun generate(n: Int) { | |
dimenRatio.map { |
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 FancyUseCase (private val serviceOrAnyDataLayer: Something){ | |
operator fun invoke(number: String) = flow { | |
when(val response = serviceOrAnyDataLayer.requestAny()) { | |
is Success -> { | |
emit("Yeah") | |
} | |
else -> { | |
emit("Damit") | |
} | |
} |
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
open class BaseDialog : DialogFragment() { | |
override fun onCreate(savedInstanceState: Bundle?) { | |
setStyle(STYLE_NO_TITLE, R.style.DialogTheme) | |
super.onCreate(savedInstanceState) | |
} | |
override fun onStart() { | |
super.onStart() | |
dialog?.window?.setWindowAnimations(R.style.DialogAnimation) |
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
// KTlint report | |
scripts/gatekeeper/ktlint -v "**/src/**/*.kt" -a --relative --reporter=plain --reporter=checkstyle | |
// Ktlint fix format | |
scripts/gatekeeper/ktlint -F | |
// Git rebase | |
git rebase -i HEAD~N | |
// Changelog |
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
@Parcelize | |
data class MessageRepresentation( | |
val title : String = "", | |
val description: String = "", | |
val boldDescriptionComponents: List<String> = emptyList(), | |
val backgroundResource: Int = 0, | |
val imageResource: Int = 0, | |
val progressBar: MessageRepresentationProgress = MessageRepresentationProgress(), | |
..... | |
) : 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
class NewServiceViewModel2 ( | |
private val useCase: NewServiceUseCase) : BaseMVIViewModel<NewServiceState, NewServiceIntent>( | |
initialState = NewServiceState.IldeState | |
) { | |
override val TAG: String | |
get() = "NewServiceViewModel" | |
override suspend fun onCollect(intent: NewServiceIntent, producer: suspend (Flow<NewServiceState>) -> Unit) { | |
when(intent){ | |
is NewServiceIntent.LoadProducts -> { |
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
typealias Producer<T> = suspend (Flow<T>) -> Unit | |
abstract class BaseMVIViewModel<State, Intent>( | |
initialState: State | |
) : ViewModel(){ | |
private val intentChannel = Channel<Intent>(Channel.UNLIMITED) | |
private var _state = MutableStateFlow(initialState) | |
open val state: StateFlow<State> | |
get() = _state |
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 NewServiceUseCase( | |
private val repository: NewServiceRepository | |
){ | |
val loadProducts = flow { | |
emit(ShowLoader) | |
when(val response = repository.loadProducts){ | |
is Success -> { | |
emit(ReloadProducts(response.preparedProducts)) | |
} | |
else -> { |
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 NewServiceViewModel( | |
private val useCase: NewServiceUseCase | |
): ViewModel { | |
private val _state: MutableStateFLow<NewServiceState>(NewServiceState.IldeState) | |
val state: StateFlow<NewServiceState> get() = _cart | |
suspend fun handleIntents(intent: NewServiceIntent){ | |
when(intent){ | |
is LoadProductsIntent -> { |
NewerOlder