~gabriel1984sibiu/minitube/qt5.6

« back to all changes in this revision

Viewing changes to src/android/jar/src/org/qtproject/qt5/android/QtEditText.java

  • Committer: Grevutiu Gabriel
  • Date: 2017-06-13 08:43:17 UTC
  • Revision ID: gabriel1984sibiu@gmail.com-20170613084317-ek0zqe0u9g3ocvi8
OriginalĀ upstreamĀ code

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/****************************************************************************
 
2
**
 
3
** Copyright (C) 2016 The Qt Company Ltd.
 
4
** Copyright (C) 2012 BogDan Vatra <bogdan@kde.org>
 
5
** Contact: https://www.qt.io/licensing/
 
6
**
 
7
** This file is part of the Android port of the Qt Toolkit.
 
8
**
 
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.
 
17
**
 
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.
 
25
**
 
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.
 
36
**
 
37
** $QT_END_LICENSE$
 
38
**
 
39
****************************************************************************/
 
40
 
 
41
package org.qtproject.qt5.android;
 
42
 
 
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;
 
48
 
 
49
public class QtEditText extends View
 
50
{
 
51
    int m_initialCapsMode = 0;
 
52
    int m_imeOptions = 0;
 
53
    int m_inputType = InputType.TYPE_CLASS_TEXT;
 
54
    boolean m_optionsChanged = false;
 
55
    QtActivityDelegate m_activityDelegate;
 
56
 
 
57
    public void setImeOptions(int m_imeOptions)
 
58
    {
 
59
        if (m_imeOptions == this.m_imeOptions)
 
60
            return;
 
61
        this.m_imeOptions = m_imeOptions;
 
62
        m_optionsChanged = true;
 
63
    }
 
64
 
 
65
    public void setInitialCapsMode(int m_initialCapsMode)
 
66
    {
 
67
        if (m_initialCapsMode == this.m_initialCapsMode)
 
68
            return;
 
69
        this.m_initialCapsMode = m_initialCapsMode;
 
70
        m_optionsChanged = true;
 
71
    }
 
72
 
 
73
 
 
74
    public void setInputType(int m_inputType)
 
75
    {
 
76
        if (m_inputType == this.m_inputType)
 
77
            return;
 
78
        this.m_inputType = m_inputType;
 
79
        m_optionsChanged = true;
 
80
    }
 
81
 
 
82
    public QtEditText(Context context, QtActivityDelegate activityDelegate)
 
83
    {
 
84
        super(context);
 
85
        setFocusable(true);
 
86
        setFocusableInTouchMode(true);
 
87
        m_activityDelegate = activityDelegate;
 
88
    }
 
89
    public QtActivityDelegate getActivityDelegate()
 
90
    {
 
91
        return m_activityDelegate;
 
92
    }
 
93
 
 
94
    @Override
 
95
    public InputConnection onCreateInputConnection(EditorInfo outAttrs)
 
96
    {
 
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);
 
102
    }
 
103
 
 
104
// // DEBUG CODE
 
105
//    @Override
 
106
//    protected void onDraw(Canvas canvas) {
 
107
//        canvas.drawARGB(127, 255, 0, 255);
 
108
//        super.onDraw(canvas);
 
109
//    }
 
110
}