summaryrefslogtreecommitdiffstats
path: root/android/source/src/java/org/libreoffice/LOKitInputConnectionHandler.java
blob: bbef709af297bc46f44534b1bd4beb8c8b3d4e16 (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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
/* -*- Mode: Java; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*
 * This file is part of the LibreOffice project.
 *
 * 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 org.libreoffice;

import android.view.KeyEvent;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputConnection;

import org.mozilla.gecko.gfx.InputConnectionHandler;

/**
 * Implementation of InputConnectionHandler. When a key event happens it is
 * directed to this class which is then directed further to LOKitThread.
 */
public class LOKitInputConnectionHandler implements InputConnectionHandler {
    private static String LOGTAG = LOKitInputConnectionHandler.class.getSimpleName();

    @Override
    public InputConnection onCreateInputConnection(EditorInfo outAttrs) {
        return null;
    }

    /**
     * When key pre-Ime happens.
     */
    @Override
    public boolean onKeyPreIme(int keyCode, KeyEvent event) {
        return false;
    }

    /**
     * When key down event happens.
     */
    @Override
    public boolean onKeyDown(int keyCode, KeyEvent event) {
        LOKitShell.sendKeyEvent(event);
        return false;
    }

    /**
     * When key long press event happens.
     */
    @Override
    public boolean onKeyLongPress(int keyCode, KeyEvent event) {
        return false;
    }

    /**
     * When key multiple event happens. Key multiple event is triggered when
     * non-ascii characters are entered on soft keyboard.
     */
    @Override
    public boolean onKeyMultiple(int keyCode, int repeatCount, KeyEvent event) {
        LOKitShell.sendKeyEvent(event);
        return false;
    }

    /**
     * When key up event happens.
     */
    @Override
    public boolean onKeyUp(int keyCode, KeyEvent event) {
        LOKitShell.sendKeyEvent(event);
        return false;
    }
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */