Agora Vote Android
Overview of the Application
Android Application for Agora Web that uses Agora: An Electronic Voting Library implemented in Scala. This application uses Agora Web API as backend application.
I have identified the following tasks in the project at the starting of the project.
- Move codebase to kotlin - Done
- Move to MVVM Architecture - Done
- Move to Single Activity Architecture using android navigation architecture components - Done
- Offline support - Done
- Refactor architecture with Dependecy Injection Framework - Done
- Add new retrofit instance for handling custom exceptions - Done
- Redesigning the whole application - Done
- Add dark mode support - Done
- Add Calendar View to show elections - Done (Suggested by the mentors during community bonding period)
- Add Two Factor Authentication Feature - Done
- Add Deep links for cast vote feature - Done
- Add Cast vote feature - Done
- Add change avatar feature - Done (Not mentioned in proposal, I added it as a necessary feature)
Deep view into the technology.
Libraries used in this project are listed below:
- Dagger-A fast dependency injection framework by Google.
- Room-To implement offline support for the user.
- Kotlin Coroutines-Library support for Kotlin coroutines with multiplatform support.
- Horizontal Calendar-A material horizontal calendar view for Android based on RecyclerView.
- Tachyon-An Android library that provides a customizable calendar day view.
- Picasso-A beautiful library for image loading from Sqaure.
- Retrofit-A type-safe HTTP client for Android and Java.
- Material Design For Android-Material design is a comprehensive guide for visual, motion, and interaction design across platforms and devices.
- Design support- The Android Support Library contains several library packages that can be included in your application. Each of these libraries supports a specific range of Android platform versions and set of features.
- Shimmer For Android-Shimmer is an Android library that provides an easy way to add a shimmer effect to any view in your Android app.
- gson-A Java serialization/deserialization library to convert Java Objects into JSON and back.
- Navigation Component- Android Jetpack's Navigation component helps you implement navigation, from simple button clicks to more complex patterns, such as app bars and the navigation drawer.
- Recycler View- To display a scrolling list of elements based on large data sets (or data that frequently changes).
- Card View- To create card views.
- Pie Chart- A powerful & easy to use chart library for Android.
- Facebook Login- To implement User login using social media account.
Summary of whole GSoC journey
As I was already familiar with the codebase, I started with setting the initial boilerplate code and setting up the architecture for smooth flow of work. Firstly, I started with moving architecture of the project to Single Activity Architecture using Android Navigation Architecture Components, and Moving the codebase from java to kotlin.
Coding period begins. This phase is the most important one as the whole architecture of the project is going under a lot of changes, and new features like moving to MVVM Architecture, offline support using room database, addition of dagger as dependency injection framework and some other major changes was about to take place.
Now with project following a clean and efficient architecture, I started working towards redesigning the application according to the mockups using all the materail design components and adding support for dark mode. Then the most challenging part was to implement calendar view for election fragment, but I was able to do it after a lot of research. After this, as I was ahead of my timeline, I started working on two factor authentication feature mentioned in 3rd phase.
During this period, I worked on some major features like Adding Deep links, Verify Voter, Cast Vote, Testing. As Agora Vote is almost ready for deployment, I added change avatar feature as one of the common features of a android application in which I have to take care of sampling and rotation of images and I used picasso for image loading. This being officially the final phase, I also had to take care of all the smooth functioning of app and clean up code, improve wherever necessary and document the project overview at the end.
I would love to thank my mentors especially Thuvarakan Tharmarajasingam, Abanda Ludovic, Mukul Kumar and Bruno Woltzenlogel Paleo for always providing me constant support, they were always there for guiding me to follow better practices and suggested some very good enhancements and features for the project. Special thanks to Mukul for all the immediate merges and being so responsive whenever I faced a challenge. It was a wonderful experience working with you guys and I would love to be a part of the organization after GSoC.
The major next step for the project is deployment which requires privacy policies and terms and conditions (T&C) agreements which me and my mentors are preparing for. And new students can contribute toward adding more features from the Web API and adding more unit tests, I will open some new issues on these topics for beginners.
Calendar View Events:
Settings and Profile Screens with Change Avatar Feature:
Two Factor Authentication:
Cast Vote Feature:
Home and Create Election Screens:
Election Details Screens:
- Merge Request !1- Authentication screens to Kotlin fragments (Merged)
- Removed Splash Activity and added a splash theme with vector drawable.
- Added navigation graph for the authentication feature.
- Converted Authentication Screen(Login, Signup, HomeLogin, forgotPassword) to kotlin fragments.
- Use of navigation components and animations to move between fragments.
- Merge Request !2- Added Bottom Navigation Bar, Custom Toolbar along and Some Changes- status (Merged)
- Added Bottom Navigation bar and custom toolbar in the Main activity.
- Handled the visibility of the navbar and custom toolbar.
- Override onBackPressed method for correct behavior.
- Added Elections and More Fragments.
- Migrated Home Fragment to kotlin.
- Added AuthListener to handle success Events.
- Added View utility to show and hide the support action bar.
- Added some icons and animations for the above functionalities.
- Merge Request !3- Added More options fragment (Merged)
- Migrated home fragments to kotlin.
- Created layout for More Options Fragment.
- Added selectable drawable for textviews in options.
- Added option screens to navigation graph.
- Merge Request !4-Converted all display elections screens to Kotlin fragments-status (Merged)
- Developed Elections Fragment.
- Converted Active, Pending, and Finished screens to kotlin fragments.
- Linked Fragments to navigation Graph.
- Merge Request !5-Added Adapter Callbacks and Converted Ballot, voters and Election Details screen to kotlin fragments.-status (Merged)
- Added adapter callback to handle onItemTouchListener for recycler view.
- Used live data in display election ViewModel and converted it to kotlin.
- Migrated Voter, ballot, and Election details kotlin fragments.
- Merge Request !6-Configured create election module for single activity architecture and migrated it to kotlin-status (Merged)
- Complete create election module migrated to kotlin
- Follows Single Architecture
- Added listeners.
- Merge Request !7- Invite voters module - Single Activity and Kotlin migration-status (Merged)
- Configured invite voter module for single activity architecture and moved to kotlin codebase.
- Merge Request !8-Setup project for room database- status (Merged)
- Added room dependencies
- Setup database builder
- Added User entity
- Setup preference provider
- Merge Request !9- Dagger Configuration -status (Merged)
- Added dagger utilities, modules and components.
- Merge Request !10- Configured login module for MVVM architecture, added repository layer -status (Merged)
- Added dependencies for kotlin coroutines.
- Added network interceptor.
- Configured retrofit client for MVVM architecture.
- Added user repository.
- Configured login fragment for MVVM architecture.
- Added custom exceptions.
- Added Textwatcher for login fragment fields to disable/enable button accordingly.
- Merge Request !11- Save User -status (Merged)
- Added User Dao
- save user after login
- Added different messages for different API or internet exceptions
- Removed Toast with Snackbar in the login module.
- Removed load toast with progress bar in login fragment.
- Merge Request !12- Refactoring login module with dagger -status (Merged)
- Injected various dependencies
- Added Fragment Key and Fragment Factory
- Refactored login, welcome fragment, and Main Activity with the dagger.
- Merge Request !13- Refactoring home module -status (Merged)
- Added Election Dao, election entity.
- Models for ballot, candidates, score, voters, and winner.
- API implementation to get user's elections if fetching required.
- Added Election Repository.
- Use of live data to get all Elections from the Election Repository.
- Refactored home module for MVVM.
- Refactored home and more options module with Dagger.
- Added type converters and Coroutine extension functions
- Merge Request !14- Fix - Refresh token -status (Merged)
- Refactoring update token function according to current retrofit instance
- Merge Request !15- (Compiling all the work for Phase 1 in one MR) Move to MVVM Architecture, Dagger Configuration, Offline support, Repository layer for managing elections, New UI for election fragment, Added validations for dates, Added fb authentication and Manage App State accordingly -status (Merged)
- Implemented logout feature, now all the user data and preferences gets deleted on logout.
- The new item list and election adapter with data binding feature(new) for election fragment recycler view are created.
- Live data is fetched in election fragment and bounded to the UI.
- Signup, forgot password, create election, display all elections, invite voters, profile, and election details modules are configured with MVVM, dagger, and new retrofit instance.
- Added offline support for the app in case the user is not connected.
- Added the Repository layer to follow MVVM architecture.
- Use of live data and data binding to update UI.
- New UI for recycler view items.
- Validator added for start and end date during create election feature.
- Added an Authentication interceptor to handle the case if the token gets expired while the app is running.
- Added facebook authentication and configured app accordingly for FB user
- Removed Tiny DB lib
- Removed Load Toast lib and replace it from android's progress bar
- Cleaned architecture and fixed bugs.
- Merge Request !16- Redesign Authentication and welcome screens (Merged)
- Redesigned Welcome, login, signup and Forgot Password
- Dark Mode is supported for the above screens
- Used material components theme and widgets
- Tested for smaller screens and lower API level
- Changed MinSdkVesrion to API level 22
- Merge Request !17- Redesign home and create Election Screens (Merged)
- Home and Create election screens are redesigned and compatible with dark mode.
- Merge Request !18- Redesign Settings, profile and other screens -status (Merged)
- Settings, Account Settings, About Us, Contact Us, Share screens are redesigned and compatible with dark mode.
- Merge Request !19- Add Calendar view to the election fragment -status (Merged)
- Setup Calendar fragment.
- Added horizontal calendar view.
- Added Day view.
- Added custom backgrounds for the pending, active, and finished elections.
- Added Custom hour label.
- Handle the case for events for more than 1 day.
- Now events are added to the calendar view after getting election response from API.
- Merge Request !20- Adding swipe refresh and Android calendar view to Calendar View Fragment -status (Merged)
- Added swipe refresh feature to a calendar view to update the elections in the DB
- Progress bar to show the progress of loading of events
- Swipe down android calendar view to move from one month to another
- Integrated android calendar view with horizontal calendar view and day view.
- Hide app bar view on scrolling down.
- Merge Request !21- feat: Two Factor Authentication -status (Merged)
- Implemented 2 factor authentication toggle in profile settings
- Made two factor authentication screen
- Implemented verify voter feature.
- Manged application state and database accordingly.
- Merge Request !22- Bug fixes and Some UI Changes -status (Merged)
- Bug fixes related to the two-factor authentication feature
- Some UI changes to the Elections list and Election Details Screen.
- Merge Request !23- feat: Resend OTP -status (Merged)
- Implemented resend OTP feature.
- Merge Request !24- feat : Deep Links and Verify Voter -status:Merged
- Added deep links to cast vote activity
- Resolved the sendgrid.net URL to retrieve election id and passcode
- Implemented verify voter feature to fetch election data.
- Added default animation for fragment transitions.
- Fixed some bugs.
- Merge Request !25- feat: Cast Vote -status (Merged)
- Cast vote screen
- Data Binding to bind election data to UI
- Implemented Cast Vote Feature.
- Redesigned Invite voter Feature.
- Merge Request !26- Refactor tests for new Retrofit instance and added some test suites -status (Merged)
- Refactor API tests for new retrofit instance.
- Added Coroutines in tests.
- Added test suites.
- Merge Request !27- feat: change avatar -status (Merged)
- Picasso for image loading
- Added Permission for camera and storage
- Handled rotation and sampling of the image.
- Implemented change avatar API.
- Merge Request !28- Code cleaning and bug fixes -status (Merged)
- Cleanup Code
- Remove warnings
- Rearrange architecture
- Bug fixes
- Merge Request !28- Library Updated and Fix memory leaks -status (Merged)
- Test App for memory leaks.
- Updated dependencies in apps build.gradle
- Made changes accordingly.
- Merge Request !29- Documentation of the work product -status (Merged)