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

Reduce View.kt size. #8708

Merged
merged 2 commits into from
Aug 6, 2022
Merged

Conversation

Isira-Seneviratne
Copy link
Member

What is it?

  • Bugfix (user facing)
  • Feature (user facing)
  • Codebase improvement (dev facing)
  • Meta improvement to the project (dev facing)

Description of the changes in your PR

  • Use nested functions in View.kt.
  • Create reusable class which overrides AnimatorListenerAdapter.

Fixes the following issue(s)

  • Fixes #

APK testing

The APK can be found by going to the "Checks" tab below the title. On the left pane, click on "CI", scroll down to "artifacts" and click "app" to download the zip file which contains the debug APK of this PR.

Due diligence

@Isira-Seneviratne Isira-Seneviratne marked this pull request as ready for review July 30, 2022 02:28
@Isira-Seneviratne Isira-Seneviratne force-pushed the Reduce_View.kt_size branch 2 times, most recently from 40ec913 to 6cdb011 Compare July 30, 2022 02:40
Copy link
Member

@Stypox Stypox left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, looks almost good

Comment on lines 277 to 281
private class RunnableExecutorAdapter(
private val view: View,
private val execOnEnd: Runnable?,
private val shouldHideView: Boolean
) : AnimatorListenerAdapter() {
override fun onAnimationEnd(animation: Animator) {
if (shouldHideView) {
view.isGone = true
}
execOnEnd?.run()
}
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd create two classes, one for when shouldHideView is true, one for when it's false, in order to avoid that runtime check (maybe the second can extend the first, but idk). The names for the two classes should be imo: HideAndExecOnEndListener and ExecOnEndListener. RunnableExecutorAdapter is not so meaningful.

@Isira-Seneviratne Isira-Seneviratne force-pushed the Reduce_View.kt_size branch 2 times, most recently from be334cd to d65683f Compare August 5, 2022 00:17
@sonarcloud
Copy link

sonarcloud bot commented Aug 5, 2022

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

0.0% 0.0% Coverage
0.0% 0.0% Duplication

@Stypox Stypox merged commit d9230c0 into TeamNewPipe:dev Aug 6, 2022
@Isira-Seneviratne Isira-Seneviratne deleted the Reduce_View.kt_size branch August 6, 2022 10:50
@Stypox Stypox mentioned this pull request Aug 27, 2022
9 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants