Detailed gestures predicted with simple horizontal lines - android

I have a collection of Greek letters in a gesture library and for some reason swiping straight left or right comes up with a pretty good score for mu and iota, neither of which represent horizontal lines. This breaks the idea of my app. I'm currently using a score of 25 or higher to test accuracy of drawing the letters.

Fixed by adding two gestures. One called "left" and one called "right" and they're shaped like horizontal lines. When predicting the closest gestures, it counts as a failure if left or right have the highest scores.
This prevents users from swiping left or right to draw a complex shape.

Related

Android Drawing Moving Lines

I am developing a game using Android Studio where I need the blocks to move from right to left. I have a file as an input and it contains a string list which would look something like this:
[(160,0;7,58), (160,0;7,59)..]
The elements in this list should be seen as coordinates, the 1st number of each pair (in this case 160,0) is the coordinate on the Y axis and the second number (in this case 7,58 and 7,59) is the coordinate on the X axis
The idea of this list is that the first number of every pair is the pitch heard at that ms, which is the second number. And the lines that come in from the right should arrive at the left corner at the time they were heard.
Lets say I someone said one word (with the same pitch for this example), the list would look something like this
[(160,0;5,50),(160,0;5,51),(160,0;5,52),(160,0;5,53),(160,0;5,54),(160,0;5,55),(160,0;5,56),(160,0;5,57),(160,0;5,58),(160,0;5,59),(160,0;6,00),(160,0;6,01),(160,0;6,02),(160,0;6,03)]
Now in this given list the 160,0 is the pitch of the sound and the second number is 5,50ms. Now the idea is that the lines/bars that come from the right side will reach the left side at that point. This whole list makes one word and should be displayed as one block/line that moves from right to left.
The blocks should come in and then disappear (like it is illustrated in the illustration), pretty much like rainfall or in tetris where the blocks fall down but instead of hitting the ground they disappear. In the illustration you can see one full block and the other one is just coming in from the right. The 1st long block that you see in the illustration should move to the left most screen and then gradually dissapear.
I drew a little illustration of how it should look like : https://imgur.com/a/3X1dV
Is the best approach to create one block, clone it and move it on or draw new lines with "draw" or can someone tell me how I should approach this.

androidplot dual data-series legends with range legends on both sides (left, right)

while i really appreciate the new 1.4.x androidplot release for it's ability to provide range legends on both sides (left and right), this would now ask for being able to provide 2 visually separable data series legend blocks instead of one or a similar setup
back in the 0.9.8 days i created 2 independent plots being overlayed ... this allowed a range legend on the left with one plot and one on the right with the second one ... now i was able to place one data series legend inside the graph in the upper left corner and the other one in the upper right corner
this visually linked the left and right range legends to it's data series legends
upon a touch in the either left or right range legend screen areas would scroll (change) through the various data series linked to each plot and the data series legends on each side would provide a visual help which series are linked to each side (back then plots)
i also changed the grid params and domain label color to indicate which range legend is the one applied to the grid setup
i prefer not to use the dual plot approach for performance reasons over a faster single plot setup
i can accomplish most of the above described functionality with the 1.4.3 rev of androidplot, except i have no means to provide 2 visually separated data series blocks legends relating to the 2 range legends on the left and right
i hope this was not a too complicated description to my desired setup
sine test data screenshot showing 2 data series legends with dual plot implementation on 0.9.8
thanks for your suggestion
yes, i could live with it for now ... actually i took the default horizontal legend position at the bottom and moved it into the graph area at the bottom to provide a bigger graph area and the legend still goes from left to right, and it's not too likely that this will be mostly overwritten with the plots
i'm already adding the left plots 1st and the right ones after, so i have some sort of visual left and right separation
it would be nice to maybe later have some sort of ability of physical separation for the data series legends, like with the left and right range legends
the issue seems to be the automatic legend data generation based upon the plot.addseries function ... if this automation is removed and a solution in concept similar to below
XYLegendWidget lw = Plot.getLegend (right ? XYLegendWidget.Edge.RIGHT
: XYLegendWidget.Edge.LEFT) :
lw.addSeries (LineAndPointFormatter reference or similar ) ;
lw.setPadding (1, 1, 1, 1) ;
lw.setIconSize (new Size (isz, SizeMode.ABSOLUTE, isz, SizeMode.ABSOLUTE)) ;
lw.getTextPaint ().setTextSize (txtsz) ;
lw.getTextPaint ().setTextAlign (Paint.Align.RIGHT) ;
lw.getTextPaint ().setColor (ContextCompat.getColor (this, R.color.gray)) ;
lw.position (spc, HorizontalPositioning.ABSOLUTE_FROM_RIGHT,
bot, VerticalPositioning.ABSOLUTE_FROM_BOTTOM, Anchor.RIGHT_BOTTOM) ;
the above code is taken from my setup, except for the lw.addSeries (LineAndPointFormatter reference) or similar
use the LineAndPointFormatter data already available from the 2nd param in the plot.addseries and use it for an addseries call in the XYLegendWidget setup
just a thought ... this would now provide 2 legends ... of course the automated legend data generation based upon plot.addseries is now gone and the legend, even one needs to be setup manually
but you are the expert Nick, and thanks for the nice work with 1.4.x, despite some growing (upgrade) pains for some less experienced users like myself

Scrolling home screen in LibGdx

I am using LibGdx to develop a game. For Now I am not using scene2D. I am struck up in increasing the levels of the game as I do not have the scrolling screen.
I like to design a a scrolling screen as it is in many games which are level based (for ref, lets say Candy crush). Could you please point me a example on how to have such a scrolling screen to show a bigger area where I can show many levels.
Thanks is Advance !
Using the Scene2D function is not necessary for this and is more for GUI implementation and different screens. The Scroll pane really shines when creating reading content that does not fit your phone. I do advice to start learning Scene2D to create MenuScreens and UI though.
What Candy Crush "simply" does is having multiple backgrounds that are placed next to each other and tile seamlessly. They use buttons in the correct place for levels. By dragging a finger across the screen the camera will move in that direction. For the movement from one level to the next there is probably something like a spline in play.
It is important only to draw the background tiles and buttons that are actually visible on the screen if you have many. Since these have fixed positions and you know your camera area and position you can calculate what to draw and what not. Just drawing everything each frame is likely to slow down your fps.
You can do a search on:
Tilemaps, for you backgrounds but you probably want them in just one direction so a simple 1D array would suffice.
Dragging, to move your camera. Here I gave a basic explanations on how I do it.
Splines, are a bit tougher and you do not really need them. They could be used to animate or move something along a curve.
Thats all, expecting you know how to create something like a button (click a sprite).

Android tile movement

I'm looking to implement movement from character to character on a tiled board. I have a 7x7 board set up with each tile representing a character. The player is able to move in up to the 8 directions around the tile (providing proper game logic). I am able to accurately get the character at a given tile based on a onTouch() Action_Down.
For a more elegant solution though I am looking to press and drag to move between tiles/create words. I'm not exactly sure where I should start with this.
I can figure out all the logic for appropriate moves etc. But my question is how to recognize a left movement from 1 position to another as selecting tiles?
My current idea is to have hard boarders but that will not work for diagonal. Then my next idea is to have diagonal boarders instead so like:
This solution seems a little complex though. Is there any easier way to accomplish this?

Implementing wheel shaped interface navigation tool

I am interested in implementing a user interface navigation control mechanism based on a wheel shaped device (or pie chart shaped or circle shaped) in my Android app.
I would like only half of the wheel to be visible at any time. That is, only the top half of the wheel should be visible since the bottom half should be below the border of the screen. The user can then turn the 'half wheel' to show options hidden by the screen border. The visible top half should then be divided into three parts like a pie chart, so the user can press either one of them to invoke some action. The following pic should explain (it is an example with seven (A-G) options).
http://imgur.com/lNu1F
The rotation itself should not be hard, but I am having a hard time understanding how to position the wheel so that half of it is outside the actual screen. I am thinking that loading the entire wheel (but hiding half of it) is best, since that is that graphics I have and it will also allow a smooth animation when the user swipes to show some other options. How can I make Android show the wheel in this way?
Also. Any comment on how to implement the 'swipe along the wheel shape' would be appreciated.
Thank you.
So for the wheel - you are hving trouble knowing how to position the wheel because you are using XML to align you objects and would like to use something like "Align Object Center To Bottom" which does not exist.
Here is one approach that might work fine: Mask the wheel view.
Is it possible to mask a View in android?
As for swipe the wheel along, I would register the wheel to take touche events, and use only the horizontal componenet of move events to apply to the rotation of the wheel. This setup is common in audio software that uses knobs.
However if you want to have it stick to the users finger in a more realistic fashion, you will need to do the following:
When the user first touches the wheel, calculate the angle from the wheel center to the finger.
Every time the finger moves, check the angle from the wheel center to the finger - and rotate the wheel the amount that the angle has changed from the last touch event.
The formula for getting the angle between two points is this:
Float angleInRadians = Math.atan2(point1.y-point2.y, point1.x-point2.x);

Categories

Resources