n-apps / ScoreCounter

Android app. Score Counter will help you easily keep score in any games, sports or other activities. Will do all the math for tracking initiative, HP, hit points, spell slots or even count win streaks in your bar game night!
GNU General Public License v3.0
70 stars 19 forks source link

Calculator #44

Closed vabene1111 closed 4 years ago

vabene1111 commented 5 years ago

Allows entering formulas into the long click counter dialog by typing = sign followed by a simple calculation. Very useful for games with multipliers or where stuff has to be added and one is to lazy to calculate.

It also adds a little help button into the long klick dialog. This button is not the nicesest of all buttons but i had no better idea on how to tell the user about this feature. If you dont like it i can remove the button.

n-apps commented 4 years ago

Can't enter "=" sign in EditText via keyboard.

screenshot fro emulator Screenshot_1570310360

vabene1111 commented 4 years ago

Thats weired, on my emulator its working 🤔 what version does yours use ?

2019-10-07_12-03_Android_Emulator_-_Pixel_3_API_295554
vabene1111 commented 4 years ago

ah ok, i see what you mean, the appropriate keyboard does not open and it does not allow switching to one that has numbers ... i will try to find a fix for that

EDIT: ok, it seems to be rather annoying to open a certain keyboard in android, especially because everyone can use different keyboards (swiftkey for example has a different view for numbers) .. i will have to take a closer look at this when i have time.

vabene1111 commented 4 years ago

@n-apps you dont need to comment or this or even read it. Only read it if you want this Feature.

Ok after some more time researching on android keyboard types and events i think i can say that we have three options:

  1. Scrap this feature completly, even tough i really like it and find it very useful. There is simply no really good way of solving this that i could find.
  2. Set the text type to either textPhonetic or textVisiblePassword which both allow entering numbers and characters. This is not intuitive and less ergonomic for the case that a user only wants to enter a number (which is probably 99% of all cases so this sucks)
  3. Dont use an EditText but implement a simple number keyboard consisting of buttons that are simply shown inside the dialog and fill in an non-manually-editable edittext field. This has the drawback of not using a real keyboard which can lead to countless issues (like foreign number systems/keyboards breaking maybe ?!, scaling and display size problems, ...)

I am really not sure which way is best, i kinda think either number 1 or number 3.

This Post nicely explains the problem and also has a workaround but i really dont it because of the drawbacks described https://stackoverflow.com/a/29175373/6478110

If you have any good ideas or preferences feel free to share them :)

n-apps commented 4 years ago

Thanks for research. How about idea to move away from keyboard and edittext and instead provide 5-10 predefined values and buttons +1 and -1? They would work like calculator and only final result will be applied to counter (maybe after clicking on the button).

n-apps commented 4 years ago

pls check latest release and tell me what you think about idea to use middle (value) area for predefined values and left and right sides for calculator like types

vabene1111 commented 4 years ago

interesting idea, i like it. did not know there were different handlers for the different areas. I will close this PR as its obsolete. the calculation logic can later be copied from here. I currently do not have much time to work on the app so i cant implement this right now. If you want to go ahead and always feel free to ask for feedback and/or suggestions.