Skip to content

Instantly share code, notes, and snippets.

@CodeChamp-SS
Last active August 18, 2021 09:41

Google Summer of Code 2021 at Catrobat

Hi! I'm Saarthak Seth. My wonderful three month journey as Student Developer in the Google Summer of Code 2021 is about to end. This summer, I worked on an amazing project by Catrobat - Pocket Paint for Android. My project was mainly focussed on refactoring and rewriting the production code to Kotlin, implementing all the modern features designed specifically to streamline mobile development, resulting in safer and more maintainable code for future development. Along the way, I also worked on fixing some of the High frequency Crashes and ANRs to improve the overall app experience for the users.

I'll now be giving the package-wise breakdown of all the files that I refactored, for each of the modules(namely colorpicker, Paintroid) in the app.

colorpicker Module

1. Refactor ColoPickerView: Ticket, PR

2. Refactor HSVColorPickerView: Ticket, PR

3. Refactor RgbSelectorView: Ticket, PR

4. Refactor remaining files: Ticket, PR

Files that were refactored in the above PR:

  • ColorPickerPresetColorButton
  • PresetSelectorView
  • Constants
  • HSVSelectorView

Paintroid Module

1. Refactor WelcomeActivity: Ticket, PR

2. Refactor FileIO: Ticket, PR

3. Refactor remaining files: Ticket, PR

Files that were refactored:

  • UserPreferences
  • PaintroidApplicationFragment
  • PaintroidApplication
  • MyProvider

command package

1. Refactor DefaultCommandFactory: Ticket, PR[Merged]

Files that were refactored:

  • DefaultCommandFactory
  • CommandFactory

2. Refactor DefaultCommandManager: Ticket, PR[Merged]

Files that were refactored:

  • DefaultCommandManager
  • CommandManager

common package

1. Refactor the common package: Ticket, PR[Merged]

Files that were refactored:

  • CommandFactory
  • Constants
  • MainActivityConstants

contract package

1. Refactor LayerContracts: Ticket, PR[Merged]

2. Refactor MainActivityContracts: Ticket, PR[Merged]

controller package

1. Refactor controller package: Ticket, PR

Files that were refactored:

  • ToolController
  • DefaultToolController

dialog package

1. Refactor OverwriteDialog, ScaleImageOnLoadDialog: Ticket, PR[Merged]

2. Refactor SaveInformationDialog: Ticket, PR[Merged]

3. Refactor JpgInfoDialog, PngInfoDialog, OraInfoDialog: Ticket, PR[Merged]

iotasks package

1. Refactor SaveImageAsync, CreateFileAsync: Ticket, PR

Files that were refactored:

  • SaveImageAsync
  • CreateFileAsync
  • MainActivityInteractor
  • MenuFileActivityIntegrationTest
  • OraFileFormatIntegrationTest

2. Refactor LoadImageAsync, BitmapReturnValue: Ticket, PR

3. Refactor OpenRasterFileFormatConversion: Ticket

listener package

1. Refactor listener package: Ticket, PR[Merged]

Files that were refactored:

  • BottomBarScrollListener
  • PresenterColorPickedListener
  • BottomBarHorizontalScrollView

model package

1. Refactor model package: Ticket, PR[Merged]

Files that were refactored:

  • Layer
  • LayerModel
  • MainActivityModel

presenter package

1. Refactor LayerPresenter: Ticket, PR[Merged]

2. Refactor MainActivityPresenter: Ticket, PR

tools package

1. Refactor common package: Ticket, PR[Merged]

Files that were refactored:

  • CommonBrushChangedListener
  • CommonBrushPreviewListener
  • Constants
  • PointScrollBehavior
  • ScrollBehavior

2. Refactor drawable package: Ticket, PR[Merged]

Files that were refactored:

  • DrawableFactory
  • DrawableShape
  • DrawableStyle
  • HeartDrawable
  • OvalDrawable
  • RectangleDrawable
  • ShapeDrawable
  • StarDrawable

3. Refactor JavaCropAlgorithm: Ticket, PR

Files that were refactored:

  • CropAlgorithm
  • JavaCropAlgorithm
  • TransformToolIntegrationTest
  • JavaCropAlgorithmTest

4. Refactor JavaFillAlgorithm: Ticket, PR

Files that were refactored:

  • JavaFillAlgorithm
  • FillAlgorithm

5. Refactor remaining files of helper package: Ticket, PR[Merged]

Files that were refactored:

  • FillAlgorithmFactory
  • Conversion
  • DefaultNumberRangeFilter
  • NumberRangeFilter
  • JavaFillAlgorithmFactory

6. Refactor BaseTool and FillTool: Ticket, PR[Merged]

Files that were refactored:

  • BaseTool
  • BaseToolWithShape
  • FillTool
  • FillToolOptionsView
  • SprayTool
  • LineTool

7. Refactor Default tools: Ticket, PR[Merged]

Files that were refactored:

  • DefaultContextCallback
  • DefaultToolFactory
  • DefaultToolPaint
  • DefaultToolReference
  • DefaultWorkspace

8. Refactor PipetteTool and HandTool: Ticket, PR[Merged]

Files that were refactored:

  • HandTool
  • PipetteTool
  • ToolOptionsViewController
  • ToolOptionsVisibilityController

9. Refactor BrushTool and EraserTool: Ticket, PR[Merged]

Files that were refactored:

  • BrushTool
  • BrushToolOptionsView
  • BrushToolPreview
  • EraseTool

10. Refactor BaseToolWithRectangleShape: Ticket, PR[Merged]

11. Refactor CursorTool: Ticket, PR[Merged]

12. Refactor ShapeTool, ImportTool: Ticket, PR[Merged]

Files that were refactored:

  • ShapeTool
  • ImportTool
  • ShapeToolOptionsView

13. Refactor TextTool: Ticket, PR[Merged]

Files that were refactored:

  • TextTool
  • TextToolOptionsView

14. Refactor StampTool: Ticket, PR[Merged]

Files that were refactored:

  • StampTool
  • StampToolOptionsView
  • DefaultStampToolOptionsView

15. Refactor TransformTool: Ticket, PR[Merged]

Files that were refactored:

  • TransformTool
  • TransformToolOptionsView

16. Refactor remaining files: Ticket, PR[Merged]

Files that were refactored:

  • ContextCallback
  • ToolReference
  • Workspace
  • Tool
  • ToolPaint
  • ToolFactory
  • SprayTool
  • LineTool
  • SprayToolTest
  • LineToolTest

ui package

1. Refactor dragndrop package: Ticket, PR[Merged]

Files that were refactored:

  • DragAndDropListView
  • DragAndDropPresenter
  • ListItemLongClickHandler

2. Refactor CatroidMediaGalleryFragment: Ticket, PR[Merged]

3. Refactor DefaultFillToolOptionsView: Ticket, PR[Merged]

4. Refactor DefaultshapeToolOptionsView: Ticket, PR[Merged]

5. Refactor BrushToolView, DefaultBrushToolOptionsView: Ticket, PR

6. Refactor DefaultToolOptionsViewController: Ticket, PR

7. Refactor TopBarViewHolder, BottomNavigationViewHolder: Ticket, PR[Merged]

8. Refactor DrawerLayoutViewHolder, BottomBarViewHolder, LayerMenuViewHolder: Ticket, PR[Merged]

9. Refactor BottomNavigation: Ticket, PR[Merged]

Files that were refactored:

  • BottomNavigationLandscape
  • BottomNavigationPortrait

10. Refactor remaining files: Ticket, PR

Files that were refactored:

  • KeyboardListener
  • LayerNavigator
  • ToastFactory

11. Refactor MainActivityNavigator: Ticket, PR[Merged]

12. Refactor Perspective: Ticket, PR

13. Refactor DrawingSurfaceThread: Ticket, PR

Other Contributions

During the last 4-5 months of the pre-GSoC and GSoC periods, I've also made some other contributions like fixing some bugs, high frequency crashes and ANRs, implementing static analysis checks for Kotlin on Jenkins, code-reviewing some of the PRs, etc.

1. Added feedback where images are saved or copied to: Ticket1, Ticket2, PR1[Merged], PR2[Merged]

2. Fixed crash in ZoomableImageView.kt file due to kotlin.UninitializedPropertyAccessException: Ticket, PR[Merged]

3. Fixed loading of images on devices with android 5 and 6: Ticket, PR[Merged]

4. Fixed crash when using import image tool without file system access permission on Android 6.0: Ticket, PR[Merged]

5. Fixed the high-frequency ANR in DrawingSurface: Ticket, PR[Merged]

Also refactored the following files to Kotlin:

  • DrawingSurface
  • AsyncCommandManager
  • DrawingSurfaceListener

6. Added Kotlin Static Analysis and style checks to Jenkins similar to one implemented in Catroid to the project: Ticket, PR[Merged]

7. Fixed crash due to java.lang.IllegalArgumentException in DrawingSurface: Ticket, PR[Merged]

8. Fixed the very high frequency crash due to java.util.NoSuchElementException when calling DefaultCommandManager.undo and .redo: Ticket, PR[Merged]

9. Fixed the ANR in ColorPickerDialog: Ticket, PR

10. Following are some of the PRs that I code reviewed:

PS

The project is truly fantastic and amazing, I really loved to work on this project, and will love to continue working with the Paintroid team and keep contributing to the project after the GSoC'21 ends. With this project I learned a lot about Kotlin, Test Driven Development, and Clean Code practices which I think will definitely help me in my future as a Software Developer โ˜บ๏ธ.

Special Thanks to my Mentors: Patrick Gaisberger, Thorsten Bandel for Code-reviewing, PO-reviewing tonnes of my PRs ๐Ÿ˜‚, helping me in clearing even the silliest of my doubts and guiding me throughout the GSoC period๐Ÿ˜„.

Special Thanks to Wolfgang Slany for inviting me as a Developer to this wonderful organisation, guiding and helping me throughout my journey so far with the Catroid and the Paintroid Teams at Catrobat.

Special Thanks to some of my co-Paintroid team members who helped me by Code-reviewing, PO-reviewing tonnes of my PRs ๐Ÿ˜‚๐Ÿ˜œ, and also with fixing some minor bugs, failing tests in the PRs: Lorenz Dirry, Thorsten Bandel, Georg Roth, Michael Tiefnig.

Connect With Me on Linkedin, Github.

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