How do I create a slider in the GDK? - google-glass

Programming the GDK a few weeks now, the CardScrollView is a pretty nice interface for displaying cards. However one issue with the UI is showing the user how far along they are in the card stack. In the Mirror API, this is nicely handled by the Slider view at the bottom of the screen as described on the Glass Design page:
https://developers.google.com/glass/design/style/metrics-grids
Unfortunately, I have not been able to get this Slider object to display on the CardScrollView and instead have resorted to a klugey 1 of n text.
Is there any way to get this Slider view to display in the GDK?

This is not yet supported by our API but is currently tracked with Issue #256.

For future reference, this feature has been already implemented as described in the original issue.
You can use the method setHorizontalScrollBarEnabled to show the bar, e.g.
mCardScrollView.setHorizontalScrollBarEnabled(true);

Related

How to move list item given source index and destination index with animation in flutter

I am building a leaderboard screen in the flutter application, whenever the user comes to the leaderboard screen, I want to show the animation of his old position to a new position in the leaderboard, so I need an animation of this row to go up or down based on his standings, please someone help me which widget to use to get this functionality working. Thanks
AnimatedList is the widget you are looking for. It automatically generates entrance and exit animation when items are added/deleted. Combined that with SizeTransition, and you will get a nice "growing/shrinking" effect.
There are some really good examples (and even a video tutorial) on the official docs as well.
You can also look at this answer for a more complex example of using 2 of them.

Change the order of ColumnLayout or ListView and save / restore it

I'm working on a stream overlay that extracts information out of a game (flight simulator) and displays it on the screen. Right now I'm using Qt in conjunction with a *.html to render the overlay. It is all working really well, however I wanted to add some customization options for the users of my overlay software and I figured the best way would be to render the Overlay in QML.
The main part of the overlay is a row that contains around 8 "elements" that display the relevant data.
One thing that should be customized is the order of the elements in the row. But I really have no idea how to implement this feature. I've seen a few posts and tutorials on how to customize the order in a View using the DelegateModel. However right now it's not a view but QML Components inserted in a RowLayout due to the fact that they are all different components (e.g. some of the images are actually animated for which I'm using a component that uses Canvas2D to draw the images). I guess I could figure out a way to store those elements in a model using the Loader Component to display the content in QML. But even then I'm not entirely sure how to store and restore the order of the elements. As far as I can tell the DelegateModel only changes the View and not the underlying model.
Any suggestion or best practice to accomplish my goal would be highly appreciated.

How to make google chart API responsive?

I am creating two charts Line Chart and Donut Chart on same HTML Page using Google JS API. But these charts are not responsive. How can I make those charts as responsive?
The Google Charts API was probably not designed with responsiveness in mind, specifically. The default size of the chart is to fill the element it's being rendered into, so you can just use CSS and Media Queries like you would normally do to make a responsive design.
The only real problem is that once the chart is drawn, it doesn't change it's size in a desktop window resize-type scenario. In Angular Google Chart we listen for the window's resize event and redraw the chart.
I've seen some of the resize strategy paired with a bit of JavaScript to keep the chart the same aspect ratio no matter how wide it is.
Anything more specific will need a more detailed question. I am intentionally not including any code for this answer, because whatever I write will probably be wrong for your situation.

Is raphael.js paper a real canvas?

I was researching what graphics to use for a project, and Raphael.js came to be a top contender. However, when reading the sample code and documentation, it shows that Raphael creates a canvas (via the paper variable on the homepage), and then you add stuff to it. Two months later, a passerby comes by and ask some question about our project, and I explained that we didn't use Raphael (instead we chose static SVG and D3) because Raphael used canvas's, and our project would have been greatly disadvantaged by using canvas's. So you Raphael expert's out there, is the canvas in Raphael an actual html canvas or not? and where can you link to it, so that you/and or I can send a pull request to explain that better upfront.
No Raphael's paper is SVG.
It is kinda strange, because the paper object property is called canvas but it only contains the SVGAnimatedString
Fiddle: http://jsfiddle.net/V2DGy/
Raphael uses SVG and VML to create graphics. The variable canvas is simply named as canvas and is not a canvas element. In fact, it is the root SVG element associated with that specific paper.
Raphael is very much similar to d3 but is more on thd lines of a graphics library and the added advantage of compatibility with Internet Explorer 6 through 8 (using VML instead of SVG.)
Though the variable name is misleading, yet Raphael mentions upfront in their home page that it is SVG library.
Quoting their website.
Raphaël is a small JavaScript library that should simplify your work with vector graphics on the web. If you want to create your own specific chart or image crop and rotate widget, for example, you can achieve it simply and easily with this library.
Raphaël ['ræfeɪəl] uses the SVG W3C Recommendation and VML as a base for creating graphics. This means every graphical object you create is also a DOM object, so you can attach JavaScript event handlers or modify them later. Raphaël’s goal is to provide an adapter that will make drawing vector art compatible cross-browser and easy.
Raphaël currently supports Firefox 3.0+, Safari 3.0+, Chrome 5.0+, Opera 9.5+ and Internet Explorer 6.0+.
No. Is svg. Totally different. Canvas contains "a picture", svg contains vectorial elements.

How to create this animated arrow?

I have just installed a program on my pc and after that, an animated arrow is appeared on the screen showing me a new element on the bar:
How can I create this animated arrow ? What API do I have to use ?
It can be made with a window that has a custom shape. One of my colleagues documented how to do this in .NET here:
http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/09/beauty-is-only-skin-deep-skinning-your-winforms-application.aspx
http://www.atalasoft.com/cs/blogs/jake/archive/2008/05/19/beauty-is-only-skin-deep-part-deux-if-it-looks-like-a-duck-it-might-be-a-winform.aspx
The same thing can be done in C++ by following the technique
I'm not aware that such a capability is exposed in an API. I expect the app draws it directly which it is of course perfectly entitled to do.