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,repositoryto 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 |
𝙸𝚏 𝚢𝚘𝚞 𝚏𝚎𝚎𝚕 𝚕𝚒𝚔𝚎 𝚜𝚞𝚙𝚙𝚘𝚛𝚝 𝚖𝚎 𝚊 𝚌𝚘𝚏𝚏𝚎𝚎 𝚏𝚘𝚛 𝚖𝚢 𝚎𝚏𝚏𝚘𝚛𝚝𝚜, 𝙸 𝚠𝚘𝚞𝚕𝚍 𝚐𝚛𝚎𝚊𝚝𝚕𝚢 𝚊𝚙𝚙𝚛𝚎𝚌𝚒𝚊𝚝𝚎 𝚒𝚝.
𝚁𝚎𝚊𝚍 𝚌𝚘𝚗𝚝𝚛𝚒𝚋𝚞𝚝𝚒𝚘𝚗 𝚐𝚞𝚒𝚍𝚎𝚕𝚒𝚗𝚎𝚜 𝚏𝚘𝚛 𝚖𝚘𝚛𝚎 𝚒𝚗𝚏𝚘𝚛𝚖𝚊𝚝𝚒𝚘𝚗 𝚛𝚎𝚐𝚊𝚛𝚍𝚒𝚗𝚐 𝚌𝚘𝚗𝚝𝚛𝚒𝚋𝚞𝚝𝚒𝚘𝚗.
𝙵𝚎𝚊𝚝𝚞𝚛𝚎 𝚛𝚎𝚚𝚞𝚎𝚜𝚝𝚜 𝚊𝚛𝚎 𝚊𝚕𝚠𝚊𝚢𝚜 𝚠𝚎𝚕𝚌𝚘𝚖𝚎, 𝙵𝚒𝚕𝚎 𝚊𝚗 𝚒𝚜𝚜𝚞𝚎 𝚑𝚎𝚛𝚎.
𝚂𝚞𝚙𝚙𝚘𝚛𝚝 𝚒𝚝 𝚋𝚢 𝚌𝚕𝚒𝚌𝚔𝚒𝚗𝚐 𝚝𝚑𝚎 ⭐ 𝚋𝚞𝚝𝚝𝚘𝚗 𝚘𝚗 𝚝𝚑𝚎 𝚞𝚙𝚙𝚎𝚛 𝚛𝚒𝚐𝚑𝚝 𝚘𝚏 𝚝𝚑𝚒𝚜 𝚙𝚊𝚐𝚎. ✌️
𝚃𝚑𝚒𝚜 𝚙𝚛𝚘𝚓𝚎𝚌𝚝 𝚒𝚜 𝚕𝚒𝚌𝚎𝚗𝚜𝚎𝚍 𝚞𝚗𝚍𝚎𝚛 𝚝𝚑𝚎 𝙰𝚙𝚊𝚌𝚑𝚎 𝙻𝚒𝚌𝚎𝚗𝚜𝚎 𝟸.𝟶 - 𝚜𝚎𝚎 𝚝𝚑𝚎 𝙻𝙸𝙲𝙴𝙽𝚂𝙴 𝚏𝚒𝚕𝚎 𝚏𝚘𝚛 𝚍𝚎𝚝𝚊𝚒𝚕𝚜.


