Home | History | Annotate | Download | only in configuration
      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 
     32     public TouchScreenQualifier() {
     33         // pass
     34     }
     35 
     36     public TouchScreenQualifier(TouchScreen touchValue) {
     37         mValue = touchValue;
     38     }
     39 
     40     public TouchScreen 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 NAME;
     57     }
     58 
     59     @Override
     60     public boolean checkAndSet(String value, FolderConfiguration config) {
     61         TouchScreen type = TouchScreen.getEnum(value);
     62         if (type != null) {
     63             TouchScreenQualifier qualifier = new TouchScreenQualifier();
     64             qualifier.mValue = type;
     65             config.setTouchTypeQualifier(qualifier);
     66             return true;
     67         }
     68 
     69         return false;
     70     }
     71 }
     72