gazlaws-dev / codeboard

Codeboard App
Other
566 stars 116 forks source link

Programmaticaly generate keyboard templates #49

Closed downloadpizza closed 4 years ago

downloadpizza commented 6 years ago

We already have it in sym so an option to remove it from letter kb would be nice ==> more space

peterekepeter commented 6 years ago

Took a look at the code behind. Each layout is a separate XML file. So with the current system each option we add to the layout exponentially increases the number of necessary layout files... which is not something maintainable...

There is a generator included, that makes things a bit better, but it's still a bit messy.

theintel commented 6 years ago

@peterekepeter Maybe we need to modify the code and unify the layout files.

peterekepeter commented 6 years ago

Yes I wanted to work on this, that's why I investigated but I noticed it would take a significant rewrite. However it is possible to do, instead of inflating the XML resource files, the view can be built programmatically using plain old Java.

peterekepeter commented 6 years ago

But going forward with this project this should be done, it will allow much more configurability and it would also simplify the current code which takes into consideration all the different layout xml files, and it also removes dependency on the sed linux tool, which is not something you have when you develop on windows.

This rewrite will also enable solving other issues and feature requests much more easily.

theintel commented 6 years ago

@peterekepeter I hope you can manage some time to start working on this. Because a customizable keyboard is a long-awaited dream for programmers :blush:

gazlaws-dev commented 5 years ago

I would love to have contributors working on a rewrite! Yes, the current keyboard generation is hacky, but it requires a lot of time to rewrite (and I'm busy with college most of the time). I'll set up a project and see what I can do

peterekepeter commented 5 years ago

I've made a basic proof of concept to see if it's doable, basically it's generating one button for the whole layout and Android OS didn't complain about it. (didn't write much Java code or android so I needed to confirm that there is a way)

I'll be taking leaving my current job soon, so I might have some time between to look at this again while searching for a new job.

peterekepeter commented 5 years ago

In the spirit of Hacktoberfest I'll give this one a proper attempt, I've been putting it off for too long.

peterekepeter commented 5 years ago

WIP:

This is generated from Java, It also has unit tests. But I still have a few more things to figure out, right now the keyboard size is static, as did not figure out how to get the avaialbe width and height from Android. Maybe subclassing ViewGroup will help.

image

Here is a link inside my new branch to the new Java classes that will be responsible for layout generation https://github.com/peterekepeter/codeboard/tree/feature/layout-builder/app/src/main/java/com/gazlaws/codeboard/layout

gazlaws-dev commented 5 years ago

Nice work! TBH, I haven't taken a look at this project in a while, I'm glad that you've brought it up. I'll take a look at your fork soon (feel free to email me if it seems I've forgotten)

peterekepeter commented 5 years ago

Aye, well I still have some work to do on it, I'll get a pull request up when the layout generator is ready. After that, the rest of the issues should be easy peasy!

peterekepeter commented 5 years ago

Alright, keyboard size is now proportional to screen size, it's possible to set any number from 0% to 100% screen usage.

image

Next steps are to

  1. make the keys generate events, right now they don't do anything except for being rendered
  2. add code for each layout
  3. accept existing settings (theme)

And we can call the base feature done! -> we can move on to more interesting stuff, further customization and layouts.

peterekepeter commented 5 years ago

Alright I have added all supported layout definitions to the code. There are some validation check that make sure that the layout does not throw and that each key has either a code or an output text set.

image

I still have some adjustments to make as it's not really compatible right now.

Fighting some bugs currently:

peterekepeter commented 5 years ago

I've opened the Pull Request: https://github.com/gazlaws-dev/codeboard/pull/61

There are still a few things different, but functinally it's the same.

image

theintel commented 5 years ago

Great job!

NWYLZW commented 5 years ago

I am also doing this, and I am already completing the customization. Screenshot_2019-11-08-02-57-33-332_com gazlaws codeboard Screenshot_2019-11-08-02-57-43-106_com gazlaws codeboard

NWYLZW commented 5 years ago

I am working hard to make its shortcuts custom.

peterekepeter commented 5 years ago

ohh, this is so that you can make in app customizations, nice