diff options
8 files changed, 27 insertions, 21 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Configuration.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Configuration.java index 44faf71..56479e7 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Configuration.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/Configuration.java @@ -747,7 +747,7 @@ public class Configuration { boolean initialize(String data) { String[] values = data.split(SEP); if (values.length >= 6 && values.length <= 8) { - for (Device d : mConfigChooser.getDeviceList()) { + for (Device d : mConfigChooser.getDevices()) { if (d.getName().equals(values[0])) { mDevice = d; String stateName = null; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java index 5b8e70b..5805390 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationChooser.java @@ -133,7 +133,7 @@ public class ConfigurationChooser extends Composite private int mDisableUpdates = 0; /** List of available devices */ - private List<Device> mDeviceList = Collections.emptyList(); + private Collection<Device> mDevices = Collections.emptyList(); /** List of available targets */ private final List<IAndroidTarget> mTargetList = new ArrayList<IAndroidTarget>(); @@ -383,8 +383,8 @@ public class ConfigurationChooser extends Composite * @return a list of {@link Device} objects */ @NonNull - public List<Device> getDeviceList() { - return mDeviceList; + public Collection<Device> getDevices() { + return mDevices; } /** @@ -873,9 +873,9 @@ public class ConfigurationChooser extends Composite // This method can be called more than once, so avoid duplicate entries manager.unregisterListener(this); manager.registerListener(this); - mDeviceList = manager.getDevices(DeviceManager.ALL_DEVICES); + mDevices = manager.getDevices(DeviceManager.ALL_DEVICES); } else { - mDeviceList = new ArrayList<Device>(); + mDevices = new ArrayList<Device>(); } } @@ -916,7 +916,7 @@ public class ConfigurationChooser extends Composite } private void updateDevices() { - if (mDeviceList.size() == 0) { + if (mDevices.size() == 0) { initDevices(); } } @@ -1370,9 +1370,9 @@ public class ConfigurationChooser extends Composite public void onDevicesChanged() { final Sdk sdk = Sdk.getCurrent(); if (sdk != null) { - mDeviceList = sdk.getDeviceManager().getDevices(DeviceManager.ALL_DEVICES); + mDevices = sdk.getDeviceManager().getDevices(DeviceManager.ALL_DEVICES); } else { - mDeviceList = new ArrayList<Device>(); + mDevices = new ArrayList<Device>(); } } diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationDescription.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationDescription.java index cc50398..f7be53d 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationDescription.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationDescription.java @@ -50,6 +50,7 @@ import org.eclipse.core.runtime.QualifiedName; import org.w3c.dom.Document; import org.w3c.dom.Element; +import java.util.Collection; import java.util.List; /** A description of a configuration, used for persistence */ @@ -169,7 +170,7 @@ public class ConfigurationDescription { public static ConfigurationDescription fromXml( @Nullable IProject project, @NonNull Element element, - @NonNull List<Device> deviceList) { + @NonNull Collection<Device> deviceList) { ConfigurationDescription description = new ConfigurationDescription(project); if (!TAG_PREVIEW.equals(element.getTagName())) { diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java index 89104ab..b868f14 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigurationMatcher.java @@ -55,6 +55,7 @@ import org.eclipse.core.runtime.IStatus; import org.eclipse.ui.IEditorPart; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.List; @@ -248,7 +249,7 @@ public class ConfigurationMatcher { */ void findAndSetCompatibleConfig(boolean favorCurrentConfig) { List<Locale> localeList = mConfigChooser.getLocaleList(); - List<Device> deviceList = mConfigChooser.getDeviceList(); + Collection<Device> devices = mConfigChooser.getDevices(); FolderConfiguration editedConfig = mConfiguration.getEditedConfig(); FolderConfiguration currentConfig = mConfiguration.getFullConfig(); @@ -301,7 +302,7 @@ public class ConfigurationMatcher { addRenderTargetToBundles(configBundles); - for (Device device : deviceList) { + for (Device device : devices) { for (State state : device.getAllStates()) { // loop on the list of config bundles to create full diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/DeviceMenuListener.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/DeviceMenuListener.java index 4489b52..72910f9 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/DeviceMenuListener.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/DeviceMenuListener.java @@ -41,6 +41,7 @@ import org.eclipse.swt.widgets.MenuItem; import org.eclipse.swt.widgets.ToolItem; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.List; import java.util.Map; @@ -72,7 +73,7 @@ class DeviceMenuListener extends SelectionAdapter { Device current = configuration.getDevice(); Menu menu = new Menu(chooser.getShell(), SWT.POP_UP); - List<Device> deviceList = chooser.getDeviceList(); + Collection<Device> deviceCollection = chooser.getDevices(); Sdk sdk = Sdk.getCurrent(); if (sdk != null) { AvdManager avdManager = sdk.getAvdManager(); @@ -80,7 +81,7 @@ class DeviceMenuListener extends SelectionAdapter { boolean separatorNeeded = false; AvdInfo[] avds = avdManager.getValidAvds(); for (AvdInfo avd : avds) { - for (Device device : deviceList) { + for (Device device : deviceCollection) { if (device.getManufacturer().equals(avd.getDeviceManufacturer()) && device.getName().equals(avd.getDeviceName())) { separatorNeeded = true; @@ -105,9 +106,9 @@ class DeviceMenuListener extends SelectionAdapter { // make many manufacturer submenus. boolean haveNexus = false; boolean haveNonNexus = false; - if (!deviceList.isEmpty()) { + if (!deviceCollection.isEmpty()) { Map<String, List<Device>> manufacturers = new TreeMap<String, List<Device>>(); - for (Device device : deviceList) { + for (Device device : deviceCollection) { List<Device> devices; if (isNexus(device)) { haveNexus = true; diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/VaryingConfiguration.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/VaryingConfiguration.java index c6e6407..f472cd6 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/VaryingConfiguration.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/VaryingConfiguration.java @@ -28,6 +28,7 @@ import com.android.sdklib.devices.Hardware; import com.android.sdklib.devices.Screen; import com.android.sdklib.devices.State; +import java.util.Collection; import java.util.List; /** @@ -233,7 +234,7 @@ public class VaryingConfiguration extends NestedConfiguration { mPrevParentDevice = device; // Pick a different device - List<Device> devices = mConfigChooser.getDeviceList(); + Collection<Device> devices = mConfigChooser.getDevices(); // Divide up the available devices into {@link #mVariationCount} + 1 buckets // (the + 1 is for the bucket now taken up by the inherited value). diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewList.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewList.java index f5d3290..2bcdba3 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewList.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewList.java @@ -36,6 +36,7 @@ import org.w3c.dom.Element; import java.io.File; import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import java.util.List; /** A list of render previews */ @@ -85,7 +86,7 @@ class RenderPreviewList { return new File(AdtUtils.getAbsolutePath(mProject).toFile(), PREVIEW_FILE_NAME); } - void load(List<Device> deviceList) throws IOException { + void load(Collection<Device> deviceList) throws IOException { File file = getManualFile(); if (file.exists()) { load(file, deviceList); @@ -112,7 +113,7 @@ class RenderPreviewList { } } - void load(File file, List<Device> deviceList) throws IOException { + void load(File file, Collection<Device> deviceList) throws IOException { mList.clear(); String xml = Files.toString(file, Charsets.UTF_8); diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java index 4b0f484..9f6c3a2 100644 --- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java +++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/gle2/RenderPreviewManager.java @@ -72,6 +72,7 @@ import org.eclipse.ui.ide.IDE; import java.io.IOException; import java.util.ArrayList; +import java.util.Collection; import java.util.Collections; import java.util.Comparator; import java.util.HashSet; @@ -964,7 +965,7 @@ public class RenderPreviewManager { /** Similar to {@link #addDefaultPreviews()} but for screen sizes */ public void addScreenSizePreviews() { ConfigurationChooser chooser = getChooser(); - List<Device> devices = chooser.getDeviceList(); + Collection<Device> devices = chooser.getDevices(); Configuration configuration = chooser.getConfiguration(); boolean canScaleNinePatch = configuration.supports(Capability.FIXED_SCALABLE_NINE_PATCH); @@ -1122,7 +1123,7 @@ public class RenderPreviewManager { } try { - mManualList.load(getChooser().getDeviceList()); + mManualList.load(getChooser().getDevices()); mPreviews = mManualList.createPreviews(mCanvas); } catch (IOException e) { AdtPlugin.log(e, null); |