Activity Indicator in J2ME - java-me

I wish to display an activity indicator in J2ME when I am performing some network activity (HTTP requests and XML parsing). I have seen gauges being turned into activity indicators:
Gauge _gauge = new Gauge( null, false, Gauge.INDEFINITE, Gauge.CONTINUOUS_RUNNING );
But this does not dim the view behind and it does not overlay the view.
Please let me know your suggestions on this.

Related

How to pass custom data into teams task module from bot adaptive card

I have a teams bot (nodejs) that renders an adaptive card with some table data. We want to provide a richer data viewing experience by iframing a javascript widget inside of a task module that will display the data using interactive D3 charts.
Basically the adaptive card will have a "see more" button, which will invoke a task module containing the html contents.
The part I can't figure out is how to access the data from the html inside the task module. I realize that there is a global object called microsoftTeams that contains metadata and context, but it doesn't seem specific to the adaptive card that was clicked (the adaptive card that invoked the task module). It has much more global info used for teams such as the user and conversation metadata.
I was able to insert the data into the taskInfo object when invoking the task module as a custom param. So my question is, is there a way to access the taskInfo object from inside the HTML iframe?
I am using query strings to get data from the server to the client (There might be a better way, hopefully #Saonti-MSFT comes back with an easier/cleaner way).
This is my task object:
task: {
type: "continue",
value: {
url: `${process.env.HostName}?message=${JSON.stringify(Buffer.from(message).toString("base64"))}`,
width: 500,
height: 736
},
}
On the client side I then get the search query and convert it back do the following
const urlParams = new URLSearchParams(window.location.search);
const message = urlParams.get('message');
// Needed to remove the quotes and convert spaces to "+" as this was getting lost
const data = atob(message.replace(/"/g,"").replace(/\s/g, "+"));
NOTE: I was only doing this for a single string, but I don't see why would couldn't use an object if you converted it to a string on the server then parsed it on the client.
Hope this helps
You can check out this Sample. Here you have HTML pages which can be customized. You can create your own webpages and integrate in the task module.

Windows 10 IoT Core, Sharing SPI data

My windows 10 IOT core application uses SPI to collect change notifications of
many entities. There are excellent examples for launching a timer to get SPI data, update data and binding UI elements to this data. The result is anytime SPI gets some data about a changed entity, the data that drives the UI is updated and any UI element bound to this data is updated. I can even change what subset of data is displayed on this page by using two way bindings to track the selected items on a list.
Just like the many examples, my code is structured as follows:
public async void Init_SPI()
{
....
periodicTimer = new Timer(this.TimerCallback, null, 0, 10);
} // public async void Init_SPI()
private void TimerCallback(object state)
{
/* UI updates must be invoked on the UI thread */
var task =
this.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{ ... update states of data that many be bound to UI element
My issue / question:
I don't see how to update data for multiple pages based on the above, since this.variable refers to the UI thread of the page that launched the timer.
It would be too inefficient to update a static class and have the multiple pages continuously poll this static data to make the UI track these large number of element.
My only thought at present is to code all the XAML pages in one page and tab between these "virtual" pages. I would rather have multiple pages to keep the functionality of these pages separated.
Any suggestions for how I could update multiple pages from data read on a SPI port would be appreciated.
Regards,
John
Sorry for a very late answer, but my solution would be to still create "real" pages -- but "relayed" the data only to the currently visible page. So whenever a page becomes visible I would have made the internals of the code piece above { ... update states of data [...] to point out that page.
This could be achieved with a simple switch statement, or by a simple interface with a HandleSpiData(TheSpiData) method -- or even a simple Action<YourSpiData>.

Painting frames while media session is paused

I'm working on a custom video player using the Media Foundation framework.
Currently, I can play, pause, stop or change the rate of the playback using an IMFMediaSession.
I can also retrieve a single frame using an IMFSourceReader.
I am currently able to render a frame (IMFSample) to a window area (a HWND) but only when the media session is stopped.
My goal is to be able to render a frame while the media session is paused.
(= doing frame-stepping using a source reader and not the media session)
I'm using GetDC, CreateBitmap, SelectObject and BitBlt to render my frame.
I tried using directd3d interfaces to fill it with a solid color (I'm really new to direct3d so followed a basic tutorial) but it didn't work.
Here is what I did : retrieving an IDirect3DDeviceManager9 with MR_VIDEO_ACCELERATION_SERVICE, doing OpenDeviceHandle, LockDevice, Clear, Begin/EndScene and Present.
None of these calls fail but I suspect the EVR is still painting the last frame.
So basically, I want the EVR to stop repainting its frame when I want and of course, I need to re-enable its painting process.
Any idea how to do that ?
Thanks
I finally got it working.
If you're interested, do the following:
retrieve IMFVideoDisplayControl and IMFVideoMixerBitmap from the media session using MFGetService
set up MFVideoAlphaBitmap structure and feed it to IMFVideoMixerBitmap::SetAlphaBitmap (there is a working example at the dedicated MSDN page)
call IMFVideoDisplayControl::RepaintVideo to update the output
To hide the previous content, don't set the alpha so that it's opaque.
Call IMFVideoMixerBitmap::ClearAlphaBitmap to get the previous content back.
And voilĂ  !

YUI widgets - dynamic updates

I am new to web programming and of course to YUI.
I tried using the overlay, chart and node-menunav.
Wanted to know if there is any option of creating these widgets using dynamic data coming in JSON format and updating the widgets as the new data comes in?
For us all the properties will come in JSON data from server and then using that data we need to render menubars, charts, property browser. Now i am not finding how to proceed with this requirement.
Thanks.
There is no default way of syncing widgets via Ajax. The only widget that comes by default with ways of updating its data is the DataTable widget. For the rest, and even for DataTable's attributes, you need to do it yourself.
However, if the data and widgets are complicated enough, you should consider using the YUI App Framework. The combination of Models and Views will help you a lot for creating complex layouts with widgets. Model will give you a way to link attributes to a JSON backend easily, specially if you're using a RESTful API endpoint. And View will give you tools for setting up the markup and reacting to events.
The Model's load and change events will let you know when the data updates. So in your view you'll be able to react to these events and set the corresponding attributes in your widgets:
var MyView = Y.Base.create('myView', Y.View, [], {
initializer: function () {
this.get('model').on('change', this._updateWidgets, this);
},
_updateWidgets: function () {
var model = this.get('model');
this.someWidget.set('someAttr', mode.get('someAttr'));
}
});
But as I said there is no right way of doing this. You can use whatever technique you like. The App framework is just a set of basic components that you can use to structure you application. It's designed for flexibility so it can accommodate many ways of using it. Other ways could use IO directly or use DataSources combined with Widget Plugins. This is a question with many correct answers.

Show alert with Indeterminate progress indicator Nokia Full Touch j2me

Does anyone know how to show a spinner for progress bar in a j2me alert?
Here is my piece of code so far:
loadingDialog = new Alert("Please Wait","Please Wait.",null,AlertType.INFO);
Gauge gau = new Gauge( null, false,
Gauge.INDEFINITE,
Gauge.CONTINUOUS_RUNNING );
loadingDialog.setIndicator(gau);
loadingDialog.setTimeout(500000);
displays.setCurrent(loadingDialog);
I am getting a horizontal line (like a slider). What I want is a spinner in place of it.
http://www.developer.nokia.com/Resources/Library/Full_Touch/ui-components/progress-indication.html
The second image (labelled non interactive gauge) of the link is what I am looking for:
The way how you create Gauge looks about right, in accordance with instructions given at Nokia page you refer as well as with Gauge API javadocs (available online):
CONTINUOUS_RUNNING
The value representing the continuous-running state of a non-interactive Gauge with indefinite range.
...
INDEFINITE
A special value used for the maximum value in order to indicate that the Gauge has indefinite range.
Explanation at Nokia page (somewhat vague) suggests the most likely reason for the issue you describe is that Nokia shows spinner only in forms, not in alerts:
- Indefinite gauge in Java Form uses spinner.
- An Alert uses a "barber shop roll" (animated bar of fixed length).
The way to test above assumption is to put Gauge like yours into the Form instead of Alert and see how device / emulator displays it.
If Form shows spinner, then the most straightforward workaround is to use Form instead of Alert. In this case, since Form lack "dismissal" feature provided by Alert, you would have to implement it yourself - eg by using TimerTask to schedule form replacement with previous screen.
Hehehe, the clue is in the link you gave --
Java Alerts do not use spinners due to layout constraints.
So it's not possible!

Resources