@@ -519,20 +519,26 @@ public void onResponse(byte[] bytes) {
519519 LightningOuterClass .AssetsBalanceByAddressResponse resp = LightningOuterClass .AssetsBalanceByAddressResponse .parseFrom (bytes );
520520 LogUtils .e (TAG , "------------------assetsBalanceOnResponse------------------" + resp .getListList ().toString ());
521521 if (ConstantInOB .networkType == NetworkType .TEST ) {
522- for (int i = 0 ; i < resp .getListList ().size (); i ++) {
523- if (resp .getListList ().get (i ).getPropertyid () != Long .parseLong ("2147485160" )) {
522+ List list = new ArrayList ();
523+ for (lnrpc .LightningOuterClass .AssetBalanceByAddressResponse response : resp .getListList ()) {
524+ list .add (response .getPropertyid ());
525+ if (!list .contains (Long .parseLong ("2147485160" ))) {
524526 setDefaultData ();
525527 }
526528 }
527529 } else if (ConstantInOB .networkType == NetworkType .REG ) {
528- for (int i = 0 ; i < resp .getListList ().size (); i ++) {
529- if (resp .getListList ().get (i ).getPropertyid () != Long .parseLong ("2147483651" )) {
530+ List list = new ArrayList ();
531+ for (lnrpc .LightningOuterClass .AssetBalanceByAddressResponse response : resp .getListList ()) {
532+ list .add (response .getPropertyid ());
533+ if (!list .contains (Long .parseLong ("2147483651" ))) {
530534 setDefaultData ();
531535 }
532536 }
533537 } else { //mainnet
534- for (int i = 0 ; i < resp .getListList ().size (); i ++) {
535- if (resp .getListList ().get (i ).getPropertyid () != Long .parseLong ("31" )) {
538+ List list = new ArrayList ();
539+ for (lnrpc .LightningOuterClass .AssetBalanceByAddressResponse response : resp .getListList ()) {
540+ list .add (response .getPropertyid ());
541+ if (!list .contains (Long .parseLong ("31" ))) {
536542 setDefaultData ();
537543 }
538544 }
@@ -546,7 +552,7 @@ public void onResponse(byte[] bytes) {
546552 blockData .add (entity );
547553 getChannelBalance (resp .getListList ().get (i ).getPropertyid ());
548554 }
549- allData .addAll (blockData );
555+ // allData.addAll(blockData);
550556 runOnUiThread (() -> mAdapter .notifyDataSetChanged ());
551557 } catch (InvalidProtocolBufferException e ) {
552558 e .printStackTrace ();
@@ -627,7 +633,16 @@ public void run() {
627633 entity .setPropertyid (propertyid );
628634 entity .setType (2 );
629635 lightningData .add (entity );
630- allData .addAll (lightningData );
636+ for (int i = 0 ; i < blockData .size (); i ++) {
637+ for (int j = 0 ; j < lightningData .size (); j ++) {
638+ if (blockData .get (i ).getPropertyid () == lightningData .get (j ).getPropertyid ()) {
639+ allData .add (blockData .get (i ));
640+ allData .add (lightningData .get (j ));
641+ }
642+ }
643+ }
644+ Collections .sort (allData .subList (2 , allData .size ()));
645+ // allData.addAll(lightningData);
631646 runOnUiThread (() -> mAdapter .notifyDataSetChanged ());
632647 if (mRefreshLayout != null ) {
633648 mRefreshLayout .stopRefresh ();
0 commit comments