-
Notifications
You must be signed in to change notification settings - Fork 0
Homework 4 #1
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Homework 4 #1
Conversation
| val ticker: StateFlow<String> = mutableTicker | ||
|
|
||
| fun start(){ | ||
| if (job == null) startJob() |
There was a problem hiding this comment.
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 { |
There was a problem hiding this comment.
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() |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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) |
There was a problem hiding this comment.
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" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Размеры нужно хранить в R.dimen
No description provided.