diff options
author | Naveen Bobbili <nbobbili@amazon.com> | 2019-04-28 20:51:16 -0700 |
---|---|---|
committer | Scott Murray <scott.murray@konsulko.com> | 2019-10-16 18:58:55 -0400 |
commit | f3de2f5cad06a772ee55f58694d559a7cb012c02 (patch) | |
tree | 95c2f3a30447831deda72625c8a60f077ac671ee /homescreen/qml/SpeechChrome.qml | |
parent | fb66fba2bfdd2f14adf9218e8a6d537c9121ed3c (diff) |
Add push to talk support to homescreen
Reworked version of Alexa specific changes from ICS to add push to
talk button for voice services to homescreen media area.
v2: change config.xml to audiomixer
v3: reworked to not be Alexa specific:
- Now use the default voiceagent if available, instead of hard-coding
Alexa usage
- The Alexa logo for the button has been replaced with a generic
microphone icon derived from the radio application's launcher icon.
This is a placeholder until a new icon is provided by LF graphics
team. Meeting any Amazon requirements around Alexa chrome is now
envisioned as being provided for with a TBD voiceagent API
enhancement.
- The QML for the PTT button has been moved to MediaAreaBlank.qml,
which seems a more logical location for it ATM. It is likely that
the MediaArea QML should be simplified in a future change, as it
currently contains a signficant amount of unused code.
- The PTT button has been moved to the left hand side of the media
area, as this seems more sensible if demonstrating driver usage.
- The delay on fade-out of the master volume slider has been lowered
to 3 seconds from 5, with the PTT button present it started seeming
excessive during testing.
- Some extra debug messages have been added to make tracking the
voiceagent state more straightforward.
Bug-AGL: SPEC-2764,
Change-Id: I2052e345baaf4306e8e3f27a01bc6940f4d27d88
Signed-off-by: Naveen Bobbili <nbobbili@amazon.com>
Signed-off-by: Jan-Simon Moeller <jsmoeller@linuxfoundation.org>
Signed-off-by: Scott Murray <scott.murray@konsulko.com>
Diffstat (limited to 'homescreen/qml/SpeechChrome.qml')
-rw-r--r-- | homescreen/qml/SpeechChrome.qml | 120 |
1 files changed, 120 insertions, 0 deletions
diff --git a/homescreen/qml/SpeechChrome.qml b/homescreen/qml/SpeechChrome.qml new file mode 100644 index 0000000..911d481 --- /dev/null +++ b/homescreen/qml/SpeechChrome.qml @@ -0,0 +1,120 @@ +import QtQuick 2.0 +import SpeechChrome 1.0 + +Item { + id: root + + clip: true + + property bool agentPresent: speechChromeController.agentPresent + + visible: agentPresent + + Image { + id: chromeBarImage + + anchors.top: parent.top + source: "./images/SpeechChrome/bar.png" + + Behavior on x { + NumberAnimation { duration: 250 } + } + Behavior on opacity { + NumberAnimation { duration: 250 } + } + } + + Image { + id: pushToTalk + + height: parent.height * 0.80 + width: height + + anchors.left: parent.left + anchors.leftMargin: parent.width / 128 + anchors.verticalCenter: parent.verticalCenter + source: "./images/SpeechChrome/push_to_talk.svg" + + MouseArea { + anchors.fill: parent + onPressed: speechChromeController.pushToTalk() + } + + Behavior on opacity { + NumberAnimation { duration: 250 } + } + } + + states: [ + State { + name: "Idle" + when: speechChromeController.chromeState == SpeechChromeController.Idle + PropertyChanges { + target: chromeBarImage + opacity: 0.0 + x: 0 + } + PropertyChanges { + target: pushToTalk + opacity: 1.0 + enabled: true + } + }, + State { + name: "Listening" + when: speechChromeController.chromeState == SpeechChromeController.Listening + PropertyChanges { + target: chromeBarImage + opacity: 1.0 + x: 0 + } + PropertyChanges { + target: pushToTalk + opacity: 0.0 + enabled: false + } + }, + State { + name: "Thinking" + when: speechChromeController.chromeState == SpeechChromeController.Thinking + PropertyChanges { + target: chromeBarImage + opacity: 1.0 + x: root.width - chromeBarImage.width + } + PropertyChanges { + target: pushToTalk + opacity: 0.0 + enabled: false + } + }, + State { + name: "Speaking" + when: speechChromeController.chromeState == SpeechChromeController.Speaking + PropertyChanges { + target: chromeBarImage + opacity: 1.0 + x: (root.width - chromeBarImage.width) * 0.5 + } + PropertyChanges { + target: pushToTalk + opacity: 0.0 + enabled: false + } + }, + State { + name: "MicrophoneOff" + when: speechChromeController.chromeState == SpeechChromeController.MicrophoneOff + PropertyChanges { + target: chromeBarImage + opacity: 0.0 + x: 0 + } + PropertyChanges { + target: pushToTalk + opacity: 1.0 + enabled: true + } + } + ] +} |