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
Feature/kotlin #38
Feature/kotlin #38
Conversation
Since javadoc doesn't support Kotlin (which breaks the build atm) I would recommend to use Dokka instead. It supports Java as well as Kotlin. I will look into this later. |
Thanks! I will take a look when I find some time. Meanwhile, the issue with both your bullet points is that they would be breaking changes. I agree that with ZoomApi the engine could be hidden, but someone might be using it, so we don't want to break their code. Same applies to delegation, let's not change the constructors. You can use an internal constructor without "this" but still provide the old constructor. I would also make the Anyway, thanks, it's cool to see this in Kotlin! |
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.
Sorry for the delay! I've been through some stuff, moved to another country and so on.
No problem I'm pretty busy right now too. Will take a look in approx. 2 weeks when exams are over. |
Cool! |
Well it was a little over 2 weeks (shame on me) but I finally made it. |
Any help needed to close this PR? I'd like this to get merge so I can help with some other issues, namely #2 without it disrupting this PR |
I am super busy and I have not reviewed changes but I am glad you made it @markusressel . I don't know how to manage this, I have an open PR at #59 which I am actively working at (there are more commits in my local machine + more coming) and I am in need of pushing that forward. It changes constructors, logic, adds stuff, removes stuff. Either we wait for #59 and then rewrite this and merge this quickly, or merge this now in a |
androidx is pretty big and useful as are the other parts of your PR. If it lessens the pressure on you @natario1 I'm happy with reapplying the knowledge of this PR to the version after #59 is merged and apply it to this PR. We just have to find a time where the switch to kotlin is doable and can get merged before making huge architectural changes again. |
Sorry for the delay. I will merge #59 now so @markusressel if you still want to go with this kotlin job, that would be cool. When you start we could add a little header to README to block new contributions for a while. I think it makes sense (like you did here?) to leave the demo app in java, so we can ensure that the API surface did not change from there. |
Great! I hope I can find some extra time this week(end) and get this language port out of the way soon. Well my time isn't exactly increasing either (hence the delay xD) but since I already know pretty much all of the codebase I may help where I can. Yes, my intention also was to leave the demo app in java to ensure backwards compatibility is still there. |
There are some things that need to be addressed before this can get merged:
|
@natario1 Ok so from my point of view this is a state that works just like the original version does. |
Will do this weekend, thanks! |
Some Kotlinish nits,
Could you fix/check these? Should be easy. The rest seems cool (at a first glance, honestly I can't process 2k lines with my eyes on two browser tabs) |
Last thing which is important, sorry. For most files git took this change as a delete + create new file. This is wrong because it means that all git history is lost for these files. Can you fix this? I would do this
Gave you access to the repo now |
Not on
Seems plausible.
Right, missed that. I also removed the shorthand and replaced it with a default parameter and
I don't see any zoom there, am I missing something?
Sure.
Yep. I removed the local variable
Well the empty string special case is an additional line but I replaced the other stuff with
No problem, we can always enhance it later :) |
Sorry I was looking at lines in this commit: 499f9ac . The if (zoom > 0) condition should be on newZoom |
Ah yes I fixed that already. |
I renamed the files using Anything else to consider? |
Yes, looks like it works. It's fine, will merge now! Thank you for the effort! |
As notes for the future, to release a new version, you just bump version in build.gradle and README, merge, then create a GitHub release, add who did what + PR links in the release notes, and Travis should publish to Bintray. Version names should be vX.X.X or Travis ignores them. I tend to squash commits in PRs when merging. I just used the rebase option now because there was the rename thing and we would probably have lost history again. |
This is a PR for #36
As of now I have tested the basic functionality of the library (as in using it on the emulator) and it seems to work just like the java version.
For this PR I tried to convert the code and leverage delegation and other features of Kotlin to minimize boilerplate. I did not try to change any logic to speed up performance or "improve" other things. This PR is only intended to use Kotlin as a way to write the same logic with way less and more readable code that has Null-Safety built in for free.
Some things I was unsure about when fleshing out the details:
ZoomEngine
with all it's features outside of implementations likeZoomLayout
andZoomImageView
? Previously it was possible to access the ZoomEngine by asking f.ex.ZoomLayout
. I think all methods exposed to the outside should be defined in the ZoomApi so I made that field private.ZoomLayout
andZoomImageView
users the ability to use theZoomApi
without the need to redundantly specify the "delegation methods" that simply point to the innerengine
field. To use delegation I had to change the ZoomEngine constructor so it doesn't needthis
as a parameter anymore. This was ok for theListener
, but not for thecontainer
. Since I didn't want to make the container typeNullable
(View?
) I initialized it with an empty inline View class. If you know a better solution to this let me know.I know this is a pretty big change (could it be any bigger?), so I am open to any kind of discussion.