diff options
author | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-04-22 23:18:07 +0200 |
---|---|---|
committer | J-P Nurmi <jpnurmi@theqtcompany.com> | 2015-04-23 08:33:38 +0000 |
commit | d97b0a39b68db7f4823e66620d4402bec8ee4165 (patch) | |
tree | 32f4f1f02a7c4a7fda4653aedb5f9b70148486b4 /src/java/qt/android/view/QtViewListener.java | |
parent | 4af4bd7a84df303582e13785103849a297ea38ae (diff) |
Deploy appropriate Java files
QT += qmlandroid
QMLANDROID_PACKAGES = app support view widget
Avoids the hard dependency to Android Support libraries.
Change-Id: Id5a48b0e8bd368485977dc232520b2fa90415cfa
Reviewed-by: J-P Nurmi <jpnurmi@theqtcompany.com>
Diffstat (limited to 'src/java/qt/android/view/QtViewListener.java')
-rw-r--r-- | src/java/qt/android/view/QtViewListener.java | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/src/java/qt/android/view/QtViewListener.java b/src/java/qt/android/view/QtViewListener.java new file mode 100644 index 0000000..2b724e4 --- /dev/null +++ b/src/java/qt/android/view/QtViewListener.java @@ -0,0 +1,47 @@ +package qt.android.view; + +import android.view.View; +import android.widget.AdapterView; + +public class QtViewListener implements View.OnClickListener, + View.OnFocusChangeListener, + View.OnLayoutChangeListener, + View.OnLongClickListener +{ + public QtViewListener(View view, long instance) { + m_instance = instance; + if (!(view instanceof AdapterView)) { + view.setOnClickListener(this); + view.setOnLongClickListener(this); + } + view.setOnFocusChangeListener(this); + view.addOnLayoutChangeListener(this); + } + + @Override + public void onClick(View view) { + onClick(m_instance); + } + + @Override + public void onFocusChange(View view, boolean hasFocus) { + onFocusChange(m_instance, hasFocus); + } + + @Override + public void onLayoutChange(View view, int left, int top, int right, int bottom, + int oldLeft, int oldTop, int oldRight, int oldBottom) { + onLayoutChange(m_instance, left, top, right, bottom); + } + + @Override + public boolean onLongClick(View view) { + return false; // TODO: onLongClick(m_instance); + } + + private long m_instance; + private static native void onClick(long instance); + private static native void onFocusChange(long instance, boolean hasFocus); + private static native void onLayoutChange(long instance, int left, int top, int right, int bottom); + private static native boolean onLongClick(long instance); +} |