2 * Copyright (c) 2010-2023 Contributors to the openHAB project
4 * See the NOTICE file(s) distributed with this work for additional
7 * This program and the accompanying materials are made available under the
8 * terms of the Eclipse Public License 2.0 which is available at
9 * http://www.eclipse.org/legal/epl-2.0
11 * SPDX-License-Identifier: EPL-2.0
13 /* This file is based on:
18 * Copyright (c) 2014 LG Electronics.
19 * Created by Hyun Kook Khang on 19 Jan 2014
21 * Licensed under the Apache License, Version 2.0 (the "License");
22 * you may not use this file except in compliance with the License.
23 * You may obtain a copy of the License at
25 * http://www.apache.org/licenses/LICENSE-2.0
27 * Unless required by applicable law or agreed to in writing, software
28 * distributed under the License is distributed on an "AS IS" BASIS,
29 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
30 * See the License for the specific language governing permissions and
31 * limitations under the License.
34 package org.openhab.binding.lgwebos.internal.handler.core;
36 import com.google.gson.JsonObject;
39 * Normalized reference object for information about a text input event.
41 * @author Hyun Kook Khang - Connect SDK initial contribution
42 * @author Sebastian Prehn - Adoption for openHAB
44 public class TextInputStatusInfo {
46 public enum TextInputType {
54 boolean focused = false;
55 String contentType = null;
56 boolean predictionEnabled = false;
57 boolean correctionEnabled = false;
58 boolean autoCapitalization = false;
59 boolean hiddenText = false;
60 boolean focusChanged = false;
65 public TextInputStatusInfo() {
68 public boolean isFocused() {
72 public void setFocused(boolean focused) {
73 this.focused = focused;
77 * Gets the type of keyboard that should be displayed to the user.
79 * @return the keyboard type
81 public TextInputType getTextInputType() {
82 TextInputType textInputType = TextInputType.DEFAULT;
84 if ("number".equals(contentType)) {
85 textInputType = TextInputType.NUMBER;
86 } else if ("phonenumber".equals(contentType)) {
87 textInputType = TextInputType.PHONE_NUMBER;
88 } else if ("url".equals(contentType)) {
89 textInputType = TextInputType.URL;
90 } else if ("email".equals(contentType)) {
91 textInputType = TextInputType.EMAIL;
98 * Sets the type of keyboard that should be displayed to the user.
100 * @param textInputType the keyboard type
102 public void setTextInputType(TextInputType textInputType) {
103 switch (textInputType) {
105 contentType = "number";
108 contentType = "phonenumber";
114 contentType = "number";
118 contentType = "email";
123 public void setContentType(String contentType) {
124 this.contentType = contentType;
127 public boolean isPredictionEnabled() {
128 return predictionEnabled;
131 public void setPredictionEnabled(boolean predictionEnabled) {
132 this.predictionEnabled = predictionEnabled;
135 public boolean isCorrectionEnabled() {
136 return correctionEnabled;
139 public void setCorrectionEnabled(boolean correctionEnabled) {
140 this.correctionEnabled = correctionEnabled;
143 public boolean isAutoCapitalization() {
144 return autoCapitalization;
147 public void setAutoCapitalization(boolean autoCapitalization) {
148 this.autoCapitalization = autoCapitalization;
151 public boolean isHiddenText() {
155 public void setHiddenText(boolean hiddenText) {
156 this.hiddenText = hiddenText;
159 /** @return the raw data from the first screen device about the text input status. */
160 public JsonObject getRawData() {
164 /** @param data the raw data from the first screen device about the text input status. */
165 public void setRawData(JsonObject data) {
169 public boolean isFocusChanged() {
173 public void setFocusChanged(boolean focusChanged) {
174 this.focusChanged = focusChanged;