Android: ensure unique IDs when extracting style data for layers

Indeterminate progress drawables can consist of multiple layers that
don't necessarily have an ID. Ensure that the extracted file names
contains unique IDs to avoid extracted layers overwriting each other.

Task-number: QTBUG-35081
Change-Id: I3dc48bf363510ded9b955aa51fa479c607541169
Reviewed-by: BogDan Vatra <bogdan@kde.org>
bb10
J-P Nurmi 2014-05-26 11:12:16 +02:00 committed by The Qt Project
parent 8097d67293
commit fedd1ba84d
1 changed files with 5 additions and 2 deletions

View File

@ -532,8 +532,11 @@ public class ExtractStyle {
JSONArray array =new JSONArray();
for (int i = 0; i < nr; i++)
{
JSONObject layerJsonObject=getDrawable(layers.getDrawable(i), filename+"__"+layers.getId(i));
layerJsonObject.put("id", layers.getId(i));
int id = layers.getId(i);
if (id == -1)
id = i;
JSONObject layerJsonObject=getDrawable(layers.getDrawable(i), filename+"__"+id);
layerJsonObject.put("id", id);
array.put(layerJsonObject);
}
json.put("type", "layer");