浏览代码

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 年之前
父节点
当前提交
5a3db5ef2b
共有 1 个文件被更改,包括 4 次插入5 次删除
  1. 4 5
      src/main/java/com/owncloud/android/ui/adapter/ActivityListAdapter.java

+ 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;