summaryrefslogtreecommitdiff
path: root/android/experimental/LOAndroid3/src/java/org/libreoffice/LOKitShell.java
blob: 859a3d8eccbaf102132f02114f7940cb3e43d3a5 (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
package org.libreoffice;


import android.os.Handler;
import android.util.DisplayMetrics;
import android.util.Log;


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);
        }
    }

    public static void viewSizeChanged() {
        Log.i(LOGTAG, "viewSizeChanged");
    }

    // Get a Handler for the main java thread
    public static Handler getMainHandler() {
        return LibreOfficeMainActivity.mAppContext.mMainHandler;
    }

    public static void queueRedraw() {
        LOKitShell.sendEvent(LOEventFactory.redraw());
    }
}