Debian Codegraph @

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

raw
1 /*
2 * Copyright (C) 2012 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.LayoutDirection;
20 import com.android.resources.ResourceEnum;
21
22 /**
23 * Resource Qualifier for layout direction. values can be "ltr", or "rtl"
24 */
25 public class LayoutDirectionQualifier extends EnumBasedResourceQualifier {
26
27 public static final String NAME = "Layout Direction";
28
29 private LayoutDirection mValue = null;
30
31
32 public LayoutDirectionQualifier() {
33 }
34
35 public LayoutDirectionQualifier(LayoutDirection value) {
36 mValue = value;
37 }
38
39 public LayoutDirection getValue() {
40 return mValue;
41 }
42
43 @Override
44 ResourceEnum getEnumValue() {
45 return mValue;
46 }
47
48 @Override
49 public String getName() {
50 return NAME;
51 }
52
53 @Override
54 public String getShortName() {
55 return NAME;
56 }
57
58 @Override
59 public int since() {
60 return 17;
61 }
62
63 @Override
64 public boolean checkAndSet(String value, FolderConfiguration config) {
65 LayoutDirection ld = LayoutDirection.getEnum(value);
66 if (ld != null) {
67 LayoutDirectionQualifier qualifier = new LayoutDirectionQualifier(ld);
68 config.setLayoutDirectionQualifier(qualifier);
69 return true;
70 }
71
72 return false;
73 }
74 }