1 /* 2 * Copyright (C) 2017 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 package com.android.layoutlib.bridge.android; 17 18 import com.android.ide.common.rendering.api.ResourceValue; 19 20 import android.util.ResolvingAttributeSet; 21 22 import android.annotation.NonNull; 23 import android.annotation.Nullable; 24 25 /** 26 * Empty {@link AttributeSet} 27 */ 28 class NopAttributeSet implements ResolvingAttributeSet { 29 @Override getAttributeCount()30 public int getAttributeCount() { 31 return 0; 32 } 33 34 @Override getAttributeNamespace(int index)35 public String getAttributeNamespace(int index) { 36 return null; 37 } 38 39 @Override getAttributeName(int index)40 public String getAttributeName(int index) { 41 return null; 42 } 43 44 @Override getAttributeValue(int index)45 public String getAttributeValue(int index) { 46 return null; 47 } 48 49 @Override getAttributeValue(String namespace, String name)50 public String getAttributeValue(String namespace, String name) { 51 return null; 52 } 53 54 @Override getPositionDescription()55 public String getPositionDescription() { 56 return null; 57 } 58 59 @Override getAttributeNameResource(int index)60 public int getAttributeNameResource(int index) { 61 return 0; 62 } 63 64 @Override getAttributeListValue(String namespace, String attribute, String[] options, int defaultValue)65 public int getAttributeListValue(String namespace, String attribute, String[] options, int 66 defaultValue) { 67 return 0; 68 } 69 70 @Override getAttributeBooleanValue(String namespace, String attribute, boolean defaultValue)71 public boolean getAttributeBooleanValue(String namespace, String attribute, 72 boolean defaultValue) { 73 return false; 74 } 75 76 @Override getAttributeResourceValue(String namespace, String attribute, int defaultValue)77 public int getAttributeResourceValue(String namespace, String attribute, int defaultValue) { 78 return 0; 79 } 80 81 @Override getAttributeIntValue(String namespace, String attribute, int defaultValue)82 public int getAttributeIntValue(String namespace, String attribute, int defaultValue) { 83 return 0; 84 } 85 86 @Override getAttributeUnsignedIntValue(String namespace, String attribute, int defaultValue)87 public int getAttributeUnsignedIntValue(String namespace, String attribute, 88 int defaultValue) { 89 return 0; 90 } 91 92 @Override getAttributeFloatValue(String namespace, String attribute, float defaultValue)93 public float getAttributeFloatValue(String namespace, String attribute, 94 float defaultValue) { 95 return 0; 96 } 97 98 @Override getAttributeListValue(int index, String[] options, int defaultValue)99 public int getAttributeListValue(int index, String[] options, int defaultValue) { 100 return 0; 101 } 102 103 @Override getAttributeBooleanValue(int index, boolean defaultValue)104 public boolean getAttributeBooleanValue(int index, boolean defaultValue) { 105 return false; 106 } 107 108 @Override getAttributeResourceValue(int index, int defaultValue)109 public int getAttributeResourceValue(int index, int defaultValue) { 110 return 0; 111 } 112 113 @Override getAttributeIntValue(int index, int defaultValue)114 public int getAttributeIntValue(int index, int defaultValue) { 115 return 0; 116 } 117 118 @Override getAttributeUnsignedIntValue(int index, int defaultValue)119 public int getAttributeUnsignedIntValue(int index, int defaultValue) { 120 return 0; 121 } 122 123 @Override getAttributeFloatValue(int index, float defaultValue)124 public float getAttributeFloatValue(int index, float defaultValue) { 125 return 0; 126 } 127 128 @Override getIdAttribute()129 public String getIdAttribute() { 130 return null; 131 } 132 133 @Override getClassAttribute()134 public String getClassAttribute() { 135 return null; 136 } 137 138 @Override getIdAttributeResourceValue(int defaultValue)139 public int getIdAttributeResourceValue(int defaultValue) { 140 return 0; 141 } 142 143 @Override getStyleAttribute()144 public int getStyleAttribute() { 145 return 0; 146 } 147 148 @Override 149 @Nullable getResolvedAttributeValue(@ullable String namespace, @NonNull String name)150 public ResourceValue getResolvedAttributeValue(@Nullable String namespace, 151 @NonNull String name) { 152 return null; 153 } 154 } 155