Skip to content
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

Improve score widget #106

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open

Improve score widget #106

wants to merge 6 commits into from

Conversation

mdrlzy
Copy link
Member

@mdrlzy mdrlzy commented Sep 17, 2024

Replace old score view with plain arrows with new one with animations

Before

scorewidgetold

After

scorewidgetnew.mp4

@tuancoltech
Copy link
Collaborator

@mdrlzy Could you brief which improvements were made in this PR?
Thanks.

implementation(libraries.arklib)
implementation(libraries.orbit.mvi.viewmodel)
implementation(libs.orbit.mvi.compose)
implementation("com.github.mdrlzy:ComposeCounterSlider:0.1.4")
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can this dependency be added in predefined version management scheme that we already have?

@kirillt
Copy link
Member

kirillt commented Dec 15, 2024

Looks awesome!

One bug, not critical since it's just a sample:

  1. Select a resource, modify score for it
  2. Select another resource
  3. Score cannot be changed anymore
  4. If we select the resource from step 1, score still cannot be changed

@kirillt kirillt self-requested a review December 15, 2024 07:14
) = lifecycleScope.launch {
val (index, scoreStorage) = setupIndexAndScoreStorage(root)
val id = index.allPaths().toList()
.find { it.second == resourcePath }!!.first
Copy link
Collaborator

Choose a reason for hiding this comment

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

The result of find could be null, and app will crash in that case because of !! assertion.

Copy link
Member Author

Choose a reason for hiding this comment

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

Fixed. This can happen if file is selected from outside root

root: Path,
resourcePath: Path
) = lifecycleScope.launch {
val (index, scoreStorage) = setupIndexAndScoreStorage(root)
Copy link
Collaborator

Choose a reason for hiding this comment

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

setupIndexAndScoreStorage is a suspend function so it should be scheduled in background thread. It's now running in main.

Copy link
Member Author

Choose a reason for hiding this comment

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

I was sure that initialization of Index and ScoreStorage occurs on Dispatcher.IO, but ScoreStorage does not change dispatcher :/

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