Debian Codegraph @

layoutlib-api/src/main/java/com/android/layoutlib/api/IDensityBasedResourceValue.java

raw
1 /*
2 * Copyright (C) 2008 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.layoutlib.api;
18
19 import com.android.ide.common.rendering.api.DensityBasedResourceValue;
20
21 /**
22 * Represents an Android Resources that has a density info attached to it.
23 * @deprecated use {@link DensityBasedResourceValue}.
24 */
25 @Deprecated
26 public interface IDensityBasedResourceValue extends IResourceValue {
27
28 /**
29 * Density.
30 *
31 * @deprecated use {@link com.android.resources.Density}.
32 */
33 @Deprecated
34 enum Density {
35 XHIGH(320),
36 HIGH(240),
37 MEDIUM(160),
38 LOW(120),
39 NODPI(0);
40
41 private final int mValue;
42
43 Density(int value) {
44 mValue = value;
45 }
46
47 public int getValue() {
48 return mValue;
49 }
50
51 /**
52 * Returns the enum matching the given density value
53 * @param value The density value.
54 * @return the enum for the density value or null if no match was found.
55 */
56 public static Density getEnum(int value) {
57 for (Density d : values()) {
58 if (d.mValue == value) {
59 return d;
60 }
61 }
62
63 return null;
64 }
65 }
66
67 /**
68 * Returns the density associated to the resource.
69 * @deprecated use {@link DensityBasedResourceValue#getResourceDensity()}
70 */
71 @Deprecated
72 Density getDensity();
73 }