Debian Codegraph @

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

raw
1 /*
2 * Copyright (C) 2009 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.ResourceEnum;
20 import com.android.resources.ScreenRatio;
21
22 public class ScreenRatioQualifier extends EnumBasedResourceQualifier {
23
24 public static final String NAME = "Screen Ratio";
25
26 private ScreenRatio mValue = null;
27
28 public ScreenRatioQualifier() {
29 }
30
31 public ScreenRatioQualifier(ScreenRatio value) {
32 mValue = value;
33 }
34
35 public ScreenRatio getValue() {
36 return mValue;
37 }
38
39 @Override
40 ResourceEnum getEnumValue() {
41 return mValue;
42 }
43
44 @Override
45 public String getName() {
46 return NAME;
47 }
48
49 @Override
50 public String getShortName() {
51 return "Ratio";
52 }
53
54 @Override
55 public int since() {
56 return 4;
57 }
58
59 @Override
60 public boolean checkAndSet(String value, FolderConfiguration config) {
61 ScreenRatio size = ScreenRatio.getEnum(value);
62 if (size != null) {
63 ScreenRatioQualifier qualifier = new ScreenRatioQualifier(size);
64 config.setScreenRatioQualifier(qualifier);
65 return true;
66 }
67
68 return false;
69 }
70 }