Skip to content
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

Refactor list views using Adapter Pattern #2127

Closed
1 of 2 tasks
huangyz0918 opened this issue Apr 13, 2018 · 11 comments
Closed
1 of 2 tasks

Refactor list views using Adapter Pattern #2127

huangyz0918 opened this issue Apr 13, 2018 · 11 comments
Labels

Comments

@huangyz0918
Copy link
Contributor

huangyz0918 commented Apr 13, 2018

Problem description

As @grzesiek2010 said in #2099 , It's better to refactor lists using Adapter Pattern. So thanks : )

Xml Files ---> Adapter ---> Java Class

It can:

  • Simplify our code and make it easier to read.
  • Help us manage our list items.
  • Remove the unnecessary if-else statements.
  • Make code easier to patch fixes and changes.

Which list may need this refactor?

  • Media Layout items: see MediaLayout.java --> setAVT method or others.
  • Jump/Hierarchy view items: see HierarchyElementView.java or others. (need discussion whether it needs a refactor or not)

Expected behavior

Code can be easier to read and modify with Adapter Pattern.

@opendatakit-bot label "refactor"
@grzesiek2010 I think PR #2123 and PR #2099 are hot fix pull requests focus on specific issues, if we need to refactor related lists, we can work on this issue after hot fixes were merged.

@grzesiek2010
Copy link
Member

@huangyz0918 I refactored our HierarchyView to show what I meant it's here #2128

@grzesiek2010
Copy link
Member

grzesiek2010 commented Apr 13, 2018

When it comes to MediaLayout I'm not sure if it should be an adapter (since we don't use a list there) but the layout should be created using an xml file at least to avoid all those if statements.

@huangyz0918
Copy link
Contributor Author

@grzesiek2010 Yes it really needs a refactor but I'm too busy recently (I have to prepare my English exam), so let's see if anyone can take a look and improve this.

@grzesiek2010
Copy link
Member

Ok, I see no problem. I appreciate your help!

@surajdubey
Copy link

@opendatakit-bot claim

@getodk-bot
Copy link
Member

ERROR: This active issue has no assignee.

4 similar comments
@getodk-bot
Copy link
Member

ERROR: This active issue has no assignee.

@getodk-bot
Copy link
Member

ERROR: This active issue has no assignee.

@getodk-bot
Copy link
Member

ERROR: This active issue has no assignee.

@getodk-bot
Copy link
Member

ERROR: This active issue has no assignee.

@shobhitagarwal1612
Copy link
Contributor

@opendatakit-bot claim

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants