diff options
author | Tor Norbye <tnorbye@google.com> | 2012-09-12 12:11:47 -0700 |
---|---|---|
committer | Tor Norbye <tnorbye@google.com> | 2012-09-17 07:43:29 -0700 |
commit | fe51dba2aa25e559786e5da315d4db714ffe7559 (patch) | |
tree | 058d343ffda252403da6b47813d6ab1eac1af711 /sdkmanager | |
parent | d38457bd813f7591e13a58bf91655192d761d81a (diff) | |
download | sdk-fe51dba2aa25e559786e5da315d4db714ffe7559.zip sdk-fe51dba2aa25e559786e5da315d4db714ffe7559.tar.gz sdk-fe51dba2aa25e559786e5da315d4db714ffe7559.tar.bz2 |
Support separate layout editors for a single layout resource
This changeset changes the "reuse" behavior of the layout editor to no
longer reuse the same layout editor when you are switching between
alternate layout files for the same layout resource, such as
layout/foo.xml and layout-land/foo.xml. This lets you more quickly
switch back and forth and inspect differences between the layouts,
etc. There is also an option in the Android > Editors panel to turn on
single editor sharing again.
The biggest part of the changeset, by far, is a cleanup of the
ConfigurationComposite class and associated code. This was necessary
not just to support the above feature (where we need to "back out" UI
changes when you've made a configuration edit which results in a
different file getting opened), but it's also an important preparation
for multi configuration editing, where we need to be able to switch
configuration settings in and out of a single configuration editor,
etc.
The configuration data itself is now in a separate Configuration
class; the UI is in ConfigurationChooser, and the configuration
matching code is in ConfigurationMatcher. There's also a new Locale
class to track language/region pairs instead of using 2-element
ResourceQualifier arrays. The various menu listeners are also in
separate UI classes now. While there are new classes, most of the
configuration matching algorithm is unchanged, just moved to a new
class and the UI syncing and configuration data lookup replaced.
Bitmasks are used to handle configuration changes, such that updating
multiple related attributes (e.g. a rendering target change also
causes a theme change if say Holo isn't available) can now be processed
just once with a single change call.
(Various other cleanup too.)
Change-Id: I04ac969f46824321be3db0c487ef077c03cc6012
Diffstat (limited to 'sdkmanager')
3 files changed, 13 insertions, 4 deletions
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Device.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Device.java index dcd82a2..cb712f0 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Device.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/Device.java @@ -287,4 +287,9 @@ public final class Device { hash = 31 * hash + mDefaultState.hashCode(); return hash; } + + @Override + public String toString() { + return mName; + } } diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java index d5297d3..3662c26 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/DeviceManager.java @@ -246,8 +246,10 @@ public class DeviceManager { try { userDevicesFile = new File(AndroidLocation.getFolder(), SdkConstants.FN_DEVICES_XML); - mUserDevices.addAll(DeviceParser.parse(userDevicesFile)); - notifyListeners(); + if (userDevicesFile.exists()) { + mUserDevices.addAll(DeviceParser.parse(userDevicesFile)); + notifyListeners(); + } } catch (AndroidLocationException e) { mLog.warning("Couldn't load user devices: %1$s", e.getMessage()); } catch (SAXException e) { @@ -263,8 +265,6 @@ public class DeviceManager { userDevicesFile.getAbsolutePath(), renamedConfig.getAbsolutePath()); userDevicesFile.renameTo(renamedConfig); } - } catch (FileNotFoundException e) { - mLog.warning("No user devices found"); } catch (ParserConfigurationException e) { mLog.error(null, "Error parsing %1$s", userDevicesFile == null ? "(null)" : userDevicesFile.getAbsolutePath()); diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/State.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/State.java index 1dc6961..27e5448 100644 --- a/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/State.java +++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/devices/State.java @@ -138,4 +138,8 @@ public class State { return hash; } + @Override + public String toString() { + return mName; + } } |