firemaples / EverTranslator

Translate text anytime and everywhere, even you are gaming!
https://play.google.com/store/apps/details?id=tw.firemaples.onscreenocr
GNU General Public License v3.0
131 stars 23 forks source link

Menu bar can go outside the screen #442

Closed uomar8 closed 3 months ago

uomar8 commented 3 months ago

Before 4.0.0: Screenshot_20240313_234153_com example android notepad_edit_225449584214035

After 4.0.0 : Screenshot_20240313_234225_com example android notepad_edit_225456984577055

firemaples commented 3 months ago

Thanks for reporting this issue.

I can not reproduce this on my Pixel 8 pro, let me try to find some other devices to test 🤔 I've upgraded the compose version to the latest one, please try this again on https://github.com/firemaples/EverTranslator/releases/tag/v4.0.4 🙇‍♂️

uomar8 commented 3 months ago

Thanks for reporting this issue.

I can not reproduce this on my Pixel 8 pro, let me try to find some other devices to test 🤔 I've upgraded the compose version to the latest one, please try this again on https://github.com/firemaples/EverTranslator/releases/tag/v4.0.4 🙇‍♂️

I just tried latest version, didn't fix the problem

I think it only happens with old android versions 9 and 10 😅 these the one I use

I will try to use android studio to see if there's anything could help us

Update: I tried to use android emulator and the same problem happened

If we could add more logs to get what is wrong, might help us to find what made this problem

uomar8 commented 3 months ago

What I notched it can detect the left and right side of the screen

So I guess it can detect up and down of the screen but it can't detect if it's near to it ( what code is responsible for this? And how we could check that?

firemaples commented 3 months ago

I use the compose built-in DropdownMenu now. https://github.com/firemaples/EverTranslator/blob/7191b70fcb0cb8c20b3499fedb4b052187d6bc75/main/src/main/java/tw/firemaples/onscreenocr/floatings/compose/mainbar/MainBarMenu.kt#L16-L28 I thought it should be positioned inside of the scope by default. Maybe it can not aware the scope on the views on WindowManager

The menu was a component that I calculated the position by myself on the previous version https://github.com/firemaples/EverTranslator/blob/b4a8b22aa1d856e6a5dbf06f43839105f96dd058/main/src/main/java/tw/firemaples/onscreenocr/floatings/menu/MenuView.kt#L101-L121

Looks like I need to use a customized component instead of a built-in one 😅

uomar8 commented 3 months ago

This might help:

https://github.com/material-components/material-components-android/blob/master/docs/components/Menu.md

Also what do you think of using Bottom sheets instead? https://github.com/material-components/material-components-android/blob/master/docs/components/BottomSheet.md

firemaples commented 3 months ago

Thank you for the proposed components, let me try to find the relative compose component to use 👍