MCPcopy Create free account
hub / github.com/M66B/FairEmail / getView

Method getView

app/src/main/java/eu/faircode/email/ActivityView.java:579–611  ·  view source on GitHub ↗
(View view, RecyclerView parent, int pos)

Source from the content-addressed store, hash-verified

577 }
578
579 private View getView(View view, RecyclerView parent, int pos) {
580 if (pos == NO_POSITION)
581 return null;
582
583 if (!getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.STARTED))
584 return null;
585
586 TupleAccountFolder prev = adapterNavAccount.getItemAtPosition(pos - 1);
587 TupleAccountFolder account = adapterNavAccount.getItemAtPosition(pos);
588 if (pos > 0 && prev == null)
589 return null;
590 if (account == null)
591 return null;
592
593 if (pos > 0) {
594 if (Objects.equals(prev.category, account.category))
595 return null;
596 } else {
597 if (account.category == null)
598 return null;
599 }
600
601 View header = inflater.inflate(R.layout.item_nav_group, parent, false);
602 TextView tvCategory = header.findViewById(R.id.tvCategory);
603
604 tvCategory.setText(account.category);
605
606 header.measure(View.MeasureSpec.makeMeasureSpec(parent.getWidth(), View.MeasureSpec.EXACTLY),
607 View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
608 header.layout(0, 0, header.getMeasuredWidth(), header.getMeasuredHeight());
609
610 return header;
611 }
612 };
613 rvAccount.addItemDecoration(categoryDecorator);
614 }

Callers 4

onDrawMethod · 0.95
getItemOffsetsMethod · 0.95
onLayoutChangeMethod · 0.45
onShownMethod · 0.45

Calls 5

setTextMethod · 0.65
getLifecycleMethod · 0.45
getItemAtPositionMethod · 0.45
equalsMethod · 0.45
getWidthMethod · 0.45

Tested by

no test coverage detected