You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Matrix is an Android Project which provides a general platform for drivers to share traffic condition events.
Drivers are able to register their accounts and able to login. Driver can upload events, watch events, check details and give comments on Google Map interface.
Matrix uses cutting-edge framework Firebase to establish flexible and maintainable backend service group. Uses Toolbar, ViewPager and NavigationView combination to build user-friendly UI framework. Integrated Google Map to allow users checking instant events at their convenience.
Project Structure
1. OnBoardingActivity
The screen where allows user to login and register as folows:
Part
Files Related
Description
OnBoardingActivity
OnBoardingActivity.java
The screen where allows user to login and register
res/layout/activity_on_boarding.xml
Layout file
Viewpager
OnBoardingActivity.java
It uses the OnBoardingPageAdapter to load LoginFragment and RegisterFragment
OnBoardingBaseFragment
OnBoardingBaseFragment.java
Base fragment of the Login and RegisterFragment which has the shared logic setup
LoginFragment
LoginFragment.java
Extends OnBoardingBaseFragmentBase and defines the login related business logic
res/layout/fragment_login.xml
LoginFragment’s layout file
RegisterFragment
RegisterFragment.java
Extends OnBoardingBaseFragmentBase and defines the register related business logic
res/layout/fragment_login.xml
RegisterFragment’s layout file
2. ControlPanelActivity
Control Panel is the container of everything inside, including MainFragment.
Other than that Fragments, ControlPanel also contains ToolBar and Navigation View
Part
Files Related
Description
Toolbar
ControlPanel.java
ControlPanel includes Toolbar
res/layout/activity_control_panel.xml
ControlPanel includes Toolbar
NavigationView
ControlPanel.java
ControlPanel includes NavigationView
res/layout/activity_control_panel.xml
ControlPanel includes NavigationView
res/layout/nav_header.xml
The layout of navigationview header, at the top
res/menu/drawer_view.xml
The menu item below navigationvie header, includes settings & homes
3. MainFragment
Main Fragment is the main user interface, it includes several features:
3.1. MainFragment (Main Feature)
The main feature, it shows Google Map and event on screen:
Part
Files Related
Description
MainFragment (Main Feature)
ControlPanel.java
ControlPanel contains MainFragment
MainFragment.java
Main Fragment logic java file
res/layout/fragment_main.xml
Main Fragment main UI container
res/raw/style_json
Styling Google map
3.2. MainFragment (Upload Event)
Open ReportDialog and take the dialog’s callback to upload Event to Firebase (Click button on right-bottom corner of picture above)
Part
Files/Functions Related
Description
MainFragment (Upload Event)
MainFragment.java
Main Fragment contains Upload Event Feature
showdialog
Open the ReportDialog
askSpeechInput
Open the system speech recognition
startCamer
Take the callback from ReportDialog and open the camera
onSubmit and uploadImage
Take the callback and data from ReportDialog and uploadEvent
interface DialogCallBack
MainFragment’s callback listener from ReportDialog
3.3. ReportDialog
ReportDialog is dialog opened from MainFragment and used to display the event spec and report page.
Users could switch between two page to choose the event type and data they are going to report
Part
Files Related
Description
ReportDialog
res/layout/dialog.xml
The top level of the reportdialog’s UI
res/values/styles.xml
It defines the style of the dialog
res/layout/report_event_type.xml
The first page of upload event, set event type
res/layout/report_event_spec.xml
The second page of upload event, set event details
ReportRecyclerViewAdapter.java
Recycler view adapter for setting up event type
res/layout/recyclerview_item.xml
Recycler view child view that is going to adapt to recycler view
3.4. MainFragment (Bottom Sheet)
Display Event details in BottomSheet (Click any event on screen)
Part
Files Related
Description
MainFragment (Bottom Sheet)
MainFragment.java
Main Fragment contains Upload Bottom Sheet
res/layout/fragment_main.xml
Nested layout (Id: nestedScrollView), this is the bottom Sheet layout container
4. Helper Classes
Part
Files Related
Description
Helper
Item.java
Holds all item attributes, this is used to show ReportRecyclerViewAdapter
TrafficEvent.java
Holds all traffic event attributes
User.java
Holds all user attributes
LocationTracker.java
Get longitude and latitude of current location
Config.java
Temperary Configurations
Utils.java
Store util functions
5. Firebase Notifications
These files are used related to firebase cloud messaging, firebase cloud function and firebase database.
Part
Files Related
Description
Firebase Cloud Messaging
MyFirebaseMessagingService.java
Main Receiver of Firebase Cloud Messaging
MatrixApplication.java
Help to register Firebase Cloud Messaging token when application boots