Developer: Advice on IDE setup for working on Issues

I am a developer, fluent in Java development, but a beginner in Android development. I would like to start developing some potential changes to the K9 code, that I would submit as a potential Pull Request.

I have done the basics already: I created my own fork of the K9 GitHub repo, set up Android Studio and imported the K9 app, and I can build and run it on the emulator. :slight_smile:

I want to try to develop solutions for (e.g.) Issues #5466 and #5467, which obviously requires modifications to the fragments in the Navigation Drawer (see screenshots below). – But it seems those fragments are not pre-created layouts in the IDE but instead they seem to be created dynamically on the fly (??). => So can one of the developers kindly give me some clues about where these fragments are built (visually / xml) and coded (functionally / java)? Apologies for asking such a question, but K9 seems to be a historical hybrid of Java code and Kotlin, so it is quite difficult for me as a newcomer to navigate around the codebase.

image

image


Cketti is currently thinking about how to bring back the account overview screen. There was a post somewhere with more details but because there are a few users who just keep posting the same text again and again, the forum is really cluttered and I cannot find it anymore. I think it might be better to wait a bit before doing things with the side bar.

Anyway, this could be a pointer to how the navigation drawer works: k-9/AccountItem.kt at c943579615bd10b001444313a1f6de556b1db699 · k9mail/k-9 · GitHub

1 Like

Thanks for the response.

In the meantime I figured it out myself. The code is actually in K9Drawer.kt in which and I already made some changes to show a mock up of the UI; as you can see in the screen shot and the code snippets below.

NOTE: that this is only the front end so far, and I still need to implement the back end functionality to fetch the starred message count from the mail server.

image

private fun getBadgeText(unread: Int, starred: Int) : String {
    var rslt = ""
    if (unread > 0) {
        rslt = rslt + "● " + unread.toString()
    }
    if (starred > 0) {
        rslt = rslt + "   ★ " + starred.toString()
    }
    return rslt.trim()
}
private fun setAccounts(displayAccounts: List<DisplayAccount>) {
..
    getBadgeText(displayAccount.unreadCount, displayAccount.starredCount).takeIf { it.isNotEmpty() }?.let { bText ->
        badgeText = bText
private fun setUserFolders(folders: List<DisplayFolder>?) {
..
    getBadgeText(displayFolder.unreadCount, displayFolder.starredCount).takeIf { it.isNotEmpty() }?.let { bText ->
        badgeText = bText

@cketti just pinging you in case you want to use my code above…

cketti is pinged a lot here recently with many people stating exactly the same as the message that is just above it. I don’t think he currently monitors the pings. If you want to propose code, you should rather create a pull request on GitHub.

Ok. I will create a PR. But it is only partial code, so definitely not ready to merge – yet.

See [navigation-drawer] Display both unread and starred message counts in Navigation Drawer by andrewfg · Pull Request #5519 · k9mail/k-9 · GitHub

If only there was a warning to this problem and methods of minimizing the impact of such drastic changes…