Fields Summary |
---|
public static final ConfigGenerator | NEXUS_4 |
public static final ConfigGenerator | NEXUS_5 |
public static final ConfigGenerator | NEXUS_7 |
public static final ConfigGenerator | NEXUS_10 |
private static final String | TAG_ATTR |
private static final String | TAG_ENUM |
private static final String | TAG_FLAG |
private static final String | ATTR_NAME |
private static final String | ATTR_VALUE |
private int | mScreenHeight |
private int | mScreenWidth |
private int | mXdpi |
private int | mYdpi |
private com.android.resources.ScreenOrientation | mOrientation |
private com.android.resources.Density | mDensity |
private com.android.resources.ScreenRatio | mRatio |
private com.android.resources.ScreenSize | mSize |
private com.android.resources.Keyboard | mKeyboard |
private com.android.resources.TouchScreen | mTouchScreen |
private com.android.resources.KeyboardState | mKeyboardState |
private boolean | mSoftButtons |
private com.android.resources.Navigation | mNavigation |
Methods Summary |
---|
public static java.util.Map | getEnumMap(java.io.File path)
Map<String, Map<String, Integer>> map = Maps.newHashMap();
try {
XmlPullParser xmlPullParser = XmlPullParserFactory.newInstance().newPullParser();
xmlPullParser.setInput(new FileInputStream(path), null);
int eventType = xmlPullParser.getEventType();
String attr = null;
while (eventType != XmlPullParser.END_DOCUMENT) {
if (eventType == XmlPullParser.START_TAG) {
if (TAG_ATTR.equals(xmlPullParser.getName())) {
attr = xmlPullParser.getAttributeValue(null, ATTR_NAME);
} else if (TAG_ENUM.equals(xmlPullParser.getName())
|| TAG_FLAG.equals(xmlPullParser.getName())) {
String name = xmlPullParser.getAttributeValue(null, ATTR_NAME);
String value = xmlPullParser.getAttributeValue(null, ATTR_VALUE);
// Integer.decode cannot handle "ffffffff", see JDK issue 6624867
int i = (int) (long) Long.decode(value);
assert attr != null;
Map<String, Integer> attributeMap = map.get(attr);
if (attributeMap == null) {
attributeMap = Maps.newHashMap();
map.put(attr, attributeMap);
}
attributeMap.put(name, i);
}
} else if (eventType == XmlPullParser.END_TAG) {
if (TAG_ATTR.equals(xmlPullParser.getName())) {
attr = null;
}
}
eventType = xmlPullParser.next();
}
} catch (XmlPullParserException e) {
e.printStackTrace();
} catch (IOException e) {
e.printStackTrace();
}
return map;
|
public com.android.ide.common.resources.configuration.FolderConfiguration | getFolderConfig()
FolderConfiguration config = new FolderConfiguration();
config.createDefault();
config.setDensityQualifier(new DensityQualifier(mDensity));
config.setNavigationMethodQualifier(new NavigationMethodQualifier(mNavigation));
if (mScreenWidth > mScreenHeight) {
config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenWidth,
mScreenHeight));
} else {
config.setScreenDimensionQualifier(new ScreenDimensionQualifier(mScreenHeight,
mScreenWidth));
}
config.setScreenRatioQualifier(new ScreenRatioQualifier(mRatio));
config.setScreenSizeQualifier(new ScreenSizeQualifier(mSize));
config.setTextInputMethodQualifier(new TextInputMethodQualifier(mKeyboard));
config.setTouchTypeQualifier(new TouchScreenQualifier(mTouchScreen));
config.setKeyboardStateQualifier(new KeyboardStateQualifier(mKeyboardState));
config.setScreenOrientationQualifier(new ScreenOrientationQualifier(mOrientation));
config.updateScreenWidthAndHeight();
// some default qualifiers.
config.setUiModeQualifier(new UiModeQualifier(UiMode.NORMAL));
config.setNightModeQualifier(new NightModeQualifier(NightMode.NOTNIGHT));
config.setCountryCodeQualifier(new CountryCodeQualifier());
config.setLanguageQualifier(new LanguageQualifier());
config.setLayoutDirectionQualifier(new LayoutDirectionQualifier());
config.setNetworkCodeQualifier(new NetworkCodeQualifier());
config.setRegionQualifier(new RegionQualifier());
config.setVersionQualifier(new VersionQualifier());
return config;
|
public com.android.ide.common.rendering.api.HardwareConfig | getHardwareConfig()
return new HardwareConfig(mScreenWidth, mScreenHeight, mDensity, mXdpi, mYdpi, mSize,
mOrientation, mSoftButtons);
|
public static java.util.Map | loadProperties(java.io.File path)
Properties p = new Properties();
Map<String, String> map = Maps.newHashMap();
try {
p.load(new FileInputStream(path));
for (String key : p.stringPropertyNames()) {
map.put(key, p.getProperty(key));
}
} catch (IOException e) {
e.printStackTrace();
}
return map;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setDensity(com.android.resources.Density density)
mDensity = density;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setKeyboard(com.android.resources.Keyboard keyboard)
mKeyboard = keyboard;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setKeyboardState(com.android.resources.KeyboardState state)
mKeyboardState = state;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setNavigation(com.android.resources.Navigation navigation)
mNavigation = navigation;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setOrientation(com.android.resources.ScreenOrientation orientation)
mOrientation = orientation;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setRatio(com.android.resources.ScreenRatio ratio)
mRatio = ratio;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setScreenHeight(int height)
mScreenHeight = height;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setScreenWidth(int width)
mScreenWidth = width;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setSize(com.android.resources.ScreenSize size)
mSize = size;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setSoftButtons(boolean softButtons)
mSoftButtons = softButtons;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setTouchScreen(com.android.resources.TouchScreen touchScreen)
mTouchScreen = touchScreen;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setXdpi(int xdpi)
mXdpi = xdpi;
return this;
|
public com.android.layoutlib.bridge.intensive.setup.ConfigGenerator | setYdpi(int ydpi)
mYdpi = ydpi;
return this;
|