braille-systems / learn-braille

Android application to teach Braille writing system. Inspired by stepik.org, Anki and Braille Tutor
https://play.google.com/store/apps/details?id=com.github.braillesystems.learnbraille&hl=ru
Apache License 2.0
11 stars 3 forks source link

Refactor Braille Trainer connection class #43

Open winter-yuki opened 4 years ago

winter-yuki commented 4 years ago

Rewrite as singleton

must provide methods:

createInstance(context, ...)
trySend(String s)

Also this class must contain variables eventReceiveSymbol and eventJoystickSignal. Their change should trigger some events in the app (this class is unaware of those events, triggers must be added from outside)

winter-yuki commented 4 years ago

At least it should do nothing if Braille Trainer is not connected. And it should be obvious from code.

Also, the factory is needed, too much boilerplate code during initialization.