Back to project page cube-sdk.
The source code is released under:
Apache License
If you think the Android project cube-sdk listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package in.srain.cube.image; //w w w . java 2 s . c o m import java.util.ArrayList; public class ImageReuseInfoManger { private String[] mSizeList; /** * Create Reuse Info Manger, the smaller size is in the front of the size array. * * @param size new String[] { "small_180", "big_360", "big_720" } */ public ImageReuseInfoManger(String[] size) { mSizeList = size; } /** * Find out the size list can be re-sued. * * @param thisSize if "small_180" is input * @return {"big_360", "big_720"} will be returned. */ public ImageReuseInfo create(String thisSize) { ArrayList<String> list = new ArrayList<String>(); boolean canBeReused = false; for (int i = 0; i < mSizeList.length; i++) { String size = mSizeList[i]; if (!canBeReused && thisSize.equals(size)) { canBeReused = true; continue; } if (canBeReused && !thisSize.equals(size)) { list.add(size); } } if (list.size() == 0) { return new ImageReuseInfo(thisSize, null); } else { String[] sizeList = new String[list.size()]; list.toArray(sizeList); return new ImageReuseInfo(thisSize, sizeList); } } }