Browse Source

replace do while loop in getHeaderPositionForItem with while loop

Signed-off-by: alex <alex.plutta@googlemail.com>
Signed-off-by: Andy Scherzinger <info@andy-scherzinger.de>
alex 5 years ago
parent
commit
5a3db5ef2b

+ 4 - 5
src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java

@@ -429,17 +429,16 @@ public class ActivityListAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
 
     @Override
     public int getHeaderPositionForItem(int itemPosition) {
-        int headerPosition = 0;
-        do {
+        while (itemPosition >= 0) {
             if (this.isHeader(itemPosition)) {
-                headerPosition = itemPosition;
                 break;
             }
             itemPosition -= 1;
-        } while (itemPosition >= 0);
-        return headerPosition;
+        }
+        return itemPosition;
     }
 
+
     @Override
     public int getHeaderLayout(int headerPosition) {
         return R.layout.activity_list_item_header;