summaryrefslogtreecommitdiffstats
path: root/core/java/android/hardware/input
diff options
context:
space:
mode:
authorJeff Brown <jeffbrown@google.com>2012-05-17 16:01:54 -0700
committerJeff Brown <jeffbrown@google.com>2012-05-17 16:01:54 -0700
commitd9fec5d317c09da6bcc7a54df4e0190a76d21eae (patch)
tree0eae74e8e946ea2d7715e31c3bd58a8f48befa2a /core/java/android/hardware/input
parentab624c2fd4f0fad6ba7f422a960942e5a7035cea (diff)
downloadframeworks_base-d9fec5d317c09da6bcc7a54df4e0190a76d21eae.zip
frameworks_base-d9fec5d317c09da6bcc7a54df4e0190a76d21eae.tar.gz
frameworks_base-d9fec5d317c09da6bcc7a54df4e0190a76d21eae.tar.bz2
Add support for grouping keyboard layouts by collection.
Bug: 6405203 Change-Id: Id818b27ec09928150795d594a96df186a6e39168
Diffstat (limited to 'core/java/android/hardware/input')
-rwxr-xr-xcore/java/android/hardware/input/InputManager.java7
-rw-r--r--core/java/android/hardware/input/KeyboardLayout.java26
2 files changed, 28 insertions, 5 deletions
diff --git a/core/java/android/hardware/input/InputManager.java b/core/java/android/hardware/input/InputManager.java
index 6448b55..dfd35e1 100755
--- a/core/java/android/hardware/input/InputManager.java
+++ b/core/java/android/hardware/input/InputManager.java
@@ -77,7 +77,8 @@ public final class InputManager {
* The meta-data specifies a resource that contains a description of each keyboard
* layout that is provided by the application.
* <pre><code>
- * &lt;receiver android:name=".InputDeviceReceiver">
+ * &lt;receiver android:name=".InputDeviceReceiver"
+ * android:label="@string/keyboard_layouts_label">
* &lt;intent-filter>
* &lt;action android:name="android.hardware.input.action.QUERY_KEYBOARD_LAYOUTS" />
* &lt;/intent-filter>
@@ -90,7 +91,9 @@ public final class InputManager {
* an XML resource whose root element is <code>&lt;keyboard-layouts></code> that
* contains zero or more <code>&lt;keyboard-layout></code> elements.
* Each <code>&lt;keyboard-layout></code> element specifies the name, label, and location
- * of a key character map for a particular keyboard layout.
+ * of a key character map for a particular keyboard layout. The label on the receiver
+ * is used to name the collection of keyboard layouts provided by this receiver in the
+ * keyboard layout settings.
* <pre></code>
* &lt;?xml version="1.0" encoding="utf-8"?>
* &lt;keyboard-layouts xmlns:android="http://schemas.android.com/apk/res/android">
diff --git a/core/java/android/hardware/input/KeyboardLayout.java b/core/java/android/hardware/input/KeyboardLayout.java
index e75a6dc..5402e75 100644
--- a/core/java/android/hardware/input/KeyboardLayout.java
+++ b/core/java/android/hardware/input/KeyboardLayout.java
@@ -28,6 +28,7 @@ public final class KeyboardLayout implements Parcelable,
Comparable<KeyboardLayout> {
private final String mDescriptor;
private final String mLabel;
+ private final String mCollection;
public static final Parcelable.Creator<KeyboardLayout> CREATOR =
new Parcelable.Creator<KeyboardLayout>() {
@@ -39,14 +40,16 @@ public final class KeyboardLayout implements Parcelable,
}
};
- public KeyboardLayout(String descriptor, String label) {
+ public KeyboardLayout(String descriptor, String label, String collection) {
mDescriptor = descriptor;
mLabel = label;
+ mCollection = collection;
}
private KeyboardLayout(Parcel source) {
mDescriptor = source.readString();
mLabel = source.readString();
+ mCollection = source.readString();
}
/**
@@ -68,6 +71,15 @@ public final class KeyboardLayout implements Parcelable,
return mLabel;
}
+ /**
+ * Gets the name of the collection to which the keyboard layout belongs. This is
+ * the label of the broadcast receiver or application that provided the keyboard layout.
+ * @return The keyboard layout collection name.
+ */
+ public String getCollection() {
+ return mCollection;
+ }
+
@Override
public int describeContents() {
return 0;
@@ -77,15 +89,23 @@ public final class KeyboardLayout implements Parcelable,
public void writeToParcel(Parcel dest, int flags) {
dest.writeString(mDescriptor);
dest.writeString(mLabel);
+ dest.writeString(mCollection);
}
@Override
public int compareTo(KeyboardLayout another) {
- return mLabel.compareToIgnoreCase(another.mLabel);
+ int result = mLabel.compareToIgnoreCase(another.mLabel);
+ if (result == 0) {
+ result = mCollection.compareToIgnoreCase(another.mCollection);
+ }
+ return result;
}
@Override
public String toString() {
- return mLabel;
+ if (mCollection.isEmpty()) {
+ return mLabel;
+ }
+ return mLabel + " - " + mCollection;
}
} \ No newline at end of file