question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Consider eliminating potentially redundant views

See original GitHub issue

Great work so far! I really appreciate you putting this together!

I was playing around with the layout inspector and sample app and was surprised to see how deeply nested the view hierarchy is and how many extra views are being generated.

I believe the library is making too many FrameLayouts that are unnecessary in some situations and at least one LinearLayout that, as far as I can tell, can be eliminated completely without any impact to users.

Removing the extra LinearLayout, if possible, would be a quick and easy win. Here’s the block that creates it inside CalendarAdapter.onCreateViewHolder:

val monthBodyLayout = LinearLayout(context).apply {
  layoutParams = LinearLayout.LayoutParams(LP.WRAP_CONTENT, LP.WRAP_CONTENT)
  orientation = LinearLayout.VERTICAL
  id = bodyViewId
}
rootLayout.addView(monthBodyLayout)

If you remove the block above and make some other minor adjustments, the week views can be added directly to the rootLayout.

Removal of the extra FrameLayouts looks to be a little more tricky and I’d like to understand more about why it’s there. However, if I understand what you’re trying to do, I think there may be some better alternatives that accomplish what you’re looking for.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

1reaction
kizitonwosecommented, Jul 22, 2020

Thought this would be closed since it’s referenced in #186 but just remembered it’s only for merges on the main branch. So closing this manually.

0reactions
luis-cortescommented, Jul 22, 2020

I think I’ve done it 🙂 . I’ve managed to get rid of the FrameLayout without any impact to the user (as far as I can tell). All the calendars look the same and all the tests pass. PR incoming.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Fix Redundant Views - Google Analytics Community
To remove redundant views: Click Admin, use the View menu to select the view you want to remove, click View Settings, then click...
Read more >
How to Fix Redundant Views in Google Analytics
Step-8: Click on 'Trash View' to confirm. You're done, you have successfully deleted the redundant view in Google Analytics.
Read more >
Google Analytics - How to fix "This property has multiple views ...
Select the redundant view you want to delete. Step 4. Then, select View settings from the selected View.
Read more >
Reduce Data Redundancy(Remove Duplicates)
This page describes how to examine your tables to ensure they reduce data redundancy and allow unique records to be added.
Read more >
It's Time to Get Rid of Those Redundant Indexes
An index is considered redundant if there is at least one other index for the same table or view which contains at least...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found