blob: 888e5884a0962fc834c3503bd570bf74ef0e70e7 (
plain)
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
|
package org.libreoffice;
import android.os.Handler;
import android.util.DisplayMetrics;
public class LOKitShell {
private static final String LOGTAG = LOKitShell.class.getSimpleName();
public static float getDpi() {
DisplayMetrics metrics = LibreOfficeMainActivity.mAppContext.getResources().getDisplayMetrics();
return metrics.density * 160;
}
public static void sendEvent(LOEvent event) {
if (LibreOfficeMainActivity.mAppContext != null && LibreOfficeMainActivity.mAppContext.getLOKitThread() != null) {
LibreOfficeMainActivity.mAppContext.getLOKitThread().queueEvent(event);
}
}
// Get a Handler for the main java thread
public static Handler getMainHandler() {
return LibreOfficeMainActivity.mAppContext.mMainHandler;
}
public static void queueRedraw() {
LOKitShell.sendEvent(LOEventFactory.redraw());
}
public static void showProgressSpinner() {
getMainHandler().post(new Runnable() {
@Override
public void run() {
LibreOfficeMainActivity.mAppContext.showProgressSpinner();
}
});
}
public static void hideProgressSpinner() {
getMainHandler().post(new Runnable() {
@Override
public void run() {
LibreOfficeMainActivity.mAppContext.hideProgressSpinner();
}
});
}
public static DisplayMetrics getDisplayMetrics() {
if (LibreOfficeMainActivity.mAppContext == null) {
return null;
}
DisplayMetrics metrics = new DisplayMetrics();
LibreOfficeMainActivity.mAppContext.getWindowManager().getDefaultDisplay().getMetrics(metrics);
return metrics;
}
}
|