1
/****************************************************************************
3
** Copyright (C) 2016 The Qt Company Ltd.
4
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
5
** Contact: https://www.qt.io/licensing/
7
** This file is part of the Android port of the Qt Toolkit.
9
** $QT_BEGIN_LICENSE:LGPL$
10
** Commercial License Usage
11
** Licensees holding valid commercial Qt licenses may use this file in
12
** accordance with the commercial license agreement provided with the
13
** Software or, alternatively, in accordance with the terms contained in
14
** a written agreement between you and The Qt Company. For licensing terms
15
** and conditions see https://www.qt.io/terms-conditions. For further
16
** information use the contact form at https://www.qt.io/contact-us.
18
** GNU Lesser General Public License Usage
19
** Alternatively, this file may be used under the terms of the GNU Lesser
20
** General Public License version 3 as published by the Free Software
21
** Foundation and appearing in the file LICENSE.LGPL3 included in the
22
** packaging of this file. Please review the following information to
23
** ensure the GNU Lesser General Public License version 3 requirements
24
** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
26
** GNU General Public License Usage
27
** Alternatively, this file may be used under the terms of the GNU
28
** General Public License version 2.0 or (at your option) the GNU General
29
** Public license version 3 or any later version approved by the KDE Free
30
** Qt Foundation. The licenses are as published by the Free Software
31
** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
32
** included in the packaging of this file. Please review the following
33
** information to ensure the GNU General Public License requirements will
34
** be met: https://www.gnu.org/licenses/gpl-2.0.html and
35
** https://www.gnu.org/licenses/gpl-3.0.html.
39
****************************************************************************/
41
package org.qtproject.qt5.android;
43
import android.content.Context;
44
import android.text.InputType;
45
import android.view.View;
46
import android.view.inputmethod.EditorInfo;
47
import android.view.inputmethod.InputConnection;
49
public class QtEditText extends View
51
int m_initialCapsMode = 0;
53
int m_inputType = InputType.TYPE_CLASS_TEXT;
54
boolean m_optionsChanged = false;
55
QtActivityDelegate m_activityDelegate;
57
public void setImeOptions(int m_imeOptions)
59
if (m_imeOptions == this.m_imeOptions)
61
this.m_imeOptions = m_imeOptions;
62
m_optionsChanged = true;
65
public void setInitialCapsMode(int m_initialCapsMode)
67
if (m_initialCapsMode == this.m_initialCapsMode)
69
this.m_initialCapsMode = m_initialCapsMode;
70
m_optionsChanged = true;
74
public void setInputType(int m_inputType)
76
if (m_inputType == this.m_inputType)
78
this.m_inputType = m_inputType;
79
m_optionsChanged = true;
82
public QtEditText(Context context, QtActivityDelegate activityDelegate)
86
setFocusableInTouchMode(true);
87
m_activityDelegate = activityDelegate;
89
public QtActivityDelegate getActivityDelegate()
91
return m_activityDelegate;
95
public InputConnection onCreateInputConnection(EditorInfo outAttrs)
97
outAttrs.inputType = m_inputType;
98
outAttrs.imeOptions = m_imeOptions;
99
outAttrs.initialCapsMode = m_initialCapsMode;
100
outAttrs.imeOptions |= EditorInfo.IME_FLAG_NO_EXTRACT_UI;
101
return new QtInputConnection(this);
106
// protected void onDraw(Canvas canvas) {
107
// canvas.drawARGB(127, 255, 0, 255);
108
// super.onDraw(canvas);