From 9f02e451dd2f91c217d73c8029bb939b3a211672 Mon Sep 17 00:00:00 2001 From: Naveen Bobbili Date: Sun, 28 Apr 2019 20:51:16 -0700 Subject: Code commit by ICS team to add Alexa Voice Chrome to Homescreen App. Change-Id: I2052e345baaf4306e8e3f27a01bc6940f4d27d88 Signed-off-by: Naveen Bobbili --- homescreen/qml/SpeechChrome.qml | 112 +++++++++++++++++++++ homescreen/qml/images/SpeechChrome/bar.png | Bin 0 -> 23826 bytes .../qml/images/SpeechChrome/push_to_talk.png | Bin 0 -> 1544 bytes .../qml/images/SpeechChrome/speechchrome.qrc | 6 ++ homescreen/qml/main.qml | 7 ++ homescreen/qml/qml.qrc | 1 + 6 files changed, 126 insertions(+) create mode 100644 homescreen/qml/SpeechChrome.qml create mode 100644 homescreen/qml/images/SpeechChrome/bar.png create mode 100644 homescreen/qml/images/SpeechChrome/push_to_talk.png create mode 100644 homescreen/qml/images/SpeechChrome/speechchrome.qrc (limited to 'homescreen/qml') diff --git a/homescreen/qml/SpeechChrome.qml b/homescreen/qml/SpeechChrome.qml new file mode 100644 index 0000000..aba8283 --- /dev/null +++ b/homescreen/qml/SpeechChrome.qml @@ -0,0 +1,112 @@ +import QtQuick 2.0 +import SpeechChrome 1.0 + +Item { + id: root + + clip: true + + 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 + + anchors.right: parent.right + anchors.verticalCenter: parent.verticalCenter + source: "./images/SpeechChrome/push_to_talk.png" + + 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 + } + } + ] +} diff --git a/homescreen/qml/images/SpeechChrome/bar.png b/homescreen/qml/images/SpeechChrome/bar.png new file mode 100644 index 0000000..caabde1 Binary files /dev/null and b/homescreen/qml/images/SpeechChrome/bar.png differ diff --git a/homescreen/qml/images/SpeechChrome/push_to_talk.png b/homescreen/qml/images/SpeechChrome/push_to_talk.png new file mode 100644 index 0000000..f45218e Binary files /dev/null and b/homescreen/qml/images/SpeechChrome/push_to_talk.png differ diff --git a/homescreen/qml/images/SpeechChrome/speechchrome.qrc b/homescreen/qml/images/SpeechChrome/speechchrome.qrc new file mode 100644 index 0000000..8ab1472 --- /dev/null +++ b/homescreen/qml/images/SpeechChrome/speechchrome.qrc @@ -0,0 +1,6 @@ + + + bar.png + push_to_talk.png + + diff --git a/homescreen/qml/main.qml b/homescreen/qml/main.qml index 7d40276..d74fd1f 100644 --- a/homescreen/qml/main.qml +++ b/homescreen/qml/main.qml @@ -90,6 +90,13 @@ Window { } } + SpeechChrome { + anchors.left: parent.left + anchors.right: parent.right + anchors.bottom: parent.bottom + height: 215 + } + Connections { target: homescreenHandler onShowInformation: { diff --git a/homescreen/qml/qml.qrc b/homescreen/qml/qml.qrc index e60ea63..d901481 100644 --- a/homescreen/qml/qml.qrc +++ b/homescreen/qml/qml.qrc @@ -10,5 +10,6 @@ StatusArea.qml TopArea.qml IconItem.qml + SpeechChrome.qml -- cgit 1.2.3-korg