25
25
package com .tmall .wireless .vaf .virtualview .core ;
26
26
27
27
import java .util .ArrayList ;
28
+ import java .util .HashMap ;
28
29
import java .util .LinkedList ;
29
30
import java .util .List ;
31
+ import java .util .Map ;
32
+ import java .util .concurrent .ConcurrentHashMap ;
30
33
31
34
import android .support .v4 .app .ShareCompat .IntentBuilder ;
32
35
import android .support .v4 .util .ArrayMap ;
33
36
import android .util .Log ;
34
37
import android .view .View ;
38
+
35
39
import com .libra .TextUtils ;
36
40
import com .libra .Utils ;
37
41
import com .libra .virtualview .common .TextBaseCommon ;
38
42
import com .libra .virtualview .common .ViewBaseCommon ;
43
+
39
44
import org .json .JSONArray ;
40
45
import org .json .JSONObject ;
41
46
@@ -49,7 +54,7 @@ public class ViewCache {
49
54
50
55
private List <ViewBase > mCacheView = new ArrayList <>();
51
56
52
- private ArrayMap <ViewBase , List <Item >> mCacheItem = new ArrayMap <>();
57
+ private ConcurrentHashMap <ViewBase , List <Item >> mCacheItem = new ConcurrentHashMap <>();
53
58
54
59
private Object mComponentData ;
55
60
@@ -244,7 +249,6 @@ public void bind(Object jsonObject, boolean isAppend) {
244
249
}
245
250
246
251
247
-
248
252
break ;
249
253
case TYPE_STRING :
250
254
mView .setAttribute (mKey , Utils .toString (value ));
@@ -314,8 +318,8 @@ public void destroy() {
314
318
mCacheView = null ;
315
319
}
316
320
if (mCacheItem != null ) {
317
- for (int i = 0 , size = mCacheItem .size (); i < size ; i ++ ) {
318
- List <Item > items = mCacheItem . valueAt ( i );
321
+ for (Map . Entry < ViewBase , List < Item >> entry : mCacheItem .entrySet () ) {
322
+ List <Item > items = entry . getValue ( );
319
323
if (items != null ) {
320
324
for (int j = 0 , length = items .size (); j < length ; j ++) {
321
325
Item item = items .get (j );
@@ -481,14 +485,14 @@ public Object getValueFromEL(Object jsonObject) {
481
485
result = jsonObject ;
482
486
} else {
483
487
if (jsonObject instanceof JSONObject ) {
484
- result = ((JSONObject )jsonObject ).opt (key );
488
+ result = ((JSONObject ) jsonObject ).opt (key );
485
489
} else {
486
490
break ;
487
491
}
488
492
}
489
493
} else if (node instanceof Integer ) {
490
494
if (jsonObject instanceof JSONArray ) {
491
- result = ((JSONArray )jsonObject ).opt (((Integer )node ).intValue ());
495
+ result = ((JSONArray ) jsonObject ).opt (((Integer ) node ).intValue ());
492
496
} else {
493
497
break ;
494
498
}
@@ -586,23 +590,23 @@ public Object getValueFromEL(Object jsonObject) {
586
590
if (conditionValue == null ) {
587
591
determine = false ;
588
592
} else if (conditionValue instanceof Boolean ) {
589
- determine = ((Boolean )conditionValue ).booleanValue ();
593
+ determine = ((Boolean ) conditionValue ).booleanValue ();
590
594
} else if (conditionValue instanceof String ) {
591
- if (TextUtils .isEmpty ((CharSequence )conditionValue )) {
595
+ if (TextUtils .isEmpty ((CharSequence ) conditionValue )) {
592
596
determine = false ;
593
597
} else {
594
- if (TextUtils .equals ((CharSequence )conditionValue , "null" )) {
598
+ if (TextUtils .equals ((CharSequence ) conditionValue , "null" )) {
595
599
determine = false ;
596
- } else if (TextUtils .equals (((String )conditionValue ).toLowerCase (), "false" )) {
600
+ } else if (TextUtils .equals (((String ) conditionValue ).toLowerCase (), "false" )) {
597
601
determine = false ;
598
602
}
599
603
}
600
604
} else if (conditionValue instanceof JSONObject ) {
601
- if (((JSONObject )conditionValue ).length () == 0 ) {
605
+ if (((JSONObject ) conditionValue ).length () == 0 ) {
602
606
determine = false ;
603
607
}
604
608
} else if (conditionValue instanceof JSONArray ) {
605
- if (((JSONArray )conditionValue ).length () == 0 ) {
609
+ if (((JSONArray ) conditionValue ).length () == 0 ) {
606
610
determine = false ;
607
611
}
608
612
} else if (conditionValue .equals (JSONObject .NULL )) {
@@ -627,7 +631,7 @@ public Object getValueFromEL(Object jsonObject) {
627
631
* so we make Integer.MIN_VALUE as invalid input
628
632
*/
629
633
public static int parseInt (String s ) {
630
- return parseInt (s ,10 );
634
+ return parseInt (s , 10 );
631
635
}
632
636
633
637
public static int parseInt (String s , int radix ) {
@@ -673,7 +677,7 @@ public static int parseInt(String s, int radix) {
673
677
multmin = limit / radix ;
674
678
while (i < len ) {
675
679
// Accumulating negatively avoids surprises near MAX_VALUE
676
- digit = Character .digit (s .charAt (i ++),radix );
680
+ digit = Character .digit (s .charAt (i ++), radix );
677
681
if (digit < 0 ) {
678
682
return Integer .MIN_VALUE ;
679
683
}
0 commit comments