Skip to content

Conversation

@LearnJava
Copy link
Owner

No description provided.

val ticker: StateFlow<String> = mutableTicker

fun start(){
if (job == null) startJob()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

проверять на нул не надо

}

private fun startJob() {
scope.launch {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Вот тут нужно присваивать это все в переменную job и перед запускам не забывать отменять, конечно, если того требует логика



private fun stopJob() {
scope.coroutineContext.cancelChildren()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут нужно отменять конкретную Job


private fun stopJob() {
scope.coroutineContext.cancelChildren()
job = null

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

занулять не надо

class TimestampMillisecondsFormatter {

fun format(timestamp: Long): String {
val millisecondsFormatted = (timestamp % 1000).pad(3)

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

multiple magic numbers🧙‍🧙‍🧙‍

android:id="@+id/button_start"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="30dp"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Размеры нужно хранить в R.dimen

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants