- [ Step 1 ] Remove duplicate code using methods
- Next [ Step 2 ] Use polymorphism and extract code from MainActivity
- Next [ Step 3 ] Follow (kind of) Clean Architecture to create well defined responsibilities
The goal of this three steps is to achieve the four rules of simple design
For this project Clean Architecture is a bit overkill, but it guides you to SOLID principles. The idea of this three steps refactors is to make the app easier to maintain. I am not an experienced android developer but I applied almost the same design patters for backend and frontend developments.
Code comments: I want to make and especial mention to comments while using a cvs as git is harder to keep dead code that to just remove it, make a very tinny commit and if you need the code again you can do a revert.
I have chosen button setups as examples because IMHO is the easier and most valuable change I could do over the code.
- Make code more abstract to create just 4 ways of handle dashboard buttons:
- launchActivity, from dashboard we launch another activity (eg. State)
- launchRecommendedAppButton, from dashboard it launches another app (e.g. K9)
- launchWebviewApp, from dashboard opens webview with url (e.g. Calc)
- launchWebviewWithNativeBrowser, from dashboard, it requests a uri open to OS (e.g. Upload)
I know this refactor remove two features:
- Let user choose xmpp client
- State long press dialog options
This two functionalities will be re-added during step 2 and 3.
PS. Gitlab diff is unclear... it messes up a lot of stuff