1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
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);
}
|