26 lines
717 B
QML
26 lines
717 B
QML
|
import QtQuick 2.0
|
||
|
import AndroidNative 1.0
|
||
|
|
||
|
Item {
|
||
|
/// The message that will be displayed when show() is called
|
||
|
property string text: ''
|
||
|
|
||
|
/// If set to true, the toast duration will be long
|
||
|
property bool longDuration: false
|
||
|
|
||
|
readonly property string m_TOAST_MESSAGE: "androidnative.Toast.showToast"
|
||
|
|
||
|
/// Displays the Toast with the current set text and duration
|
||
|
function show() {
|
||
|
SystemDispatcher.dispatch(m_TOAST_MESSAGE, {
|
||
|
text: text,
|
||
|
longLength: longDuration
|
||
|
});
|
||
|
}
|
||
|
|
||
|
Component.onCompleted: {
|
||
|
SystemDispatcher.loadClass("androidnative.Toast");
|
||
|
}
|
||
|
}
|
||
|
|