How can I remove the Chromecast volume button? - volume

I developed https://play.google.com/store/apps/details?id=com.kunert.einsteinstictactoe. When the user hits the Chromecast button the first time he is able to connect to a Chromecast device. If he hits it the second time after being connected he is able to adjust the volume or to disconnect.
As my application currently doesn't support sound I want to hide the volume adjustment.
Is this possible?

It is possible. You need to define your own MediaRouteDialogFactory and in there, return your own MediaRouteControllerDialogFragment implementation. In your implementation of that fragment, in onCreateControllerDialog, you need to set setVolumeControlEnabled(false). See the package com.google.sample.castcompanionlibrary.cast.dialog.video in CCL which has all of these for its implementation.

Related

Is it possible in Qt to catch the event of an extra monitor being connected or disconnected?

When I use my laptop at home there is an extra monitor connected to it. However sometimes I disconnect the second display (D2) temporarily (for instance because I need the ThunderBolt connection on my Mac). Usually the OS takes care of moving all the visible windows that were visible on D2 to the first display (D1). However if the resolution of D1 is much higher than D0 windows are shrunk just enough the fill the whole screen of D0. This is ugly and inconvenient for the user.
So my question: is it possible to write an event handler or event filter for the occurrence of the event of connecting or disconnecting a second monitor? There might be other uses than the one I described above. Perhaps it is impossible because the OS does not tell any application that the windows were moved.
QDesktopWidget provides the signal screenCountChanged(int). One thing to note is that if screen mirroring is enabled, the screen count will be 1, but if the second screen is detached the screenCountChanged(..) signal is not emitted but the main screen may resize, so you may want to also checkout QDesktopWidget::resized(int).

Using WatchKit, is there a method to keep the screen on?

My app displays various countdown timers that the user will view to see when to do various tasks. I'd like this screen to stay on display on the watch while the app is in the foreground. Currently, the screen will auto-turn off and if I stay away from flicking my wrist, the app will even become suspended.
Is this just something I'm going to have to design around, or is there a method I can't find to change this behavior?
There is no method in WatchKit to programmatically keep an app alive/awake. As you've suggested, you'll have to design around this limitation.
The correct way to have a countdown timer on the watch is to add it to the complication.
It supports a timer automatically when you provide a future date
CLKRelativeDateTextProvider(date: wakeupDate, style: .timer, units: .second)

Is there anyway in flex to poll the keyboard?

I'd like to tell if a certain key is being held down around the startup of my AIR (desktop) application, and I'd like to tell if a specific key (ALT in this case) is being held down. Unfortunately, flex seems to be so event based that there is no way poll the keyboard directly. Can anyone verify this?
I know that it's possible to take the keyboard events and keep track manually. However, this won't work if the user presses the key right before startup, so it isn't a solution for my specific problem.
In my app I track ctrl pressed via listening stage MOUSE_MOVE, MOUSE_DOWN and KEY_DOWN. MouseEvent has ctrlKey and altKey properties. I store state in some static variable . When I longer need this I unsubscribe from these events.
If you listen for key up, then you should hear this if the key was down. So you won't actually know right at startup, but when they release the key. You can unsubscribe from that event at some point that you determine is "after startup."

Bring a window to the front in Maemo

I've got a Maemo (Qt) app that does some integration with the built-in media player via D-Bus. All the control functionality I need is complete, but I've got a requirement to show my application window (which gets backgrounded when playback starts) instead of the media player when the playback window is closed (it's a stacked window).
It should go like this: user clicks item in my Qt application, which launches the media file in the native media player. User watches media file, exits by clicking the arrow on the playback window. I'd like to somehow catch this event and bring my application to the front instead of showing the media player's main window.
Is it even possible on Maemo? I'm thinking that some low-level X coding might be required.
Answer was painfully obvious, I can catch a state_changed signal from D-Bus- state=0 when the window is closed.
You can also use the raise() method of Qt windows.

Creating an interactive website

I want to create an interactive website using aspx and ajax, that there will be an option to create chess game room for example and other players will be able to join.
I have 2 Questions:
I wonder if you have any idea how can I make that after one player clicks on a button and finish his turn, the other player will be able to do a move.
After the first player finish his turn I will change the turn by using the database, but the point is how can I refresh the other player's site so when the other one finish his turn, the turn will come to the second player?
When someone creates a room and than close his browser - I need that room to be closed.
Shall I use the Session_OnEnd to close the room he opened?
Thanks!
I wonder if you have any idea how can
I make that after one player clicks on
a button and finish his turn, the
other player will be able to do a
move.
There are a lot of ways you can do this. If it was me I would have a "moves" database table or something and track whos move it is in there. Then on the page have SetInterval() javascript method that uses an ajax service to look in that "moves" table and determine when it is the users turn.
When someone creates a room and than
close his browser - I need that room
to be closed. Shall I use the
Session_OnEnd to close the room he
opened?
You can use Session_OnEnd. As an alternative you could use the ajax method that checks the moves table to see when a user hasn't checked in x minutes, then close their session.
The simplest way is probably to do a simple heartbeat/polling on each client to see if it is his/her turn yet. Although, push/comet has been getting easier and easier these days.
If you're already using a polling/heartbeat technique, it would be trivial to close a session after, say, 5 missed heartbeats.

Resources