This project demonstrates the use of preparing the custom ui components. Keeping all the presentation logic of a view group in one place helps in improving the re-usability of the application and also easy maintaining it.
- Keeping the code decoupled as much as possible and having it resuable is one of the the important aspects of object oriented programming.
- While we use
view-model
,service
,repository
to seperate and keep the logics reusable, The UI layer also can be done similarly. - Now One the the way of doing it is demostrated in the demo here with three varieties of use cases that are extensivey used by developers.
- Decoupled code
- Reusable code in presentation logic
- Can fix bugs in one place and whereever the layer is used that gets reflected everywhere
- It consumes extra amount of time and effort to properly organize it
π΅ππππ ππππ πππ ππππππ ππ πππ πππππππ
Demo Type | Files used |
---|---|
ππππππ-πππππ ππππππ ππππ | ππππππ , π»ππ’πππ , π²ππππππ πππ , π²ππππππ πππ π²πππππππ |
πΌππππ-πππππ ππππππ ππππ | ππππππ , π»ππ’πππ , π΅πππππ»πππππ»ππ’πππ , πππππππ»πππππ»ππ’πππ , πππππππ»πππππ»ππ’πππ , πΏππππππ΄πππππ πππ , π²πππππ΄πππππ πππ |
ππππππ-πππππ ππππππ ππππ ππππ | ππππππ , π»ππ’πππ , π°ππππππ , π²ππππππ»ππππ²ππππ |
π³ππππππππππ πππππ πππ ππππ ππ πππππππ
π³πππ ππ’ππ | π³ππππππππππ |
---|---|
ππππππ-πππππ ππππππ ππππ | Here there a custom view which is a error component having a Tryagain click button.On click of try again button we show a toast |
πΌππππ-πππππ ππππππ ππππ | Here the single level custom component is encapsulated in another level custom component called the parent custom component. Whenever we pass the event from our screen to parent custom component, It in-turn deligates to child if needed for child. This we can have any number of nested level of components that can be added. |
ππππππ-πππππ ππππππ ππππ ππππ | Here we deponstrate the encapsulation of listview in a custom component. Here we pass the data nd the callback to the custom list component. There is a interface implemented in the screen from adapter of the list using which adapter can send the selection of item events in adapter |
π³πππ πππππππ ππ πππ πππππππ
π₯
πΈπ π’ππ ππππ ππππ πππππππ ππ π ππππππ πππ ππ’ πππππππ, πΈ π ππππ πππππππ’ ππππππππππ ππ.
ππππ ππππππππππππ ππππππππππ πππ ππππ πππππππππππ πππππππππ ππππππππππππ.
π΅ππππππ ππππππππ πππ πππ ππ’π π ππππππ, π΅πππ ππ πππππ ππππ.
πππππππ ππ ππ’ ππππππππ πππ β ππππππ ππ πππ πππππ πππππ ππ ππππ ππππ. βοΈ
ππππ πππππππ ππ ππππππππ πππππ πππ π°πππππ π»ππππππ πΈ.πΆ - πππ πππ π»πΈπ²π΄π½ππ΄ ππππ πππ πππππππ.