summaryrefslogtreecommitdiffstats
path: root/src/com/android/camera/IntArray.java
diff options
context:
space:
mode:
authorOwen Lin <owenlin@google.com>2010-04-26 11:34:30 +0800
committerOwen Lin <owenlin@google.com>2010-04-26 12:53:54 +0800
commit1e7d70c59c3547db7589c1cae977e98d9b4e95b9 (patch)
tree54f44d6694ba2beeb7dc6b954df50b9cc918034f /src/com/android/camera/IntArray.java
parent5557c3e9fc7607ab2e4858d4f01ee160f5cfca3b (diff)
downloadLegacyCamera-1e7d70c59c3547db7589c1cae977e98d9b4e95b9.zip
LegacyCamera-1e7d70c59c3547db7589c1cae977e98d9b4e95b9.tar.gz
LegacyCamera-1e7d70c59c3547db7589c1cae977e98d9b4e95b9.tar.bz2
Avoid loading drawables in CameraSettings.
Bug: 2430326 Change-Id: Ia5e6f4320fac3a89ede5054e9ac7b6f31c973273
Diffstat (limited to 'src/com/android/camera/IntArray.java')
-rw-r--r--src/com/android/camera/IntArray.java45
1 files changed, 45 insertions, 0 deletions
diff --git a/src/com/android/camera/IntArray.java b/src/com/android/camera/IntArray.java
new file mode 100644
index 0000000..a2550db
--- /dev/null
+++ b/src/com/android/camera/IntArray.java
@@ -0,0 +1,45 @@
+/*
+ * 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.camera;
+
+public class IntArray {
+ private static final int INIT_CAPACITY = 8;
+
+ private int mData[] = new int[INIT_CAPACITY];
+ private int mSize = 0;
+
+ public void add(int value) {
+ if (mData.length == mSize) {
+ int temp[] = new int[mSize + mSize];
+ System.arraycopy(mData, 0, temp, 0, mSize);
+ mData = temp;
+ }
+ mData[mSize++] = value;
+ }
+
+ public int size() {
+ return mSize;
+ }
+
+ public int[] toArray(int[] result) {
+ if (result == null || result.length < mSize) {
+ result = new int[mSize];
+ }
+ System.arraycopy(mData, 0, result, 0, mSize);
+ return result;
+ }
+}