Moving some utilities methods to separate class

Change-Id: I5094b22ddc77c45590cea1a5f5dead0dc7580abf
This commit is contained in:
Sunny Goyal
2019-07-17 15:12:56 -07:00
parent 273c079761
commit 9dbb27c09c
17 changed files with 169 additions and 161 deletions

View File

@@ -17,6 +17,7 @@
package com.android.launcher3.util;
import java.util.Arrays;
import java.util.StringTokenizer;
/**
* Copy of the platform hidden implementation of android.util.IntArray.
@@ -248,6 +249,17 @@ public class IntArray implements Cloneable {
return b.toString();
}
public static IntArray fromConcatString(String concatString) {
StringTokenizer tokenizer = new StringTokenizer(concatString, ",");
int[] array = new int[tokenizer.countTokens()];
int count = 0;
while (tokenizer.hasMoreTokens()) {
array[count] = Integer.parseInt(tokenizer.nextToken().trim());
count++;
}
return new IntArray(array, array.length);
}
/**
* Throws {@link ArrayIndexOutOfBoundsException} if the index is out of bounds.
*