kiwix-android
kiwix-android copied to clipboard
Convert Project to Kotlin
Is your feature request related to a problem? Please describe. Kotlin is our primary language but 40% of the codebase is still in java, this ticket aims to get that number to 0%. If you want to contribute to the project but are finding it diffcult to find a suitable ticket of a manageable size then this is for you!
Describe the solution you'd like
Comment here that you want to convert a class (I recommend starting with small ones) with the class name to claim it. Then make a ticket and start working on it. Use ctrl+alt+shift+k
to automatically convert the file and then improve it to be more idiomatic kotlin.
Additional context If you have never worked in kotlin before the koans (and the kotlin docs in general) are a good way to get used to the features. There is also support from kiwix members if you want to open a PR in draft
@macgills @kelson42 can I work on this issue. I will start converting file from intro folder and let you know as i progress further
@AjayThakur12 Yes, but do piece by piece. Module by module.
@macgills @kelson42 can i convert the local_file_transfer folder to kotlin ?
@AjayThakur12 a module is a bit larger than my original intention but intro
s classes are quite small
@rohanprasadofficial I would say LocalFileTransfer is too large to tackle all as one ticket. Try WifiDirectManager, that is over 400 lines, probaby more than the entire intro
module.
Both of you please make specific tickets Convert X to kotlin
@macgills okay great , thanks i will do WifiDirectManager then
@macgills can i work on this?
@thelosergeek Yes, Please open a ticket with the part you want to move to Kotlin.
@macgills @kelson42, I also want to contribute to the project, is there any class which is not assigned to anyone, I can convert to kotlin.
Comment here that you want to convert a class (I recommend starting with small ones) with the class name to claim it. Then make a ticket and start working on it.
Everyone should follow the directions of this ticket.
@Dalakoti07 go looking for a class (over 40% of the project is still in java), find one you like, comment its name here and make sure nobody else has already commented then make a ticket and get to work.
This ticket is meant to be a haven of autonomy mostly because my time is a bit limited right now and also I love seeing classes converted to kotlin.
I want to convert HelpActivity.
@yash1ts make a ticket
You mean I need to make a new issue and mention this issue there right?
You mean I need to make a new issue and mention this issue there right?
Yes, and you make the corresponding PR with the "fix"
can i work on this?
@jonggeunpark yes, open a ticket and then a PR with the piece of code you want to convert.
I would like to convert KiwixWifiP2pBroadcastReceiver.java
class to Kotlin
I would like to convert SharedPreferenceUtil.java
class to Kotlin
@kelson42 @macgills I would Like to convert LocaleFileTransferActivity.java
file into kotlin
#2249
I want to convert ErrorActivity.java into Kotlin file
@prayutsu great, please make that ticket
@macgills I want to convert FileReader.java to kotlin.
I would like to convert AddNoteDialog.java
class to Kotlin
I would like to convert HotspotNotificationManager.java
to Kotlin
I would like to convert RateAppCounter.java and HelpAdpater.java to Kotlin
I would like to convert KiwixWebView.java
class to Kotlin
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
I want to contribute on it.
I would like to convert LibraryViewCallback.java to Kotlin
@simonnepinto please go ahead! But first creat a ticket for that class.
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
i think this issue is already solved
if not then please tell me what changes can I do?
Do we have a list of modules which still need to be converted?
@kelson42 A couple of handfuls of java files are still here. https://github.com/search?p=5&q=repo%3Akiwix%2Fkiwix-android+language%3AJava&type=Code
@kelson42 @gouri-panda WHENEVER I AM DOING A COMMIT ON YOUR CLONED PROJECT I AM GETTING "commit failed with error" and the commit is failing . CAN YOU PLEASE HELP ME OUT ?
DESCRIPTION OF ERROR :
Running lint... Starting a Gradle Daemon, 1 incompatible Daemon could not be reused, use --status for details > Task :buildSrc:compileKotlin FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':buildSrc:compileKotlin'. > Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\Java\jre1.8.0_301' used by Gradle. Make sure Gradle is running on a JDK, not JRE. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 10s > Task :buildSrc:compileKotlin FAILED FAILURE: Build failed with an exception. * What went wrong: Execution failed for task ':buildSrc:compileKotlin'. > Kotlin could not find the required JDK tools in the Java installation 'C:\Program Files\Java\jre1.8.0_301' used by Gradle. Make sure Gradle is running on a JDK, not JRE. * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org BUILD FAILED in 2s Static analysis found violations and attempted to autofix, please commit these autoformat changes
@Rishavgupta12345 It's complaining that you are using a greater version of JDK 8 when your gradle is only compatible up to a JDK 8version. You need Java 8 or above JDK and not just JRE. Let me know if you still got errors.
@gouri-panda yes I did the following changes which you asked but things are not committing yet. but the error has changed from before
description of error:- Starting a Gradle Daemon, 1 incompatible and 4 stopped Daemons could not be reused, use --status for details FAILURE: Build failed with an exception. * What went wrong: Unable to start the daemon process. This problem might be caused by incorrect configuration of the daemon. For example, an unrecognized jvm option is used. Please refer to the User Manual chapter on the daemon at https://docs.gradle.org/6.2/userguide/gradle_daemon.html Process command line: C:\Program Files\Java\jdk1.8.0_301\bin\java.exe -Xmx4096m -Dfile.encoding=windows-1252 -Duser.country=IN -Duser.language=en -Duser.variant -cp C:\Users\risha.gradle\wrapper\dists\gradle-6.2-all\dvufqs6kielxeao781pmk5huj\gradle-6.2\lib\gradle-launcher-6.2.jar org.gradle.launcher.daemon.bootstrap.GradleDaemon 6.2 Please read the following process output to find out more: ----------------------- * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org FAILURE: Build failed with an exception. * What went wrong: java.net.BindException: Address already in use: Cannot bind * Try: Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output. Run with --scan to get full insights. * Get more help at https://help.gradle.org Static analysis found violations and attempted to autofix, please commit these autoformat changes
@Rishavgupta12345 You can ask these questions on our slacks Android channel. We can discuss over there. Ask in Android channel and I'll get back to you :)
hey, @gouri-panda I would like to convert matcher.java to matcher.kt, and can you explain to me what does it mean by first create a ticket for that class.
Thanks :)
@cdhiraj40 Github Issues let you track your work on GitHub. If you create an issue then you want to solve this issue, then the issue can assign to you. That's how anyone's work doesn't conflict with each other. If you want to convert a java class file to kotlin then you need to create an issue first if it isn't created yet. In this way, It'll keep track of which files are underway from java to kotlin, and also other contributors will know that if someone is working or not if they are interested in this class to convert java to kotlin.
issues let you track your work on GitHub
@cdhiraj40 Github Issues let you track your work on GitHub. If you create an issue then you want to solve this issue, then the issue can assign to you. That's how anyone's work doesn't conflict with each other. If you want to convert a java class file to kotlin then you need to create an issue first if it isn't created yet. In this way, It'll keep track of which files are underway from java to kotlin, and also other contributors will know that if someone is working or not if they are interested in this class to convert java to kotlin.
Okay thanks again for explaining, I will make a new issue if it hasn't been created yet :)
I want to contribute on this issue. Are there any classes left on which I can work ?
I want to contribute on this issue. Are there any classes left on which I can work ?
yes there are, here checkout https://github.com/search?p=5&q=repo%3Akiwix%2Fkiwix-android+language%3AJava&type=Code (for some PRs have been created so do check first :)
I would like to convert Datasource.java and KiwixIdlingResource.java
Can I work on this issue?
if there are still issues left then I would like to contribute to this one.
hello @aneeshgupta25 and @the-illuminatus pick any java file from here https://github.com/search?p=5&q=repo%3Akiwix%2Fkiwix-android+language%3AJava&type=Code and convert it to kotlin and make a PR! Don't forget to check if PR for some file has already been created and if not then do create an issue for your file :)
@cdhiraj40 Thanks.. Will definitely work on it.. :)
@cdhiraj40 I am working on the templates.java file but there's this variable "CUSTOM_APP_HAS_EMBEDDED_ZIM " and is initialized to. ~embed_zim~ I am not able to figure out what's ~ symbol in JAVA and about embed_zim. Can you plz guide me about this..?
@cdhiraj40 @gouri-panda seeking your review and further guidance. This is my first contribution in open source
This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.
@MohitMaliFtechiz @gouri-panda How much work is left here? I’m not really wanting to keep sucha ticket far more longer open.
hi @kelson42 , all files are converted to Kotlin , waiting for PR reviewed.