-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Internationalization for GadgetBridge Notification #754
Comments
I have located the GB code on sending notification here. I plan to read more about the code and figure out:
|
That sounds great, thanks! Just to add that for a customer I just added So that is another option (especially if I add the ability to include images inside text strings). However, I think realistically what you're attempting here is still the best solution, as it'll 'just work' - without requiring any 'language pack' to be installed on the Bangle |
Hi Gordon, I have pushed some changes to GadgetBridge. Please see my changes here. I have done just minimal changes. Basically, I added a function to convert string to bitmap and then send the bitmap to Bangle.JS. Of course, the watch crushes as it is right now. I'm wondering whether this is along the lines that you are thinking of? I'm actually just learning Java. So things have been very new to me. Please let me know if you have any suggestions on how to improve, e.g. API, code, and many more. Thank you. |
Hi - yes, that's along the lines of what we're after, but I think it needs to be a bit more complicated.... Maybe instead of setting I'm pretty sure convertStringToBitmap doesn't actually work right now. I think what you need to do is create a 240x240 bitmap, then render the text to it, then get the bitmap as base64.
Having said all that, you actually need to be a little smarter about the size - for instance you don't want to send a 240x240px image for a simple message that says 'Hello'. I guess titles want to be just the height of one line of text, and the body just the height of the text that is in the message |
That makes sense. I will simply add another field in the message called
OK. I see. So I need to somehow arrange all text information into a single bitmap. The width will be fixed at 240 pixels because that is just how wide the watch screen is. The height should be dynamic because some message will be longer than others, but not higher than 240 pixels. Does that sound good? And do you have suggestions on how to debug this? Because I suppose as it is right now, even if I modified the code, I won't see any changes from the watch side. I'm not really sure how I can debug it before I commit my changes. Thank you for your pointers. |
That sounds spot on.
I can't remember for sure, but it might be that the Bangle.js class in Gadgetbridge writes the data it sends as a log message? If not it should be pretty easy to add that functionality. Once that's done, you should be able to copy the base64 code you're generating and paste it into So that should really help with the debugging? I guess initially you could just make your own super-simple app that displayed a Bitmap on the phone's screen, and then you can use that to try and develop the code that draws the text nicely onto a 240px bitmap? |
Hi @gfwilliams , I have committed some changes here. Could you check whether this is on the right track? There are no errors on both the Android and the watch. Could you use whether you can draw the Another issue is that, I seem to get Thanks. |
This looks promising, but the bitmap format isn't right at all. Did you try just using the code I posted above? As far as I can tell what you've got is:
So the image won't get interpreted correctly, but even if it was it's using 8x more data than it needs to, which probably explains the FIFO error (although usually that shouldn't happen if you have a watch face that doesn't take too long to draw). I guess Gadgetbridge could actually implement some flow control for sending data - it's just that to date that hasn't been required |
Hi Gordan, thank you for your suggestions. Previously, I didn't quite understand your code. After your explanation, it makes sense to me now. I have pushed a now commit here. I have tested the data string with the emulator and it is showing up correctly! Well, for now, it just simply print the body text. But I think the string is properly formatted now. If you have some time, please change the gbridge code on JS so that it draws the Thanks. |
Great - thanks! I'm a bit bust right now but I'll see about adding something as soon as I can |
Hi. Please tell me how to use this solution. |
Hi - right now this is not something that'll work as-is, however we'll be doing an updated version of Gadgetbridge and I plan to include this in that. We already have a lot of features (adding images inside text strings, gadgetbridge flow control) that will make this much easier to get going now. |
Candidate for being closed - leave a comment if you object! Rationale: I know there is the option "Text as Bitmaps" in gadgetbridge - but I don't think this is the same as sending and drawing the whole message as one bitmap image as discussed in the comments above. Conclusively I believe the issue should remain open - but if I misinterpret the "Text as Bitmaps" option it should maybe be closed after the PR to gadgetbridge gets merged. |
Thanks - yes, this can be closed now - While we don't render the whole image, we render any words that contain unrenderable characters - which saves a bit of space and also allows us to wrap text correctly and stuff like that. There may still be an issue with right-to-left text rendering which I guess might need solving by just rendering text in chunks of ~160px but nobody has complained about that yet just a note on flow control: it's not really needed for this to work - it'll just make things more reliable especially if there are messages with lots of unknown text and a slow clock face |
This is a issue branching from the discussion here. Since it probably would involve some dedicated discussion, I opened a separate ticket to track this issue specifically.
What is the issue
Non-English texts, Chinese in my case, are always displayed as '???' which is annoying.
Solution
Notification should be able to rendered as images to facilitate internationalization.
Tasks on board
The text was updated successfully, but these errors were encountered: