Frans-Lukas Google summer of code 2020
My initial goal for this summer was to create a style guide and refactor the user interface of the Kiwix Android application. This goal, and more, is also what I have achieved. To start with, my mentor and I discussed how the user interface should be refactored, and came to the conclusion that the in-app navigation is what needed to change. This navigation refactor was designed, discussed and planned. The style guide was also discussed, and incrementally written as a markdown linked in the GitHub contribution guide .
The navigation refactor consisted of moving common activities/destinations to a bottom navigation bar instead of being hidden in different menus across the application. This also included bringing a new library/module to the project, the navigation component . This component allows for easier implementation of navigation and data sharing between destinations. By simplifying navigation, menu access had to be simplified as well. This was done by moving hard-to-access menu items to a drawer that is accessible from almost anywhere in the application.
The style guide  describes how to work with different design elements of the Kiwix Android application. This includes how to work with themes, styles and text in the application. It also describes contrast and provides links to useful design resources.
For any remaining time, a conversion to a single-activity application was progressed . This means that most activities were converted to fragments, and navigation between them now uses the navigation component . Other smaller issues were solved, such as refactoring activities to use better architecture, fixing bugs and improving contrast across the application with a contrast audit .
What I have learned
Listing all things I have learned during this summer would make this a non-summary, instead I will list four things I think will stick with me for the rest of my career.
- Kotlin. I will never want to go back to Java after having worked with Kotlin. Kotlin feels clean to write. The combination of null safety, scope functions, extension functions, collections and much more makes Kotlin feel clean and that it does what I want it to do with minimal boilerplate.
- A continious integration workflow. Having done the issue -> branch -> commits -> pull request -> static analysis -> commits -> code review -> commits -> merge workflow 50 times over have made me comfortable in many things git and continious integration. Issues such as merging with the wrong branch, committing wrong files or having to go back in history were occasionally met, and solved. This has given me confidence in a complete team-based workflow and powerful tools such as git and static analysis.
- The difference between instrumentation and unit tests and how to implement both in Kotlin. After having refactored two large activites and making them use a Model-View-Intent architecture, I had to unit test the model part using kotlin testing libraries. I wrote instrumentation tests after converting activities to fragments as well.
- The scope and difficulty of being able to contribute to a complete project. I have never practiced reading code or tried to understand a complete project before GSoC 2020. During this summer I would say I understand the most important parts of the Kiwix Android application. At least to such a degree to where I can give advice and point directions to new contributors. This gives feelings of code ownership and of having progressed.
Code-wise I can think of one particular ticket that was difficult. Implementing two drawers and two bottom navigation bars . This was difficult because Android is a lot like building a PC, it works easily most of the time because we have these finished components and slots that match together. However, when we need two graphics cards but have only one slot, we have to perform magic to make both graphics cards work. That is, Android is intended to be developed a certain way (only one toolbar, only one drawer), and when we mix components in non-intended ways, things start to break or become unnecessarily difficult.
To summarize my Google summer of code 2020 I have achieved the following:
- Kiwix now uses a bottom navigation bar with three top level destinations .
- Introduced a drawer for menu items that should be accessible from any top level destination .
- Implemented the navigation component that allows for easy navigation and data sharing between destinations .
- Developer resources such as a design guide and a guide on how to create new string resources in the application .
- Contrast audit and fixes .
- Bugs & refactoring. E.x. converting bookmarks and history activities to use unidirectional data flow architecture .
- Conversion to a single-activity architecture .
For an overview of the exact tickets that were implemented see my Kiwix project site .
 Feature/navigation - https://github.com/kiwix/kiwix-android/pull/2269 2020-12-08
 Design - https://github.com/kiwix/kiwix-android/blob/develop/DESIGN.md 2020-12-08
 String Resources - https://github.com/kiwix/kiwix-android/blob/develop/STRING_RESOURCES.md 2020-12-08
 Kiwix project: Frans-Lukas/GSoC - https://github.com/kiwix/kiwix-android/projects/8 2020-12-08
 Feature/one-activity - https://github.com/kiwix/kiwix-android/issues/2235 2020-13-08
 Rewrite bookmarks activity - https://github.com/kiwix/kiwix-android/pull/2125 2020-24-08
 Navigation component - https://developer.android.com/guide/navigation/navigation-getting-started 2020-24-08
 Contrast audit/Fix accessibility - https://github.com/kiwix/kiwix-android/pull/2226 2020-24-08
 Always scroll two toolbars - https://github.com/kiwix/kiwix-android/issues/2186 2020-24-08
 Single Activity: Why, When, and How (Android Dev Summit '18) - https://www.youtube.com/watch?v=2k8x8V77CrU 2020-24-08