Comcast / Comcast/blueprint

Generate Default ComponentViewBase classes

Open
#26 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Kotlin
Stars
21
Forks
15
PR merge metrics
No merged PRs in 30d

Description

Since ComponentViewBase classes have so much auto generated functionality, it's now often not even necessary to override them.

Because of this, clients often wind up with code that looks like this:

`@(viewHolderClass = DetailedUsageLabelViewHolder::class)
class DetailedUsageLabel : DetailedUsageLabelBase()

@ComponentViewHolder(viewType = R.layout.detailed_usage_label)
class DetailedUsageLabelViewHolder(itemView: View) : RecyclerView.ViewHolder(itemView) {
val label: TextView = itemView.findViewById(R.id.label) as TextView
}`

In this example, the DetailedUsageLabel class has to be written and annotated, even though it has no functionality.

Solution: When a ComponentViewHolder class is declared with no ComponentViewClass, annotate the create the ComponentViewBase class, name it as the ComponentView class, and annotate it as the ComponentViewClass for that ComponentViewHolder.

Contributor guide

Open the contributing guide

Research direction

Start by locating the ComponentViewHolder, ComponentViewBase, and ComponentViewClass declarations and the code-generation entry point that connects them. Verify the behavior using the DetailedUsageLabelViewHolder example: a holder without an explicit view class should result in the matching generated base class and annotation.

Written by the indexing model from the issue text.

Assessment

Tech stack
android, kotlin
Domain
mobile
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.