Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
A summary of Frans-Lukas summer of code at Kiwix 2020.

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 [2].

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 [7]. 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 [2][3] 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 [10]. This means that most activities were converted to fragments, and navigation between them now uses the navigation component [7]. 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 [8].

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.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

Challenges

Code-wise I can think of one particular ticket that was difficult. Implementing two drawers and two bottom navigation bars [9]. 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:

Merged

  • Kiwix now uses a bottom navigation bar with three top level destinations [1].
  • Introduced a drawer for menu items that should be accessible from any top level destination [1].
  • Implemented the navigation component that allows for easy navigation and data sharing between destinations [1].
  • Developer resources such as a design guide and a guide on how to create new string resources in the application [2][3].
  • Contrast audit and fixes [8].
  • Bugs & refactoring. E.x. converting bookmarks and history activities to use unidirectional data flow architecture [6].

In progress

  • Conversion to a single-activity architecture [5].

For an overview of the exact tickets that were implemented see my Kiwix project site [4].

References

[1] Feature/navigation - https://github.com/kiwix/kiwix-android/pull/2269 2020-12-08
[2] Design - https://github.com/kiwix/kiwix-android/blob/develop/DESIGN.md 2020-12-08
[3] String Resources - https://github.com/kiwix/kiwix-android/blob/develop/STRING_RESOURCES.md 2020-12-08
[4] Kiwix project: Frans-Lukas/GSoC - https://github.com/kiwix/kiwix-android/projects/8 2020-12-08
[5] Feature/one-activity - https://github.com/kiwix/kiwix-android/issues/2235 2020-13-08
[6] Rewrite bookmarks activity - https://github.com/kiwix/kiwix-android/pull/2125 2020-24-08
[7] Navigation component - https://developer.android.com/guide/navigation/navigation-getting-started 2020-24-08
[8] Contrast audit/Fix accessibility - https://github.com/kiwix/kiwix-android/pull/2226 2020-24-08
[9] Always scroll two toolbars - https://github.com/kiwix/kiwix-android/issues/2186 2020-24-08
[10] Single Activity: Why, When, and How (Android Dev Summit '18) - https://www.youtube.com/watch?v=2k8x8V77CrU 2020-24-08

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment