GSoC2020 Project: Improvement of the Car Selection Process in the enviroCar Android App


Currently, enviroCar android app Car selection process give much flexibility to user for simply type in attributes values or select from the data feched from REST API. This selection process is prone to error as user can set undefined or non-existing values of car attributes and create artifical type of car which later lead to collection and processing of invalid data. Also, track based database is based on SqliBrite which has been depriciated by the Square, there will be no further support. For new user it is difficult what/where OBD is and how to pair with the app, how to use app(?), What is the function of different controls(?), no help regarding this is provided. Considering all the issue and lack of features my goals are:-

1. Improving car selection process with previously defined datasets of vehicles which is app side implementation using Room database and designing UI for new car selection.

2. Re-implementing track-based database based on SqlBrite to new database based on Sqlite database with Room ORM to ensure support and to be flexible for modern components.

3. Adding a contextual help finding and pairing OBD with car and Walkthrough screen to highlight different controls.

Details about Goals can be find here in Introductory blog post


Weekly Status Reports

Week 1

  • Deciding Workflow to create database containing vehicle information (Pre-populate database)

    • Workflow 1 (Github Branch Link)

      • PSQL queries run and import .csv files.

      • Dump the data only as plain text.

      • Convert PSQL queries to SQLite.

      • Create SQLite database, run the dump query to insert table in SQLite database.

    • Workflow 2
      • Create database schema using Room.
      • Read .csv file from assets
      • Insert the data fetch from .csv file to table

(Workflow 2 is according to software design principle)

  • Pre-populating database with vehicle information according to workflow 2

    • Added room and RxJava room support.

    • Added Manufactures,Vehicles, PowerSource entity.

    • Added DAO for Manufacturers,Vehicles,PowerSource extends BaseDAO.

    • Added .csv files in assets.

    • Added Room Database.

    • Added Room Database provides method in DatabaseModule for Dependency Injection.

    • Added DataCollector util to read the .csv file.

    • Added Database CallBack

Github Branch Link

Problems Faced:-

  • Pre-populating database using workflow 1. Adjusting the query to run in SQLite. Later followed workflow 2.

  • Dependency Injection issue while inject Room database in Database CallBack class.

Next Steps:-

  • Integrate coded Room database with old car selection.

  • Add unit tests to test database entries.

Week 2

  • Fixed enviroCar database object null error.
  • Fixed tokenizer error on importing .csv files.
  • Added query for manufacturer table insert based on JOIN between vehicles table and virtual table created from vehicles table.
  • Remove undefined manufacturer insert from the query created from insert operation.
  • Fetch manufacturers table data and added to autocomplete text view.
  • Integrated database with car selection UI.
    • Fetch vehicles table data
    • Create Car type with Vehicles data
    • add Car to autocompleteListView based on pair of different type.
  • Added unit test for Vehicles Database
    • Created room database in memory.
    • insert vehicle data check for successful insert.
    • Fetch vehicle data check for successful fetch.
    • check primary keys not null.
    • check for database entries.

Problems faced:-
  • Inject envirocarVehicleDB object null error having circular dependency with room database callback.
  • Importing .csv file , Using stringtokenizer seprated by ',' in case some fields are blank in particular row it is not consider as token and insert operation failed as evry row will have different number of tokens.
Next Steps:-
  • Improve @Provide method for Room database object.
  • Categorization on the basis of Fuel Type.
  • Desgin new UI for CarSelection process.

Week 3

  • Added circular dependency which earlier throws null pointer Exception and improve @Provide for room database object.
  • Fixed delay in prepopulating the room database before using object in CarSelectionAddCarFragment.
  • Added fuel type attributes based on the car.
  • Re-implemented DataCollectort class (.csv file reader) and used OpenCSV to read .csv file which earlier is based on tokenizer causing insertion of garabage values in some fields because of not considering blank in some field, mainly the issue was with power_source_id.
  • Fix UI related bug in car selection fragment and created and push the issue and PR.
  • Fix UI freezes for fraction of time in CarSelectionAddCar fragment.
  • Added restriction to users to select or type in attributes values which is fetched from database otherwise set error in the autoCompleteTextView.
  • Added more parameters in function FuelType resolveFuelType(Sting fuel) and fix error related to fuel type.
  • Complete Module-1 Integration of vehicles database (Room database with old UI) and updated and push the branch and updated the checklist in the PR (

*Started working on module 2 (Designing new UI for car selection interacting with the database created)* Problems faced:-
  • Inject room database object in SplashScreenActivity, later fixed by class extends BaseInjectorActivity and added injection method.
  • Reading .csv file and insertion of garbage value in the database.
  • Converting FuelType to string and vice-versa.
Next Steps:-
  • Design the card view showing car details.
  • Design UI for selection of car from the list of cars after searching based on some of the car attributes.
  • Adding functions in CarSelectionAddCar fragment,CarSelectionTsnHsn fragment,CarSelectionAttributes fragments for registering car at server if not registered and adding the created car to list etc.(I will analyze the requirements and add more functions accordingly).
Daily Log:-
  • Please visit my daily log to track the development on daily basis , i also included new UI for car selection created in daily log Link- GoogleDocDailyLog.

Week 4

  • Added query to fetch car based on HSN and TSN values and fixed bug on fethcin based on HSN/TSN.
  • Designed UI for car detials list for the selection on the basis of car attributes (Manufacturer,model,year).
  • Created adapter for car detail list and added interaction callback interface to used with adapter.
Function declaration in interaction callback interface
  • Car createCar(Vehicles vehilce) - to convert Vehicles entity to Car entity.
  • String resolveFuelType(String power_source_id) - to get fuel type pn the basis of power_source_id of vehicles.
  • void addAndRegisterCar(Car car) - register car on server and add to list of car from the car instance return from createCar(Vehicles vehilce) .
  • Understand the concept about function descriptors <T,R> and created interface to be implemented in CarSelectionActivity so that itis accesible to both HSN/TSN and attributes fragments.
Function declaration in CarSelection interface and implemets in CarSelectionActivity
  • <T> Function<T,R> createCar(Vehicles vehicle);
  • FuelType getFuel(String power_sourfce_id);
  • void registerCar(Vehicles vehicle).
  • Added quick fix to register car at server in gsoc/car_selection branch (previously the car is not registering as we are comparing car already exist with database entires and it always set to true).
  • Added functionality to register car at server in gsoc/new_UI_car_selection branch.
  • Read about material textField componenet and change the textField UI according to material design.
  • Learn about modal Bottom sheet and implements the Fragment for modal bottom sheet and design UI for car overview to be used in modal Bottom sheet.
  • On succesful fetch vehicles from database based on HSN/TSN values display the overview in modal bottom sheet.
  • Cast the Vehciles entity to Car entity and registering and adding car to listy by using the function imlemented in CarSelectionActivity calling in fragment.
  • Improved interaction with modal bottom sheet fragment i.e on click on mark close all the fragment and openthe CarSelection activity to display the car added to the list.
  • Fetch all vehicles and add manufacturer_id and id in HSN TSN AutoCompleteTextView on success using RxJava DisposableSingleObserver.(Previously only search based on input is working no suggestion shown).
  • Added composite disposable and check for textChanges to make reactive field , so that only the values in the list are allowed for selection.
  • Check before searching the car if the hsn/tsn field is empty or error has been set because of values not contained in the list set during textChanges reactive field.
  • Fix fetch first row from database containing headings and added ime options and ButterKnife @OnEditiorAction for implicit submit.
  • Added next field focus onItemClickListener and set next adapter in TSN AutoCompleteTextView based on hsn or manufacturer_id.
  • Fix app crash on getAdapter in hsn AutoCompleteTextView.
  • Set HSN field to accept numbr only and reset error on TSN on changing first HSN value.
  • Completed UI design and functionality to create and register car in HsnTsnFragment.
Problems faced:-
  • Registering car at server if the car is already exist in the server or check before registering car already exist but that is time consuming as we have to fetch all the car and compare with the server data.(Analysed that the registering same car should return same location header ).
Next Steps:-
  • Add functionality to register car in CarAtrributes fragment and set car list based on selection.
  • Working in idea 2- Reimplementing exisiting track database based on Sqlbrite.
Daily Log:-
  • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.

Week 5

  • Fetch vehicle database for car selection based on attributes and update the AutoCompleteTextView based on database entries.
  • Added ButterKnife @OnTextChanged callback after text change to reset next edit text fields based on the change in previous edit text field.
  • Check for focus in different edit text and update the data in AutoComplete text view according to the selection and focus change.
  • Reactive edit text field to force user to select from list only otherwise set error in the field with error message "not in the list".
  • On search car check if the edit text error is set and field is null otherwise proceed searching.
  • Created Modal Bottom Sheet to show the list of car after searching using attributes manufacturer,model,year.
  • In database construction date is of the form , but we are creating the car on the base of year only (yyyy) so to search the car we have to find the substring of type yyyy in allotment date column, so the final query for that is @Query("SELECT * FROM vehicles where manufacturer=:manuName AND commerical_name =:model AND allotment_date LIKE '%' || :year || '%'") where year string is of the form yyyy.
  • It is seen that the same model is having different manufacture name so model to year pair not work as all year of particular model fetch without consideration of manufacture and searching fails for some cases , so i added map of pair<manufacture,model> to year.
  • Added recyler view adapter and interaction callback function defination to register car and resolve fuel type.
  • Remove the query fetch for vehicles database multiple time and added query fetch for vehicle database in parent fragment activity and pass the values in child fragment.
  • Added the name of manufactre with HSN in HsnTsn fragment and remove menu from CarSelectionAddCar fragment and added call dispose for compostie disposable onDestroy() previously added for reactive text field.
  • Finalizing the car selection on the basis of car attributes - remove unused codes and added string resources value.
  • Improved the final overview Modal Bottom sheet fragment containg list of car.
    • Added card view for list of car.
    • Option to expand and collapse card to show car details overview.
    • On card collapse Manufacture,model,year shown.
    • On card expand HSN/TSN, fuelType,Engine displacement,Power.
  • Completed mid term Blog post and submitted for review and finalzie the work for first evalutaion.
  • Branch link:-
Problems faced:-
  • NA
Next Steps:-
  • Working on idea 2- Reimplementing exisiting track database based on Sqlbrite.
Daily Log:-
  • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.

Week 6

  • Understand the current working of track based database.

  • Created branch gsoc/track_database_room_implmentation.

  • Added room and roomRxJava support.

  • Plan the workflow to re-implement the track database

    • As room RxJava do not support Observable so need to work with flowable only.

    • Convert the EnviroCarDBImpl functions according to room database and change the associated call because it is of type observable.

    • Add the room database instance in database module and using dagger 2 provide the instance to EnviroCarDBImpl.

    • Add query only in room database DAO

This is the initial workflow I decided, rest I will see for any requirement while coding.

  • Added room database class and dao interface (query need to be added).

  • Added room database and provide instance using dagger 2.

  • Added room dao query.

  • Added TrackTable entity.

  • Added ManufacturerTable entity.

  • Link branch GitHub

Problems faced:-
  • NA
Next Steps:-
  • Define and re-implement functions in EnviroCarDBImpl and change the Observable to Flowable.

  • Add the mapping function to map Track to TrackTable and Measurement to MeasurementTable and vice versa.

  • Add unit tests for Room DAO classes.

Daily Log:-
  • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.

Week 7

  • Created mapper function for track table to track entity.

  • Added function to convert track to track table.

  • Created mapper function for measurement table to measurement entity.

  • Added function to convert measurement to measurement table.

  • Updated the android Room rxjava dependencies and checked for the Observable return type in Room DAO query.

  • Added Observable transformer function.

  • Inject the TrackRoomDatabase instance as a parameter in EnviroCarDBImpl.

  • Added function to convert measurement table list to measurement list,

  • Fix insert error in Track Table and Number format exception in measurement table to measurement convert function.

  • Insert and fetch operation for track and measurement successful.

  • Added measurement delete function and check for successful delete.

  • Added update remote id function.

  • Added track metadata update function.

  • Added track id to list mapper and delete all remote track function.

  • Added automatic delete measurement function.

  • Added fetch start time function.

  • Added fetch measurement function.

  • Fix insert track while recording new track.

  • Fix app crash.(due to some queries on main thread).

  • Remove unused code.

  • Completed Room implementation of local track database.

  • Created issue and PR in GitHub.

Github Link:- issue PR link


  • No major blockers as such.

Next Task
  • Add unit tests for Room DAO classes.

To track the development on a daily basis please find the link to daily log.

Week 8

  • Started working on Unit Test track room DAO classes.
  • Added Room database in memory instance (For performing database CRUD operation in memory only and clear database afterwards).
  • Get data from and created function for returning data to set in track attributes.
    • Created Car function - consisting of car attributes.
    • Created initial Measurement function - consisting of measurement properties with intial coordinates.
    • Created first Measurement function - consisting of measurement properties with first coordinates.
  • @Test createCar() - inserting intial track in database with length 0.0 and no initial measurement.
  • @Test trackTest()
    • Add intial measurement in database and update the track in database with intial measurement.
    • Add measurement at some coordinates and update the active track.
    • Check for active track reference (compare track id of database track with the track id of track in consideration).
    • Check for valid track length after first measurement insert.
    • Compare the measurement property of track in database with the intial and first measurement property.
    • Finish current track and check for finish status.
    • Update car id of track and fetch track according to car id and check for validity.
    • Delete track and check for track count before and after track delete.
    • Check Measurement table with given track id reference also deleted on track delete.
    • Insert track and update remote id and check for remote track fetch.
    • Finish Unit testing and updated PR in Github.
Problems faced:-
  • NA
Next Steps:-
  • Working on idea 3 - Add a help option and walkthrough screen for activities so user know about all controls.
Daily Log:-
  • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.

Week 9

  • Started working on Idea 3 - Add a help option and walkthrough screen for activities so user know about all controls.
  • OBD Help dialog
    • Added help option in dashboard.
    • Created OBD help layout and added viewpager.
    • Added 3 layouts for different contents in OBD dialog.
    • Added OBD help dialog fragment.
    • Added fragments for contents and inflate the 3 layouts added respectively.
    • Created viewpager adapter which extends FragmentStatePagerAdapter to allow swipe between different contents.
    • Desgined OBD find, OBD plug and connect with app images.
    • Desgin new Mockup for OBD help dialog.
    • Re-desgined OBD help layout and added circular indicator.
    • Added Prev, Next and Finish button on dialog according to contents swipe.
    • Desgined single layout for contents.
    • Inflate contents layout and added images and text description accordingly.
    • Display the OBD help dialog in full screen size when help icon click (@onClick).
  • Walkthrought screen to give information about the higlighted controls for first time users
    • Added open source ShowCaseView dependency.
    • Added ShowCaseView in Dashboard Fragment and added description about higlighted controls and views.
    • Added ShowCaseView in RecordingScreen Activity and added description about higlighted controls and views.
    • Created and check for SharedPreference if Walkthrough is already shown.(Show scrren tutorila only one for first time users).
    • Higlight the whole layout of particular view in dashboard Walkthrough.
    • Added description string values in String resource for Dashboard Fragment and RecordingScreen Activity higlighted controls and views.
    • Added German translation for String resources added previously for Dashboard and RecordingScreen.
  • Finish Idea-3 implementation and created issue and PR in GitHub - GitHub PR Link Idea 3 implementation.
Problems faced:-
  • No major blocker as suck, but designing a Images for OBD Help content is a task.
Daily Log:-
  • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.

Week 10

  • Shimmer effect in track list loading
    • Added facebook shimmer dependency.
    • Added shimmer layout for remote track.
    • Added shimmer layout for local track.
    • Modified track list remote and local fragment based on shimmer layout.
    • Created PR in GitHub - PR Link.
  • Added mirror view of recording Screen layout.
    • Added icon in RecordingScreen layout to switch to mirror view of layout.
    • Check mirror View of recording screen
      • Scaling each element in canvas in Tempomat class.
      • Scale the x axis on the factor of -1.
    • Scale the whole recording screen layout on the factor of -1 wrt x axis.
      • This is compatible with layout changes as we do not have to do any changes in canvas related to scaling and only need to scale the parent layout.
    • Added on click to toggle mirror view in Recording screen.
    • Created issue and PR in github- PR link.
  • Improve the no. of fetch operation and fix delay to load data from database in autoCompleteTextView in branch gsoc/new_UI_car_selection
    • Modified query return type and added query to fetch based on manufacture id and name.
    • Modified query in local manufacturer dao.
    • Fix the time to fetch the data from database by fetch manufacture table instead of vehicle table to reduce no. of fetch operations.
    • Fix number format exception if car is electric.
    • Modified fetch based on query return type.
    • Hide the engine layout in the bottom sheet in case of an electric car.
    • PR link.
  • Added OnBoarding Screen for first time users.
    • Added airbnb lottie dependency and circleIndicator dependency.
    • Added onBoarding activity and created layout.
    • Added lottie animation json file in res raw.
    • Created onBoarding fragment layout.
    • Added three onboarding fragment for viewpager.
    • Start onboarding on the basis of sharedPreferences value hasSeen or not (boolean).
    • Added license and attribution section in others layout.
    • Added license layout.
    • Created license dialog fragment.
    • Change onBoarding navigate Button.
    • added CC license attribution 4.0 for lottie files author attribute.
    • Created issue and PR in GitHub - PR Link.
Problems faced:-
  • Scaling each view drawn using canvas for Recording Screen, later scale the parent layout instead of canvas each view.
Daily Log:-
    • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.

Week 11

  • Read docs about in app review.
  • Read docs about in app update.
  • Added in app update to notify users about the new update availability in app only otherwise users have to explicitly check for update from play store.
  • Revert already exisiting test in gsoc/track_database_room_implmentation branch.
  • Merge branch gsoc/new_UI_car_selection into gsoc/track_database_room_implmentation branch and resolve merge conflicts.
  • Fix same function name in Database module after merge.
  • Fix car database test and old tests after merge.
  • Design variuos mockup for new Car selection.(Please visit daily log for design mockups).
  • Re-design Car selection UI
    • Design custom shape for top view in car selection.
    • Re-design car selection fragment according to finalized mockup.
    • Modified viewpager fragments (HSN/TSN and attributes fragment) for new layout.
    • Create PR in GitHub - PR Link.
Problems faced:-
  • NA
Daily Log:-
  • Please visit my daily log to track the development on daily basis. Link- GoogleDocDailyLog.
Topic revision: r15 - 16 Aug 2020, arvindnegi
Legal Notice | Privacy Statement

This site is powered by FoswikiCopyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding Wiki? Send feedback