aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java5
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/DockModeQualifier.java117
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java52
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java2
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationStateQualifier.java117
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NightModeQualifier.java116
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java7
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java6
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java2
-rwxr-xr-xeclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd15
-rw-r--r--eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java185
-rw-r--r--files/devices.xml3
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java81
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java6
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java6
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java81
-rw-r--r--sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java81
17 files changed, 866 insertions, 16 deletions
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
index fe213f1..e786ff2 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/editors/layout/configuration/ConfigEditDialog.java
@@ -1,8 +1,10 @@
package com.android.ide.eclipse.adt.internal.editors.layout.configuration;
import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.ide.eclipse.adt.internal.resources.configurations.DockModeQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NightModeQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.VersionQualifier;
@@ -32,7 +34,6 @@ import org.eclipse.swt.widgets.Text;
import java.text.DecimalFormat;
import java.text.DecimalFormatSymbols;
import java.text.ParseException;
-import java.util.Locale;
import java.util.regex.Pattern;
/**
@@ -227,6 +228,8 @@ public class ConfigEditDialog extends GridDialog {
public boolean accept(ResourceQualifier qualifier) {
if (qualifier instanceof LanguageQualifier ||
qualifier instanceof RegionQualifier ||
+ qualifier instanceof DockModeQualifier ||
+ qualifier instanceof NightModeQualifier ||
qualifier instanceof VersionQualifier) {
return false;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/DockModeQualifier.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/DockModeQualifier.java
new file mode 100644
index 0000000..27b5ea2
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/DockModeQualifier.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.resources.configurations;
+
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.resources.DockMode;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Resource Qualifier for Navigation Method.
+ */
+public final class DockModeQualifier extends ResourceQualifier {
+
+ public static final String NAME = "Dock Mode";
+
+ private DockMode mValue;
+
+ public DockModeQualifier() {
+ // pass
+ }
+
+ public DockModeQualifier(DockMode value) {
+ mValue = value;
+ }
+
+ public DockMode getValue() {
+ return mValue;
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public String getShortName() {
+ return "Dock Mode";
+ }
+
+
+ @Override
+ public Image getIcon() {
+ return IconFactory.getInstance().getIcon("dockmode"); //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean isValid() {
+ return mValue != null;
+ }
+
+ @Override
+ public boolean checkAndSet(String value, FolderConfiguration config) {
+ DockMode mode = DockMode.getEnum(value);
+ if (mode != null) {
+ DockModeQualifier qualifier = new DockModeQualifier(mode);
+ config.setDockModeQualifier(qualifier);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object qualifier) {
+ if (qualifier instanceof DockModeQualifier) {
+ return mValue == ((DockModeQualifier)qualifier).mValue;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ if (mValue != null) {
+ return mValue.hashCode();
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns the string used to represent this qualifier in the folder name.
+ */
+ @Override
+ public String getFolderSegment(IAndroidTarget target) {
+ if (mValue != null) {
+ return mValue.getValue();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getStringValue() {
+ if (mValue != null) {
+ return mValue.getDisplayValue();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java
index f1ac8cf..f3e22cb 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/FolderConfiguration.java
@@ -39,14 +39,17 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
private final static int INDEX_SCREEN_SIZE = 4;
private final static int INDEX_SCREEN_RATIO = 5;
private final static int INDEX_SCREEN_ORIENTATION = 6;
- private final static int INDEX_PIXEL_DENSITY = 7;
- private final static int INDEX_TOUCH_TYPE = 8;
- private final static int INDEX_KEYBOARD_STATE = 9;
- private final static int INDEX_TEXT_INPUT_METHOD = 10;
- private final static int INDEX_NAVIGATION_METHOD = 11;
- private final static int INDEX_SCREEN_DIMENSION = 12;
- private final static int INDEX_VERSION = 13;
- private final static int INDEX_COUNT = 14;
+ private final static int INDEX_DOCK_MODE = 7;
+ private final static int INDEX_NIGHT_MODE = 8;
+ private final static int INDEX_PIXEL_DENSITY = 9;
+ private final static int INDEX_TOUCH_TYPE = 10;
+ private final static int INDEX_KEYBOARD_STATE = 11;
+ private final static int INDEX_TEXT_INPUT_METHOD = 12;
+ private final static int INDEX_NAVIGATION_STATE = 14;
+ private final static int INDEX_NAVIGATION_METHOD = 15;
+ private final static int INDEX_SCREEN_DIMENSION = 16;
+ private final static int INDEX_VERSION = 17;
+ private final static int INDEX_COUNT = 18;
/**
* Returns the number of {@link ResourceQualifier} that make up a Folder configuration.
@@ -126,6 +129,10 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
mQualifiers[INDEX_SCREEN_RATIO] = qualifier;
} else if (qualifier instanceof ScreenOrientationQualifier) {
mQualifiers[INDEX_SCREEN_ORIENTATION] = qualifier;
+ } else if (qualifier instanceof DockModeQualifier) {
+ mQualifiers[INDEX_DOCK_MODE] = qualifier;
+ } else if (qualifier instanceof NightModeQualifier) {
+ mQualifiers[INDEX_NIGHT_MODE] = qualifier;
} else if (qualifier instanceof PixelDensityQualifier) {
mQualifiers[INDEX_PIXEL_DENSITY] = qualifier;
} else if (qualifier instanceof TouchScreenQualifier) {
@@ -134,6 +141,8 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
mQualifiers[INDEX_KEYBOARD_STATE] = qualifier;
} else if (qualifier instanceof TextInputMethodQualifier) {
mQualifiers[INDEX_TEXT_INPUT_METHOD] = qualifier;
+ } else if (qualifier instanceof NavigationStateQualifier) {
+ mQualifiers[INDEX_NAVIGATION_STATE] = qualifier;
} else if (qualifier instanceof NavigationMethodQualifier) {
mQualifiers[INDEX_NAVIGATION_METHOD] = qualifier;
} else if (qualifier instanceof ScreenDimensionQualifier) {
@@ -222,6 +231,22 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
return (ScreenOrientationQualifier)mQualifiers[INDEX_SCREEN_ORIENTATION];
}
+ public void setDockModeQualifier(DockModeQualifier qualifier) {
+ mQualifiers[INDEX_DOCK_MODE] = qualifier;
+ }
+
+ public DockModeQualifier getDockModeQualifier() {
+ return (DockModeQualifier)mQualifiers[INDEX_DOCK_MODE];
+ }
+
+ public void setNightModeQualifier(NightModeQualifier qualifier) {
+ mQualifiers[INDEX_NIGHT_MODE] = qualifier;
+ }
+
+ public NightModeQualifier getNightModeQualifier() {
+ return (NightModeQualifier)mQualifiers[INDEX_NIGHT_MODE];
+ }
+
public void setPixelDensityQualifier(PixelDensityQualifier qualifier) {
mQualifiers[INDEX_PIXEL_DENSITY] = qualifier;
}
@@ -254,6 +279,14 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
return (TextInputMethodQualifier)mQualifiers[INDEX_TEXT_INPUT_METHOD];
}
+ public void setNavigationStateQualifier(NavigationStateQualifier qualifier) {
+ mQualifiers[INDEX_NAVIGATION_STATE] = qualifier;
+ }
+
+ public NavigationStateQualifier getNavigationStateQualifier() {
+ return (NavigationStateQualifier)mQualifiers[INDEX_NAVIGATION_STATE];
+ }
+
public void setNavigationMethodQualifier(NavigationMethodQualifier qualifier) {
mQualifiers[INDEX_NAVIGATION_METHOD] = qualifier;
}
@@ -516,10 +549,13 @@ public final class FolderConfiguration implements Comparable<FolderConfiguration
mQualifiers[INDEX_SCREEN_SIZE] = new ScreenSizeQualifier();
mQualifiers[INDEX_SCREEN_RATIO] = new ScreenRatioQualifier();
mQualifiers[INDEX_SCREEN_ORIENTATION] = new ScreenOrientationQualifier();
+ mQualifiers[INDEX_DOCK_MODE] = new DockModeQualifier();
+ mQualifiers[INDEX_NIGHT_MODE] = new NightModeQualifier();
mQualifiers[INDEX_PIXEL_DENSITY] = new PixelDensityQualifier();
mQualifiers[INDEX_TOUCH_TYPE] = new TouchScreenQualifier();
mQualifiers[INDEX_KEYBOARD_STATE] = new KeyboardStateQualifier();
mQualifiers[INDEX_TEXT_INPUT_METHOD] = new TextInputMethodQualifier();
+ mQualifiers[INDEX_NAVIGATION_STATE] = new NavigationStateQualifier();
mQualifiers[INDEX_NAVIGATION_METHOD] = new NavigationMethodQualifier();
mQualifiers[INDEX_SCREEN_DIMENSION] = new ScreenDimensionQualifier();
mQualifiers[INDEX_VERSION] = new VersionQualifier();
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java
index e82ea63..9d27e5a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationMethodQualifier.java
@@ -50,7 +50,7 @@ public final class NavigationMethodQualifier extends ResourceQualifier {
@Override
public String getShortName() {
- return "Navigation";
+ return NAME;
}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationStateQualifier.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationStateQualifier.java
new file mode 100644
index 0000000..264930c
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NavigationStateQualifier.java
@@ -0,0 +1,117 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.resources.configurations;
+
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.resources.NavigationState;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Resource Qualifier for navigation state.
+ */
+public final class NavigationStateQualifier extends ResourceQualifier {
+
+ public static final String NAME = "Navigation State";
+
+ private NavigationState mValue = null;
+
+ public NavigationStateQualifier() {
+ // pass
+ }
+
+ public NavigationStateQualifier(NavigationState value) {
+ mValue = value;
+ }
+
+ public NavigationState getValue() {
+ return mValue;
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public String getShortName() {
+ return NAME;
+ }
+
+ @Override
+ public Image getIcon() {
+ return IconFactory.getInstance().getIcon("navpad"); //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean isValid() {
+ return mValue != null;
+ }
+
+ @Override
+ public boolean checkAndSet(String value, FolderConfiguration config) {
+ NavigationState state = NavigationState.getEnum(value);
+ if (state != null) {
+ NavigationStateQualifier qualifier = new NavigationStateQualifier();
+ qualifier.mValue = state;
+ config.setNavigationStateQualifier(qualifier);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object qualifier) {
+ if (qualifier instanceof NavigationStateQualifier) {
+ return mValue == ((NavigationStateQualifier)qualifier).mValue;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ if (mValue != null) {
+ return mValue.hashCode();
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns the string used to represent this qualifier in the folder name.
+ */
+ @Override
+ public String getFolderSegment(IAndroidTarget target) {
+ if (mValue != null) {
+ return mValue.getValue();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getStringValue() {
+ if (mValue != null) {
+ return mValue.getDisplayValue();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NightModeQualifier.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NightModeQualifier.java
new file mode 100644
index 0000000..8f23373
--- /dev/null
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/resources/configurations/NightModeQualifier.java
@@ -0,0 +1,116 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Eclipse Public License, Version 1.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.eclipse.org/org/documents/epl-v10.php
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.ide.eclipse.adt.internal.resources.configurations;
+
+import com.android.ide.eclipse.adt.internal.editors.IconFactory;
+import com.android.sdklib.IAndroidTarget;
+import com.android.sdklib.resources.NightMode;
+
+import org.eclipse.swt.graphics.Image;
+
+/**
+ * Resource Qualifier for Navigation Method.
+ */
+public final class NightModeQualifier extends ResourceQualifier {
+
+ public static final String NAME = "Night Mode";
+
+ private NightMode mValue;
+
+ public NightModeQualifier() {
+ // pass
+ }
+
+ public NightModeQualifier(NightMode value) {
+ mValue = value;
+ }
+
+ public NightMode getValue() {
+ return mValue;
+ }
+
+ @Override
+ public String getName() {
+ return NAME;
+ }
+
+ @Override
+ public String getShortName() {
+ return "Night Mode";
+ }
+
+ @Override
+ public Image getIcon() {
+ return IconFactory.getInstance().getIcon("nightmode"); //$NON-NLS-1$
+ }
+
+ @Override
+ public boolean isValid() {
+ return mValue != null;
+ }
+
+ @Override
+ public boolean checkAndSet(String value, FolderConfiguration config) {
+ NightMode mode = NightMode.getEnum(value);
+ if (mode != null) {
+ NightModeQualifier qualifier = new NightModeQualifier(mode);
+ config.setNightModeQualifier(qualifier);
+ return true;
+ }
+
+ return false;
+ }
+
+ @Override
+ public boolean equals(Object qualifier) {
+ if (qualifier instanceof NightModeQualifier) {
+ return mValue == ((NightModeQualifier)qualifier).mValue;
+ }
+
+ return false;
+ }
+
+ @Override
+ public int hashCode() {
+ if (mValue != null) {
+ return mValue.hashCode();
+ }
+
+ return 0;
+ }
+
+ /**
+ * Returns the string used to represent this qualifier in the folder name.
+ */
+ @Override
+ public String getFolderSegment(IAndroidTarget target) {
+ if (mValue != null) {
+ return mValue.getValue();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+
+ @Override
+ public String getStringValue() {
+ if (mValue != null) {
+ return mValue.getDisplayValue();
+ }
+
+ return ""; //$NON-NLS-1$
+ }
+}
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
index 9e80103..cac776a 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevice.java
@@ -20,6 +20,7 @@ import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCode
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationStateQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
@@ -182,6 +183,12 @@ public class LayoutDevice {
node.setTextContent(timq.getFolderSegment(null));
}
+ NavigationStateQualifier nsq = config.getNavigationStateQualifier();
+ if (nsq != null) {
+ Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_NAV_STATE);
+ node.setTextContent(nsq.getFolderSegment(null));
+ }
+
NavigationMethodQualifier nmq = config.getNavigationMethodQualifier();
if (nmq != null) {
Element node = createNode(doc, configNode, LayoutDevicesXsd.NODE_NAV_METHOD);
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
index 8f54255..1d715b0 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDeviceHandler.java
@@ -20,6 +20,7 @@ import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCode
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationStateQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.ScreenDimensionQualifier;
@@ -32,6 +33,7 @@ import com.android.sdklib.resources.Density;
import com.android.sdklib.resources.Keyboard;
import com.android.sdklib.resources.KeyboardState;
import com.android.sdklib.resources.Navigation;
+import com.android.sdklib.resources.NavigationState;
import com.android.sdklib.resources.ScreenOrientation;
import com.android.sdklib.resources.ScreenRatio;
import com.android.sdklib.resources.ScreenSize;
@@ -155,6 +157,10 @@ class LayoutDeviceHandler extends DefaultHandler {
TextInputMethodQualifier timq = new TextInputMethodQualifier(
Keyboard.getEnum(mStringAccumulator.toString()));
mCurrentConfig.setTextInputMethodQualifier(timq);
+ } else if (LayoutDevicesXsd.NODE_NAV_STATE.equals(localName)) {
+ NavigationStateQualifier nsq = new NavigationStateQualifier(
+ NavigationState.getEnum(mStringAccumulator.toString()));
+ mCurrentConfig.setNavigationStateQualifier(nsq);
} else if (LayoutDevicesXsd.NODE_NAV_METHOD.equals(localName)) {
NavigationMethodQualifier nmq = new NavigationMethodQualifier(
Navigation.getEnum(mStringAccumulator.toString()));
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java
index 67e9718..1824959 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/LayoutDevicesXsd.java
@@ -94,6 +94,8 @@ public class LayoutDevicesXsd {
public static final String NODE_TEXT_INPUT_METHOD = "text-input-method"; //$NON-NLS-1$
+ public static final String NODE_NAV_STATE = "nav-state"; //$NON-NLS-1$
+
public static final String NODE_NAV_METHOD = "nav-method"; //$NON-NLS-1$
public static final String NODE_SCREEN_DIMENSION = "screen-dimension"; //$NON-NLS-1$
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd
index 0551afd..340a1bc 100755
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/sdk/layout-devices.xsd
@@ -237,6 +237,21 @@
</xsd:simpleType>
</xsd:element>
+ <xsd:element name="nav-state" minOccurs="0">
+ <xsd:annotation>
+ <xsd:documentation xml:lang="en">
+ Specifies whether the primary non-touchscreen navigation control is
+ exposed or hidden.
+ </xsd:documentation>
+ </xsd:annotation>
+ <xsd:simpleType>
+ <xsd:restriction base="xsd:token">
+ <xsd:enumeration value="navexposed" />
+ <xsd:enumeration value="navhidden" />
+ </xsd:restriction>
+ </xsd:simpleType>
+ </xsd:element>
+
<xsd:element name="nav-method" minOccurs="0">
<xsd:annotation>
<xsd:documentation xml:lang="en">
diff --git a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
index 89bc57f..51525b8 100644
--- a/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
+++ b/eclipse/plugins/com.android.ide.eclipse.adt/src/com/android/ide/eclipse/adt/internal/ui/ConfigurationSelector.java
@@ -17,11 +17,14 @@
package com.android.ide.eclipse.adt.internal.ui;
import com.android.ide.eclipse.adt.internal.resources.configurations.CountryCodeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.DockModeQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.FolderConfiguration;
import com.android.ide.eclipse.adt.internal.resources.configurations.KeyboardStateQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.LanguageQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationMethodQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NavigationStateQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.NetworkCodeQualifier;
+import com.android.ide.eclipse.adt.internal.resources.configurations.NightModeQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.PixelDensityQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.RegionQualifier;
import com.android.ide.eclipse.adt.internal.resources.configurations.ResourceQualifier;
@@ -34,9 +37,12 @@ import com.android.ide.eclipse.adt.internal.resources.configurations.TouchScreen
import com.android.ide.eclipse.adt.internal.resources.configurations.VersionQualifier;
import com.android.ide.eclipse.adt.internal.resources.manager.ResourceManager;
import com.android.sdklib.resources.Density;
+import com.android.sdklib.resources.DockMode;
import com.android.sdklib.resources.Keyboard;
import com.android.sdklib.resources.KeyboardState;
import com.android.sdklib.resources.Navigation;
+import com.android.sdklib.resources.NavigationState;
+import com.android.sdklib.resources.NightMode;
import com.android.sdklib.resources.ScreenOrientation;
import com.android.sdklib.resources.ScreenRatio;
import com.android.sdklib.resources.ScreenSize;
@@ -391,10 +397,13 @@ public class ConfigurationSelector extends Composite {
mUiMap.put(ScreenSizeQualifier.class, new ScreenSizeEdit(mQualifierEditParent));
mUiMap.put(ScreenRatioQualifier.class, new ScreenRatioEdit(mQualifierEditParent));
mUiMap.put(ScreenOrientationQualifier.class, new OrientationEdit(mQualifierEditParent));
+ mUiMap.put(DockModeQualifier.class, new DockModeEdit(mQualifierEditParent));
+ mUiMap.put(NightModeQualifier.class, new NightModeEdit(mQualifierEditParent));
mUiMap.put(PixelDensityQualifier.class, new PixelDensityEdit(mQualifierEditParent));
mUiMap.put(TouchScreenQualifier.class, new TouchEdit(mQualifierEditParent));
mUiMap.put(KeyboardStateQualifier.class, new KeyboardEdit(mQualifierEditParent));
mUiMap.put(TextInputMethodQualifier.class, new TextInputEdit(mQualifierEditParent));
+ mUiMap.put(NavigationStateQualifier.class, new NavigationStateEdit(mQualifierEditParent));
mUiMap.put(NavigationMethodQualifier.class, new NavigationEdit(mQualifierEditParent));
mUiMap.put(ScreenDimensionQualifier.class, new ScreenDimensionEdit(mQualifierEditParent));
mUiMap.put(VersionQualifier.class, new VersionEdit(mQualifierEditParent));
@@ -1082,6 +1091,123 @@ public class ConfigurationSelector extends Composite {
}
/**
+ * Edit widget for {@link DockModeQualifier}.
+ */
+ private class DockModeEdit extends QualifierEditBase {
+
+ private Combo mDockMode;
+
+ public DockModeEdit(Composite parent) {
+ super(parent, DockModeQualifier.NAME);
+
+ mDockMode = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+ DockMode[] values = DockMode.values();
+ for (DockMode value : values) {
+ mDockMode.add(value.getDisplayValue());
+ }
+
+ mDockMode.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mDockMode.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ onDockModeChange();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ onDockModeChange();
+ }
+ });
+ }
+
+ protected void onDockModeChange() {
+ // update the current config
+ int index = mDockMode.getSelectionIndex();
+
+ if (index != -1) {
+ mSelectedConfiguration.setDockModeQualifier(
+ new DockModeQualifier(DockMode.getByIndex(index)));
+ } else {
+ // empty selection, means no qualifier.
+ // Since the qualifier classes are immutable, and we don't want to
+ // remove the qualifier from the configuration, we create a new default one.
+ mSelectedConfiguration.setDockModeQualifier(new DockModeQualifier());
+ }
+
+ // notify of change
+ onChange(true /* keepSelection */);
+ }
+
+ @Override
+ public void setQualifier(ResourceQualifier qualifier) {
+ DockModeQualifier q = (DockModeQualifier)qualifier;
+
+ DockMode value = q.getValue();
+ if (value == null) {
+ mDockMode.clearSelection();
+ } else {
+ mDockMode.select(DockMode.getIndex(value));
+ }
+ }
+ }
+
+ /**
+ * Edit widget for {@link NightModeQualifier}.
+ */
+ private class NightModeEdit extends QualifierEditBase {
+
+ private Combo mNightMode;
+
+ public NightModeEdit(Composite parent) {
+ super(parent, NightModeQualifier.NAME);
+
+ mNightMode = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+ NightMode[] values = NightMode.values();
+ for (NightMode value : values) {
+ mNightMode.add(value.getDisplayValue());
+ }
+
+ mNightMode.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mNightMode.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ onNightModeChange();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ onNightModeChange();
+ }
+ });
+ }
+
+ protected void onNightModeChange() {
+ // update the current config
+ int index = mNightMode.getSelectionIndex();
+
+ if (index != -1) {
+ mSelectedConfiguration.setNightModeQualifier(
+ new NightModeQualifier(NightMode.getByIndex(index)));
+ } else {
+ // empty selection, means no qualifier.
+ // Since the qualifier classes are immutable, and we don't want to
+ // remove the qualifier from the configuration, we create a new default one.
+ mSelectedConfiguration.setNightModeQualifier(new NightModeQualifier());
+ }
+
+ // notify of change
+ onChange(true /* keepSelection */);
+ }
+
+ @Override
+ public void setQualifier(ResourceQualifier qualifier) {
+ NightModeQualifier q = (NightModeQualifier)qualifier;
+
+ NightMode value = q.getValue();
+ if (value == null) {
+ mNightMode.clearSelection();
+ } else {
+ mNightMode.select(NightMode.getIndex(value));
+ }
+ }
+ }
+
+
+ /**
* Edit widget for {@link PixelDensityQualifier}.
*/
private class PixelDensityEdit extends QualifierEditBase {
@@ -1318,6 +1444,65 @@ public class ConfigurationSelector extends Composite {
}
/**
+ * Edit widget for {@link NavigationStateQualifier}.
+ */
+ private class NavigationStateEdit extends QualifierEditBase {
+
+ private Combo mNavigation;
+
+ public NavigationStateEdit(Composite parent) {
+ super(parent, NavigationStateQualifier.NAME);
+
+ mNavigation = new Combo(this, SWT.DROP_DOWN | SWT.READ_ONLY);
+ NavigationState[] values = NavigationState.values();
+ for (NavigationState value : values) {
+ mNavigation.add(value.getDisplayValue());
+ }
+
+ mNavigation.setLayoutData(new GridData(GridData.FILL_HORIZONTAL));
+ mNavigation.addSelectionListener(new SelectionListener() {
+ public void widgetDefaultSelected(SelectionEvent e) {
+ onNavigationChange();
+ }
+ public void widgetSelected(SelectionEvent e) {
+ onNavigationChange();
+ }
+ });
+ }
+
+ protected void onNavigationChange() {
+ // update the current config
+ int index = mNavigation.getSelectionIndex();
+
+ if (index != -1) {
+ mSelectedConfiguration.setNavigationStateQualifier(
+ new NavigationStateQualifier(NavigationState.getByIndex(index)));
+ } else {
+ // empty selection, means no qualifier.
+ // Since the qualifier classes are immutable, and we don't want to
+ // remove the qualifier from the configuration, we create a new default one.
+ mSelectedConfiguration.setNavigationStateQualifier(new NavigationStateQualifier());
+ }
+
+ // notify of change
+ onChange(true /* keepSelection */);
+ }
+
+ @Override
+ public void setQualifier(ResourceQualifier qualifier) {
+ NavigationStateQualifier q = (NavigationStateQualifier)qualifier;
+
+ NavigationState value = q.getValue();
+ if (value == null) {
+ mNavigation.clearSelection();
+ } else {
+ mNavigation.select(NavigationState.getIndex(value));
+ }
+ }
+ }
+
+
+ /**
* Edit widget for {@link NavigationMethodQualifier}.
*/
private class NavigationEdit extends QualifierEditBase {
diff --git a/files/devices.xml b/files/devices.xml
index ea816e6..a015cdd 100644
--- a/files/devices.xml
+++ b/files/devices.xml
@@ -11,6 +11,7 @@
<d:pixel-density>mdpi</d:pixel-density>
<d:touch-type>finger</d:touch-type>
<d:text-input-method>qwerty</d:text-input-method>
+ <d:nav-state>navexposed</d:nav-state>
<d:nav-method>trackball</d:nav-method>
<d:screen-dimension>
<d:size>320</d:size>
@@ -43,6 +44,7 @@
<d:touch-type>finger</d:touch-type>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:text-input-method>nokeys</d:text-input-method>
+ <d:nav-state>navexposed</d:nav-state>
<d:nav-method>trackball</d:nav-method>
<d:screen-dimension>
<d:size>320</d:size>
@@ -68,6 +70,7 @@
<d:touch-type>finger</d:touch-type>
<d:keyboard-state>keyssoft</d:keyboard-state>
<d:text-input-method>nokeys</d:text-input-method>
+ <d:nav-state>navexposed</d:nav-state>
<d:nav-method>trackball</d:nav-method>
<d:screen-dimension>
<d:size>480</d:size>
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java
new file mode 100644
index 0000000..3b9f9ca
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/DockMode.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdklib.resources;
+
+/**
+ * Dock enum.
+ * <p/>This is used in the resource folder names.
+ */
+public enum DockMode {
+ CAR("car", "Car"),
+ DESK("desk", "Desk");
+
+ private String mValue;
+ private String mDisplay;
+
+ private DockMode(String value, String display) {
+ mValue = value;
+ mDisplay = display;
+ }
+
+ /**
+ * Returns the enum for matching the provided qualifier value.
+ * @param value The qualifier value.
+ * @return the enum for the qualifier value or null if no matching was found.
+ */
+ public static DockMode getEnum(String value) {
+ for (DockMode mode : values()) {
+ if (mode.mValue.equals(value)) {
+ return mode;
+ }
+ }
+
+ return null;
+ }
+
+ public String getValue() {
+ return mValue;
+ }
+
+ public String getDisplayValue() {
+ return mDisplay;
+ }
+
+ public static int getIndex(DockMode value) {
+ int i = 0;
+ for (DockMode mode : values()) {
+ if (mode == value) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ public static DockMode getByIndex(int index) {
+ int i = 0;
+ for (DockMode value : values()) {
+ if (i == index) {
+ return value;
+ }
+ i++;
+ }
+ return null;
+ }
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java
index 730a32b..d6c3f6a 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/KeyboardState.java
@@ -39,9 +39,9 @@ public enum KeyboardState {
* @return the enum for the qualifier value or null if no matching was found.
*/
public static KeyboardState getEnum(String value) {
- for (KeyboardState orient : values()) {
- if (orient.mValue.equals(value)) {
- return orient;
+ for (KeyboardState state : values()) {
+ if (state.mValue.equals(value)) {
+ return state;
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java
index b69f855..ae54215 100644
--- a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/Navigation.java
@@ -40,9 +40,9 @@ public enum Navigation {
* @return the enum for the qualifier value or null if no matching was found.
*/
public static Navigation getEnum(String value) {
- for (Navigation orient : values()) {
- if (orient.mValue.equals(value)) {
- return orient;
+ for (Navigation nav : values()) {
+ if (nav.mValue.equals(value)) {
+ return nav;
}
}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java
new file mode 100644
index 0000000..bf24136
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NavigationState.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdklib.resources;
+
+/**
+ * Navigation state enum.
+ * <p/>This is used in the resource folder names.
+ */
+public enum NavigationState {
+ EXPOSED("navexposed", "Exposed"), //$NON-NLS-1$
+ HIDDEN("navhidden", "Hidden"); //$NON-NLS-1$
+
+ private String mValue;
+ private String mDisplayValue;
+
+ private NavigationState(String value, String displayValue) {
+ mValue = value;
+ mDisplayValue = displayValue;
+ }
+
+ /**
+ * Returns the enum for matching the provided qualifier value.
+ * @param value The qualifier value.
+ * @return the enum for the qualifier value or null if no matching was found.
+ */
+ public static NavigationState getEnum(String value) {
+ for (NavigationState state : values()) {
+ if (state.mValue.equals(value)) {
+ return state;
+ }
+ }
+
+ return null;
+ }
+
+ public String getValue() {
+ return mValue;
+ }
+
+ public String getDisplayValue() {
+ return mDisplayValue;
+ }
+
+ public static int getIndex(NavigationState value) {
+ int i = 0;
+ for (NavigationState input : values()) {
+ if (value == input) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ public static NavigationState getByIndex(int index) {
+ int i = 0;
+ for (NavigationState value : values()) {
+ if (i == index) {
+ return value;
+ }
+ i++;
+ }
+ return null;
+ }
+}
diff --git a/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java
new file mode 100644
index 0000000..a8fae0c
--- /dev/null
+++ b/sdkmanager/libs/sdklib/src/com/android/sdklib/resources/NightMode.java
@@ -0,0 +1,81 @@
+/*
+ * Copyright (C) 2010 The Android Open Source Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package com.android.sdklib.resources;
+
+/**
+ * Night enum.
+ * <p/>This is used in the resource folder names.
+ */
+public enum NightMode {
+ NIGHT("night", "Night time"),
+ NOTNIGHT("notnight", "Day time");
+
+ private String mValue;
+ private String mDisplay;
+
+ private NightMode(String value, String display) {
+ mValue = value;
+ mDisplay = display;
+ }
+
+ /**
+ * Returns the enum for matching the provided qualifier value.
+ * @param value The qualifier value.
+ * @return the enum for the qualifier value or null if no matching was found.
+ */
+ public static NightMode getEnum(String value) {
+ for (NightMode mode : values()) {
+ if (mode.mValue.equals(value)) {
+ return mode;
+ }
+ }
+
+ return null;
+ }
+
+ public String getValue() {
+ return mValue;
+ }
+
+ public String getDisplayValue() {
+ return mDisplay;
+ }
+
+ public static int getIndex(NightMode value) {
+ int i = 0;
+ for (NightMode mode : values()) {
+ if (mode == value) {
+ return i;
+ }
+
+ i++;
+ }
+
+ return -1;
+ }
+
+ public static NightMode getByIndex(int index) {
+ int i = 0;
+ for (NightMode value : values()) {
+ if (i == index) {
+ return value;
+ }
+ i++;
+ }
+ return null;
+ }
+}