FancyShowCaseView icon indicating copy to clipboard operation
FancyShowCaseView copied to clipboard

Conver internal classes to "internal class"

Open faruktoptas opened this issue 7 years ago • 11 comments

Classes to be converted:

  • FancyImageView
  • Calculator

faruktoptas avatar Oct 24 '19 15:10 faruktoptas

Hi I would like to working on this issue. Thank you

YuetChan avatar Oct 24 '19 15:10 YuetChan

Thanks PRs welcome :)

faruktoptas avatar Oct 24 '19 16:10 faruktoptas

Do I just need to add "internal" keyword to both class Calculator in Calculator.kt and class FancyImageView in FancyImageView.kt? Do I have to edit any other file? I would appreciate your hel and feedback.

YuetChan avatar Oct 24 '19 16:10 YuetChan

After I add internal keyword to the FancyImageView, the FancyShowCaseViewTest shows compiler error. Since FancyImageView becomes internal in me.toptas.fancyshowcase, FancyShowCaseViewTest cannot access FancyImageView.DISABLE_ANIMATIONS_FOR_TESTING.

YuetChan avatar Oct 24 '19 18:10 YuetChan

Can you try adding @VisibleForTesting annotation?

faruktoptas avatar Oct 25 '19 09:10 faruktoptas

Thanks for the advise! After I google search on @VisibleForTesting, it seems like @VisibleForTesting does not actually change the visbility of a class/function. If a class/function is internal/private/public, its visibility is internal/private/public. Adding @VisibleForTesting will provide message when class/function is used in production code. Should I consider adding @VisibleForTesting(otherwise = VisbleForTesting.PACKAGE_PRIVATE) to both FancyImageView and Calculator?

YuetChan avatar Oct 25 '19 20:10 YuetChan

I think the best way is moving the tests under library folder. Currently tests are running under app module.

faruktoptas avatar Oct 26 '19 12:10 faruktoptas

Do you mean moving the tests from app modules to fancyshowcaseview module?

YuetChan avatar Oct 27 '19 07:10 YuetChan

Yes. But it should be another task.

faruktoptas avatar Oct 27 '19 19:10 faruktoptas

In summary, to convert internal class to "internal class", internal need to be added to FancyImageView and Calculator . After adding internal to FancyImageView and Calculator, FancyShowCaseViewTest need to be moved under fancyshowcaseview module. Moving FancyShowCaseViewTest under fancyshowcaseview module should be another task. Please correct me if I have any misunderstanding. Thank you.

YuetChan avatar Oct 27 '19 23:10 YuetChan

After this investigation the scope is changed a bit.

  • FancyImageView should be internal and
  • DISABLE_ANIMATIONS_FOR_TESTING will be moved under Calculator.

faruktoptas avatar Oct 28 '19 06:10 faruktoptas