-
Notifications
You must be signed in to change notification settings - Fork 43
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: Remove redundant View castings in Android projects #65
Comments
Oh that is interesting. Does this reduce the amount of lint warnings we will get? |
Our compileVersion is 27, so it does seem like this should work. Good find! I'll mark it as a quick win, certainly contributor friendly. Go ahead and claim it if you like. 😄 |
Your title mentions only Services, but I imagine this is true in Survey, Tables, and Scan as well. I think we should extend it to all 4 apps. |
@opendatakit-bot claim |
Welcome to Open Data Kit, @srv-twry! We just sent you an invite to collaborate on this repository at https://github.com/opendatakit/opendatakit/invitations. Please accept this invite in order to claim this issue and begin a fun and rewarding experience contributing to Open Data Kit! Here are some tips to get you off to a good start:
See you on the other side (that is, the pull request side)! |
Hi @srv-twry thank you for your pull requests! There are some more redundant casts in androidlibrary, after those are fixed I will close this issue. |
@linl33 @wbrunette If this issue is still open, I would like to work on this. |
@VarunT11 the issue is still open. I will assign it to you. |
@wbrunette I have removed the Redundant View Castings from Android Library in odk-x/androidlibrary#191. |
@VarunT11 Yes, please remove the ones in Services as well. Thank you. |
@VarunT11 can you check out androidcommon, survey, and tables? Then we can close this issue. Good work! |
@wbrunette Yes Sure! I will check these as well. |
@wbrunette @linl33 While I was going through the code-base of Android Common for finding the Redundant Castings, there were several instances of suggestion by Android Studio to replace some Anonymous Methods with Lambda Expressions. Same is the case with Survey and Tables also. new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
//Some Code
}
} The above method was being suggested to be replaced with the following - (dialog, which) -> {
//Some Code
} This replacement would reduce the number of lint warnings and also make some imports unusable and hence we can remove them too. |
Since the issue is specifically for redundant casts, let's stick to that. Also ODK-X still supports Android devices that run Android 7 that don't support Lamdas. I hope the Android compile system would handle it correctly but not worth creating weird bugs we would have to track down later. |
PS: @wbrunette @linl33 I have made the PRs. Please review them! |
Software and hardware versions
Latest code from development branch.
Problem description
Currently there are a lot of instances of redundant View castings in the project.
For eg.
can be replaced by
They were required before but aren't required now and Android studio suggests removing them.
Steps to reproduce the problem
NA
Expected behavior
They should be removed.
Other information
NA
@jbeorse Views ?
Quick win for first timers may be 😄
The text was updated successfully, but these errors were encountered: