diff --git a/examples/androidextras/androidextras.pro b/examples/androidextras/androidextras.pro new file mode 100644 index 0000000000000000000000000000000000000000..31640adb2ecbc0f62d623bc29e2719a0b6071723 --- /dev/null +++ b/examples/androidextras/androidextras.pro @@ -0,0 +1,5 @@ +TEMPLATE = subdirs +android { + SUBDIRS += notification + EXAMPLE_FILES += notification +} diff --git a/examples/androidextras/notification/android-sources/AndroidManifest.xml b/examples/androidextras/notification/android-sources/AndroidManifest.xml new file mode 100644 index 0000000000000000000000000000000000000000..a7f10eb12ad96fcf34d432fbc4336dc7f44305b1 --- /dev/null +++ b/examples/androidextras/notification/android-sources/AndroidManifest.xml @@ -0,0 +1,38 @@ +<?xml version='1.0' encoding='utf-8'?> +<manifest android:versionCode="1" package="org.qtproject.example" xmlns:android="http://schemas.android.com/apk/res/android" android:versionName="1.0"> + <application android:icon="@drawable/icon" android:name="org.qtproject.qt5.android.bindings.QtApplication" android:label="@string/app_name"> + <activity android:name="org.qtproject.example.notification.NotificationClient" android:label="@string/app_name" android:screenOrientation="unspecified" android:configChanges="orientation|locale|fontScale|keyboard|keyboardHidden|navigation"> + <intent-filter> + <action android:name="android.intent.action.MAIN"/> + <category android:name="android.intent.category.LAUNCHER"/> + </intent-filter> + <meta-data android:name="android.app.qt_sources_resource_id" android:resource="@array/qt_sources"/> + <meta-data android:name="android.app.repository" android:value="@string/repository"/> + <meta-data android:name="android.app.qt_libs_resource_id" android:resource="@array/qt_libs"/> + <meta-data android:name="android.app.bundled_libs_resource_id" android:resource="@array/bundled_libs"/> + <meta-data android:name="android.app.lib_name" android:value="@string/app_lib_name"/> + <!-- Deploy Qt libs as part of package --> + <meta-data android:name="android.app.bundle_local_qt_libs" android:value="1"/> + <meta-data android:name="android.app.bundled_in_lib_resource_id" android:resource="@array/bundled_in_lib"/> + <meta-data android:name="android.app.bundled_in_assets_resource_id" android:resource="@array/bundled_in_assets"/> + <!-- Run with local libs --> + <meta-data android:name="android.app.use_local_qt_libs" android:value="1"/> + <meta-data android:name="android.app.libs_prefix" android:value="/data/local/tmp/qt/"/> + <meta-data android:name="android.app.load_local_libs" android:value="@string/local_libs"/> + <meta-data android:name="android.app.load_local_jars" android:value="@string/local_jars"/> + <meta-data android:name="android.app.static_init_classes" android:value="@string/init_classes"/> + <!-- Messages maps --> + <meta-data android:name="android.app.ministro_not_found_msg" android:value="@string/ministro_not_found_msg"/> + <meta-data android:name="android.app.ministro_needed_msg" android:value="@string/ministro_needed_msg"/> + <meta-data android:name="android.app.fatal_error_msg" android:value="@string/fatal_error_msg"/> + <!-- Messages maps --> + <!-- Splash screen --> + <meta-data android:name="android.app.splash_screen" android:resource="@layout/splash"/> + <!-- Splash screen --> + </activity> + </application> + <!-- %%INSERT_USES_SDK%% --> + <supports-screens android:normalScreens="true" android:anyDensity="true" android:smallScreens="true" android:largeScreens="true"/> + <uses-permission android:name="android.permission.INTERNET"/> + <uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE"/> +</manifest> diff --git a/examples/androidextras/notification/android-sources/src/org/qtproject/example/notification/NotificationClient.java b/examples/androidextras/notification/android-sources/src/org/qtproject/example/notification/NotificationClient.java new file mode 100644 index 0000000000000000000000000000000000000000..9901fdac84945163f96af222bfee3d4a9df622f7 --- /dev/null +++ b/examples/androidextras/notification/android-sources/src/org/qtproject/example/notification/NotificationClient.java @@ -0,0 +1,71 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +package org.qtproject.example.notification; + +import android.app.Notification; +import android.app.NotificationManager; +import android.content.Context; + +public class NotificationClient extends org.qtproject.qt5.android.bindings.QtActivity +{ + private static NotificationManager m_notificationManager; + private static Notification.Builder m_builder; + private static NotificationClient m_instance; + + public NotificationClient() + { + m_instance = this; + } + + public static void notify(String s) + { + if (m_notificationManager == null) { + m_notificationManager = (NotificationManager)m_instance.getSystemService(Context.NOTIFICATION_SERVICE); + m_builder = new Notification.Builder(m_instance); + m_builder.setSmallIcon(R.drawable.icon); + m_builder.setContentTitle("A message from Qt!"); + } + + m_builder.setContentText(s); + m_notificationManager.notify(1, m_builder.build()); + } +} diff --git a/examples/androidextras/notification/androidjnibindings.cpp b/examples/androidextras/notification/androidjnibindings.cpp new file mode 100644 index 0000000000000000000000000000000000000000..98280c2d3aa1985dff0cffd652fee7b7e81843c8 --- /dev/null +++ b/examples/androidextras/notification/androidjnibindings.cpp @@ -0,0 +1,68 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "androidjnibindings.h" + +jint JNICALL JNI_OnLoad(JavaVM *vm, void *) +{ + JNIEnv *env; + if (vm->GetEnv(reinterpret_cast<void **>(&env), JNI_VERSION_1_4) != JNI_OK) { + qFatal("Couldn't initialize environment!"); + return -1; + } + + AndroidJNIBindings::detectNotificationClientClass(env); + + return JNI_VERSION_1_4; +} + +jclass AndroidJNIBindings::m_notificationClientClass = 0; +void AndroidJNIBindings::detectNotificationClientClass(JNIEnv *environment) +{ + jclass clazz = environment->FindClass("org/qtproject/example/notification/NotificationClient"); + if (clazz == 0) { + environment->ExceptionDescribe(); + environment->ExceptionClear(); + return; + } + + m_notificationClientClass = reinterpret_cast<jclass>(environment->NewGlobalRef(clazz)); +} diff --git a/examples/androidextras/notification/androidjnibindings.h b/examples/androidextras/notification/androidjnibindings.h new file mode 100644 index 0000000000000000000000000000000000000000..64cca546f1c5a84f027d29dccae97bdd275448d5 --- /dev/null +++ b/examples/androidextras/notification/androidjnibindings.h @@ -0,0 +1,61 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef ANDROIDJNIBINDINGS_H +#define ANDROIDJNIBINDINGS_H + +#include <QtAndroidExtras/QJNIObject> + +class AndroidJNIBindings +{ +public: + static jclass notificationClientClass() + { + return m_notificationClientClass; + } + + static void detectNotificationClientClass(JNIEnv *environment); + +private: + static jclass m_notificationClientClass; +}; + +#endif // ANDROIDJNIBINDINGS_H diff --git a/examples/androidextras/notification/images/happy.png b/examples/androidextras/notification/images/happy.png new file mode 100644 index 0000000000000000000000000000000000000000..d1c146090dc00c4e90f38895afd71dbc44d93bff Binary files /dev/null and b/examples/androidextras/notification/images/happy.png differ diff --git a/examples/androidextras/notification/images/sad.png b/examples/androidextras/notification/images/sad.png new file mode 100644 index 0000000000000000000000000000000000000000..00026bd23bcf64bda06d1ae4196bb8321bef4e29 Binary files /dev/null and b/examples/androidextras/notification/images/sad.png differ diff --git a/examples/androidextras/notification/main.cpp b/examples/androidextras/notification/main.cpp new file mode 100644 index 0000000000000000000000000000000000000000..8ed8d3029ca905590860ece84d65645d1b8b953d --- /dev/null +++ b/examples/androidextras/notification/main.cpp @@ -0,0 +1,62 @@ + +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include <QtGui> +#include <QtQuick> + +#include "notificationclient.h" + +int main(int argc, char **argv) +{ + QGuiApplication app(argc, argv); + + QQuickView view; + + NotificationClient *notificationClient = new NotificationClient(&view); + view.engine()->rootContext()->setContextProperty(QLatin1String("notificationClient"), + notificationClient); + view.setResizeMode(QQuickView::SizeRootObjectToView); + view.setSource(QUrl(QStringLiteral("qrc:/qml/main.qml"))); + view.show(); + + return app.exec(); +} diff --git a/examples/androidextras/notification/main.qrc b/examples/androidextras/notification/main.qrc new file mode 100644 index 0000000000000000000000000000000000000000..10190c96fe912e5583f15cec1b74cf8ed14af861 --- /dev/null +++ b/examples/androidextras/notification/main.qrc @@ -0,0 +1,7 @@ +<RCC> + <qresource prefix="/"> + <file>qml/main.qml</file> + <file>images/happy.png</file> + <file>images/sad.png</file> + </qresource> +</RCC> diff --git a/examples/androidextras/notification/notification.pro b/examples/androidextras/notification/notification.pro new file mode 100644 index 0000000000000000000000000000000000000000..9d57ca3acf271b2c1d20ee5435afef1c7c15c66d --- /dev/null +++ b/examples/androidextras/notification/notification.pro @@ -0,0 +1,24 @@ +QT += quick androidextras + +ANDROID_PACKAGE_SOURCE_DIR = $$PWD/android-sources +ANDROID_PACKAGE = org.qtproject.example.notification +ANDROID_MINIMUM_VERSION = 16 +ANDROID_TARGET_VERSION = 16 +ANDROID_APP_NAME = Qt Notifier + +SOURCES += \ + main.cpp \ + notificationclient.cpp \ + androidjnibindings.cpp + +OTHER_FILES += \ + qml/main.qml \ + android-sources/src/org/qtproject/example/notification/NotificationClient.java \ + android-sources/AndroidManifest.xml + +RESOURCES += \ + main.qrc + +HEADERS += \ + notificationclient.h \ + androidjnibindings.h diff --git a/examples/androidextras/notification/notificationclient.cpp b/examples/androidextras/notification/notificationclient.cpp new file mode 100644 index 0000000000000000000000000000000000000000..d9cbf84394db1ff42d1b45d2107ecbd4e38def71 --- /dev/null +++ b/examples/androidextras/notification/notificationclient.cpp @@ -0,0 +1,74 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "notificationclient.h" +#include "androidjnibindings.h" + +#include <QtAndroidExtras/QJNIObject> + +NotificationClient::NotificationClient(QObject *parent) + : QObject(parent) +{ + connect(this, SIGNAL(notificationChanged()), this, SLOT(updateAndroidNotification())); +} + +void NotificationClient::setNotification(const QString ¬ification) +{ + if (m_notification == notification) + return; + + m_notification = notification; + emit notificationChanged(); +} + +QString NotificationClient::notification() const +{ + return m_notification; +} + +void NotificationClient::updateAndroidNotification() +{ + QJNIObject javaNotification = QJNIObject::fromString(m_notification); + QJNIObject::callStaticMethod<void>(AndroidJNIBindings::notificationClientClass(), + "notify", + "(Ljava/lang/String;)V", + javaNotification.object<jstring>()); +} diff --git a/examples/androidextras/notification/notificationclient.h b/examples/androidextras/notification/notificationclient.h new file mode 100644 index 0000000000000000000000000000000000000000..6b48fc736d03ac18a18acd9882c774875dc1dbb8 --- /dev/null +++ b/examples/androidextras/notification/notificationclient.h @@ -0,0 +1,67 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#ifndef NOTIFICATIONCLIENT_H +#define NOTIFICATIONCLIENT_H + +#include <QObject> + +class NotificationClient : public QObject +{ + Q_OBJECT + Q_PROPERTY(QString notification READ notification WRITE setNotification NOTIFY notificationChanged) +public: + explicit NotificationClient(QObject *parent = 0); + + void setNotification(const QString ¬ification); + QString notification() const; + +signals: + void notificationChanged(); + +private slots: + void updateAndroidNotification(); + +private: + QString m_notification; +}; + +#endif // NOTIFICATIONCLIENT_H diff --git a/examples/androidextras/notification/qml/main.qml b/examples/androidextras/notification/qml/main.qml new file mode 100644 index 0000000000000000000000000000000000000000..e265f1bac1f0888c2d6a46d08645d11df8ce090c --- /dev/null +++ b/examples/androidextras/notification/qml/main.qml @@ -0,0 +1,106 @@ +/**************************************************************************** +** +** Copyright (C) 2013 Digia Plc and/or its subsidiary(-ies). +** Contact: http://www.qt-project.org/legal +** +** This file is part of the QtWinExtras module of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and Digia. For licensing terms and +** conditions see http://qt.digia.com/licensing. For further information +** use the contact form at http://qt.digia.com/contact-us. +** +** GNU Lesser General Public License Usage +** Alternatively, this file may be used under the terms of the GNU Lesser +** General Public License version 2.1 as published by the Free Software +** Foundation and appearing in the file LICENSE.LGPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU Lesser General Public License version 2.1 requirements +** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. +** +** In addition, as a special exception, Digia gives you certain additional +** rights. These rights are described in the Digia Qt LGPL Exception +** version 1.1, included in the file LGPL_EXCEPTION.txt in this package. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3.0 as published by the Free Software +** Foundation and appearing in the file LICENSE.GPL included in the +** packaging of this file. Please review the following information to +** ensure the GNU General Public License version 3.0 requirements will be +** met: http://www.gnu.org/copyleft/gpl.html. +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +import QtQuick 2.0 + +Rectangle { + width: 500 + height: 500 + color: "white" + + Column { + anchors.fill: parent + spacing: (height - happyButton.height - sadButton.height - title.height) / 3 + + Text { + id: title + color: "black" + font.pixelSize: parent.width / 20 + text: "How are you feeling?" + width: parent.width + horizontalAlignment: Text.AlignHCenter + } + + Image { + id: happyButton + height: parent.height / 5 + fillMode: Image.PreserveAspectFit + source: "../images/happy.png" + anchors.horizontalCenter: parent.horizontalCenter + smooth: true + + Behavior on scale { + PropertyAnimation { + duration: 100 + } + } + + MouseArea { + anchors.fill: parent + onClicked: notificationClient.notification = "User is happy!" + onPressed: happyButton.scale = 0.9 + onReleased: happyButton.scale = 1.0 + } + } + + Image { + id: sadButton + height: parent.height / 5 + fillMode: Image.PreserveAspectFit + source: "../images/sad.png" + anchors.horizontalCenter: parent.horizontalCenter + smooth: true + + Behavior on scale { + PropertyAnimation { + duration: 100 + } + } + + MouseArea { + anchors.fill: parent + onClicked: notificationClient.notification = "User is sad :(" + onPressed: sadButton.scale = 0.9 + onReleased: sadButton.scale = 1.0 + } + } + } +} diff --git a/examples/examples.pro b/examples/examples.pro new file mode 100644 index 0000000000000000000000000000000000000000..467ccc454c3ab1472a5cedfe4da5d5533f341f72 --- /dev/null +++ b/examples/examples.pro @@ -0,0 +1,2 @@ +TEMPLATE = subdirs +android:SUBDIRS += androidextras diff --git a/src/androidextras/doc/images/notification.png b/src/androidextras/doc/images/notification.png new file mode 100644 index 0000000000000000000000000000000000000000..4ba7818cc26485aaa57a9adfb229f8fc17fd9200 Binary files /dev/null and b/src/androidextras/doc/images/notification.png differ diff --git a/src/androidextras/doc/qtandroidextras.qdocconf b/src/androidextras/doc/qtandroidextras.qdocconf index 9e123bb195f5e5733f02131192f4d9700cd21760..02e539011556eac45a14fa31a9d5306b4a5ed78a 100644 --- a/src/androidextras/doc/qtandroidextras.qdocconf +++ b/src/androidextras/doc/qtandroidextras.qdocconf @@ -29,7 +29,7 @@ tagfile = ../../../doc/qtandroidextras/qtandroidextras.tags depends += qtcore headerdirs += .. sourcedirs += .. -exampledirs += ../../../examples/qtandroidextras \ +exampledirs += ../../../examples/androidextras \ ../ \ snippets