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

🔧 We have made modifications so that the language switching switch can be pressed even on small devices with low resolution. #956

Conversation

Corvus400
Copy link
Contributor

@Corvus400 Corvus400 commented Sep 4, 2024

Issue

  • None.

Overview (Required)

  • Depending on the resolution of the device and the font size, the language switching button would be hidden or displayed vertically, causing the design to break.
  • So, when there is clearly no margin to display the language switch, the language switch on the Column side is displayed.

Movie (Optional)

Before1 Before2
before.mp4
before2.mp4
After1 After2 After3
after.mp4
after2.mp4
after3.mp4

Another option

  • Incidentally, I investigated in advance that it would not be possible to meet the design requirement of moving the Language Switcher to the far right, because weight cannot be used when LazyRow is used as follows.
  • If it is okay not to follow the design requirements, the problem of the Language Switcher not displaying properly or the buttons not being able to be pressed can be solved by simply changing the Row to LazyRow using the following code.
        LazyRow (
            verticalAlignment = Alignment.CenterVertically,
        ) {
            item {
                TimetableItemTag(
                    tagText = timetableItem.room.name.currentLangTitle,
                    tagColor = LocalRoomTheme.current.primaryColor,
                )
            }
            items(timetableItem.language.labels) { label ->
                Spacer(modifier = Modifier.padding(4.dp))
                TimetableItemTag(
                    tagText = label,
                    tagColor = MaterialTheme.colorScheme.onSurfaceVariant,
                )
            }
            item {
                Spacer(modifier = Modifier.weight(1f))
                if (isLangSelectable) {
                    LanguageSwitcher(
                        currentLang = currentLang,
                        onLanguageSelect = onLanguageSelect,
                    )
                }
            }
        }
another.option.mp4

@github-actions github-actions bot temporarily deployed to deploygate-distribution September 4, 2024 01:09 Inactive
Comment on lines +180 to +190
if (
sharedTransitionScope != null &&
animatedScope != null
) {
LaunchedEffect(sharedTransitionScope, animatedScope) {
snapshotFlow { animatedScope.transition.isRunning }
.filter { it.not() }
.distinctUntilChanged()
.collect { onEndTransitionAnimation() }
}
}
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If the display of the language switching switch is not modified so that it is displayed after the animation finishes, in some cases the switch on the Row side is displayed after it is displayed on the Column side for a moment.
So, it was necessary to add a process to detect when the animation had finished.

Comment on lines 128 to +138
LanguageSwitcher(
currentLang = currentLang,
onLanguageSelect = onLanguageSelect,
isVisible = isAnimationFinished && isLangSelectable && hasSpaceForLanguageSwitcher,
)
}
LanguageSwitcher(
currentLang = currentLang,
onLanguageSelect = onLanguageSelect,
isVisible = isAnimationFinished && isLangSelectable && hasSpaceForLanguageSwitcher.not(),
)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Having the LanguageSwitcher lined up like this is not a very good process. 🤔
If there is a better implementation, I will follow that. 🫡

Comment on lines +196 to +199
AnimatedVisibility(
visible = isVisible,
enter = fadeIn(),
exit = ExitTransition.None,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If there is no animation, the language switch suddenly appears after the page display animation is finished, so it doesn't look very good. 🤔
So I've added a fade-in animation.

@Corvus400 Corvus400 marked this pull request as ready for review September 4, 2024 01:40
@Corvus400 Corvus400 marked this pull request as draft September 4, 2024 02:26
@Corvus400
Copy link
Contributor Author

Now that we know that FlowRow does not require such a complex implementation, we will rebuild the PR.

@Corvus400 Corvus400 closed this Sep 4, 2024
@Corvus400 Corvus400 deleted the bug/fix_display_time_table_detail_when_small_device branch September 4, 2024 02:40
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.

1 participant