• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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.ResourceEnum;
20 import com.android.resources.TouchScreen;
21 
22 
23 /**
24  * Resource Qualifier for Touch Screen type.
25  */
26 public final class TouchScreenQualifier extends EnumBasedResourceQualifier {
27 
28     public static final String NAME = "Touch Screen";
29 
30     private TouchScreen mValue;
31 
TouchScreenQualifier()32     public TouchScreenQualifier() {
33         // pass
34     }
35 
TouchScreenQualifier(TouchScreen touchValue)36     public TouchScreenQualifier(TouchScreen touchValue) {
37         mValue = touchValue;
38     }
39 
getValue()40     public TouchScreen getValue() {
41         return mValue;
42     }
43 
44     @Override
getEnumValue()45     ResourceEnum getEnumValue() {
46         return mValue;
47     }
48 
49     @Override
getName()50     public String getName() {
51         return NAME;
52     }
53 
54     @Override
getShortName()55     public String getShortName() {
56         return NAME;
57     }
58 
59     @Override
since()60     public int since() {
61         return 1;
62     }
63 
64     @Override
checkAndSet(String value, FolderConfiguration config)65     public boolean checkAndSet(String value, FolderConfiguration config) {
66         TouchScreen type = TouchScreen.getEnum(value);
67         if (type != null) {
68             TouchScreenQualifier qualifier = new TouchScreenQualifier();
69             qualifier.mValue = type;
70             config.setTouchTypeQualifier(qualifier);
71             return true;
72         }
73 
74         return false;
75     }
76 }
77