GLASS - android.widget.RatingBar not allowed to be inflated - google-glass

it looks like I'm not allowed to inflate the RatingBar widget. Is there any similar widget I can use on GLASS? Thanks!

The RemoteViews class can only inflate a limited subset of widgets in the Android platform, and RatingBar is not one of those. The documentation for that class doesn't indicate directly which classes those are, but you can find a list in the Android app widgets documentation.
So if you want to use a RatingBar in a live card, you have a couple options:
Create the card using direct rendering and draw the views directly onto the surface, which lets you use any kind of views that you want
Or, mock up your own rating bar using ImageView widgets instead.

Related

What Qt widgets should be used for sprite animation viewer

I'm looking to make a sprite animation editor. I have the loading of my custom animation file done but now need to get the actual ui started. I'm really just stuck on what widgets I would use to actually play my animation. I need to be able to go to certain frame, play, pause, loop, etc. Once I'm done with the viewing portion I plan on adding in the editing.
I've seen AnimatedSprite in qt docs but that seems to only allow playback of sprites in the same file. In my situation sprites can be from multiple image files and sometimes doesn't follow a grid like sprite cutter.
First of all, you should decide whether you want to use QML or Widgets. AnimatedSprite is QML related class. All widget-related classes starts with "Q" letter.
If you decide to use Qt Widgets, I would recommend to take a look at Qt Animation Framework in combination with Qt Graphics View Framework. Most likely it will not let you do everything you want out of box, but it should provide you with a rich set of useful tools.
If you need here are some examples.
Hope it helps.
Have a look at QMovie. This class may provide all the methods you need, as long as you only want to use it for viewing. The QMovie can be passed to a QLabel to show the animation.
QMovie however supports only gif out of the box (and there is a third party plugin for apng files). You would probably have to create your own image handle plugin to support your format.
If thats not applicable or to complicated, you will most likely have to create your own custom widget. Have a look at the painter example. Playing an animation is not that hard if you have all the frames. A simple QTimer to change the image to be drawn in a constant rate should work.

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.

Where is the auto-resizable TextView used in the GDK Card class?

So the GDK provides the Card class which is quite nice for creating cards at runtime. Especially useful is the setText() method for cards which automatically sets the font size to best fit the card, based on the amount of text and the available space.
This feature would be very useful in cases where I want to display text on cards, but cannot use the Card class due to customisation needs. I've thus been looking in the GDK to find where this resizable text view is defined, but I don't see it anywhere.
Is it publicly exposed somewhere or is there source code for download?
I think for a custom layout you'll have to use custom code to handle font sizing, like people have done for other Android apps. For example,
Auto Scale TextView Text to Fit within Bounds
Auto-fit TextView for Android

Could one use an animated gif as part of card.addImage(uri) in an immersion card on Glass?

I'm trying to use the following documented API:
https://developers.google.com/glass/develop/gdk/reference/com/google/android/glass/app/Card#addImage%28android.net.Uri%29
in a similar way to this post:
NullPointerException when calling Card.addImage(Uri)
but I'd like to use a an animated gif as the background for an immersion card instead.
Possible?
The layouts built by the Card class use Android's ImageView to represent their images, and the ImageView widget does not support animated GIFs. You would need to construct your own layout and manage the animation manually.

Qt - effects on no-opengl widgets

i wanna make some nice user interface, but still using just classic ui elements from Qt.
For instance i have 2 forms and i wanna make some transition between them. For instance rotate first ui screen and make it disappear. It's possible in some way to use shader? Is any way how to do complex ui animations with classic ui elements?
Qt has a whole animation framework. It works on both the QML widgets and for the classic UI elements that you're using. There's some examples of use here, that should be able to get you started.
The simplest way to do it would be to use the Qt Declarative a.k.a. Qt Quick 1. It's based on QGraphicsScene, with the latter offering a reasonable way of integrating legacy widgets. It'll be likely the simplest way to offer animations with widgets.
You may wish to see an overview of GUI technologies available in Qt 5, to see how Qt Quick 1 fits in.