/
JNIServo.java
82 lines (50 loc) · 2.02 KB
/
JNIServo.java
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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
/* -*- Mode: Java; c-basic-offset: 4; tab-width: 4; indent-tabs-mode: nil; -*-
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
package com.mozilla.servoview;
import android.app.Activity;
/**
* Maps /ports/libsimpleservo API
*/
@SuppressWarnings("JniMissingFunction")
public class JNIServo {
JNIServo() {
System.loadLibrary("c++_shared");
System.loadLibrary("simpleservo");
}
public native String version();
public native void init(Activity activity,
String args,
String url,
Callbacks callbacks,
int width, int height, boolean log);
public native void setBatchMode(boolean mode);
public native void performUpdates();
public native void resize(int width, int height);
public native void reload();
public native void stop();
public native void refresh();
public native void goBack();
public native void goForward();
public native void loadUri(String uri);
public native void scrollStart(int dx, int dy, int x, int y);
public native void scroll(int dx, int dy, int x, int y);
public native void scrollEnd(int dx, int dy, int x, int y);
public native void pinchZoomStart(float factor, int x, int y);
public native void pinchZoom(float factor, int x, int y);
public native void pinchZoomEnd(float factor, int x, int y);
public native void click(int x, int y);
public interface Callbacks {
void wakeup();
void flush();
void makeCurrent();
void onAnimatingChanged(boolean animating);
void onLoadStarted();
void onLoadEnded();
void onTitleChanged(String title);
void onUrlChanged(String url);
void onHistoryChanged(boolean canGoBack, boolean canGoForward);
byte[] readfile(String file);
}
}