Debian Codegraph @

sdk-common/src/main/java/com/android/ide/common/resources/configuration/TextInputMethodQualifier.java

raw
1 /*
2 * Copyright (C) 2007 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17 package com.android.ide.common.resources.configuration;
18
19 import com.android.resources.Keyboard;
20 import com.android.resources.ResourceEnum;
21
22 /**
23 * Resource Qualifier for Text Input Method.
24 */
25 public final class TextInputMethodQualifier extends EnumBasedResourceQualifier {
26
27 public static final String NAME = "Text Input Method";
28
29 private Keyboard mValue;
30
31
32 public TextInputMethodQualifier() {
33 // pass
34 }
35
36 public TextInputMethodQualifier(Keyboard value) {
37 mValue = value;
38 }
39
40 public Keyboard getValue() {
41 return mValue;
42 }
43
44 @Override
45 ResourceEnum getEnumValue() {
46 return mValue;
47 }
48
49 @Override
50 public String getName() {
51 return NAME;
52 }
53
54 @Override
55 public String getShortName() {
56 return "Text Input";
57 }
58
59 @Override
60 public int since() {
61 return 1;
62 }
63
64 @Override
65 public boolean checkAndSet(String value, FolderConfiguration config) {
66 Keyboard method = Keyboard.getEnum(value);
67 if (method != null) {
68 TextInputMethodQualifier qualifier = new TextInputMethodQualifier();
69 qualifier.mValue = method;
70 config.setTextInputMethodQualifier(qualifier);
71 return true;
72 }
73
74 return false;
75 }
76 }