summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/IntAllocation.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/launcher2/IntAllocation.java')
-rw-r--r--src/com/android/launcher2/IntAllocation.java18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/com/android/launcher2/IntAllocation.java b/src/com/android/launcher2/IntAllocation.java
index ab9d9155d..dde3d22dd 100644
--- a/src/com/android/launcher2/IntAllocation.java
+++ b/src/com/android/launcher2/IntAllocation.java
@@ -81,6 +81,24 @@ public class IntAllocation {
mAlloc.data(buf);
}
+ public void read() {
+ int[] buf = mBuffer;
+ if (buf != null) {
+ mAlloc.readData(buf);
+ Field[] fields = this.getClass().getFields();
+ for (Field f: fields) {
+ AllocationIndex index = f.getAnnotation(AllocationIndex.class);
+ if (index != null) {
+ try {
+ f.setInt(this, buf[index.value()]);
+ } catch (IllegalAccessException ex) {
+ throw new RuntimeException(ex);
+ }
+ }
+ }
+ }
+ }
+
Allocation getAllocation() {
return mAlloc;
}