-
Notifications
You must be signed in to change notification settings - Fork 1.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve media displayed in widgets [BarcodeWidget] #6534
base: master
Are you sure you want to change the base?
Conversation
@seadowg |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I definitely like the general direction of pulling out a view to specifically represent the answer here. I had in mind that we could go a bit further and have a generalized AnswerView
with a similar structure that where setAnswer
takes an IAnswerData
(I think the widget would handle the hidden appearance in that setup). That would get us something that's simple to then use in the hierarchy later.
@seadowg could you clarify your feedback because I'm not sure if I understand? |
I was thinking one |
a5e7c87
to
c976a03
Compare
That makes sense.
The view I factored out will be one that can be shared between the question layout and the hierarchy layout. As I rework other questions, I’ll likely introduce some form of abstraction. Later, when we work on the hierarchy view, we'll need to implement a factory to construct the appropriate view but that can wait for now. Let's maybe continue with other question types in this pull request to see how it goes, unless you have something against the current changes. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's maybe continue with other question types in this pull request to see how it goes, unless you have something against the current changes.
That sounds good! You're right that it makes more sense to introduce the generalization after 2 or 3 examples rather than trying to plan it ahead of time.
@grzesiek2010 I've been running into frustrations trying to add an arg to the Basically I think we need to get to a point where we can modify QuestionWidget(context, questionDetails, BearingWidgetAnswer()) That would let us easily modify |
c976a03
to
9cc8b1e
Compare
9cc8b1e
to
ff7bc99
Compare
ff7bc99
to
45f1b3f
Compare
45f1b3f
to
f704d6d
Compare
@seadowg
The current implementation adds the answers using XML, but this won’t be possible later in the summary view, where we’ll need to generate answers dynamically. So, it would probably make more sense to add that view programmatically in the widgets as well. Is that what you meant? Any other thoughts? |
Right it feels like we need to move to the views being added programmatically for this to work. So ideally class QuestionWidget<A>(private val widgetAnswerView: A) where A : View, A : WidgetAnswer { I think in Java we just need to use an abstract to combine the types: public abstract class WidgetAnswerView extends View implements WidgetAnswer {
} Then we'd be able to add that view into the layout for the |
Closes #6234
Why is this the best possible solution? Were any other approaches considered?
How does this change affect users? Describe intentional changes to behavior and behavior that could have accidentally been affected by code changes. In other words, what are the regression risks?
Do we need any specific form for testing your changes? If so, please attach one.
Does this change require updates to documentation? If so, please file an issue here and include the link below.
Before submitting this PR, please make sure you have:
./gradlew connectedAndroidTest
(or./gradlew testLab
) and confirmed all checks still passDateFormatsTest