Skip to content

Latest commit

 

History

History
94 lines (70 loc) · 4.05 KB

Controller.md

File metadata and controls

94 lines (70 loc) · 4.05 KB

Controlllers

DataController.kt

This class has a set of methods for storing and processing data collected from the Google fit API. The class and its methods can be modified to collect the desired data from the Google Fit API.

Attributes

  • TAG:String
  • NUM_ATTRS: Int
  • height: Double
  • weight: Double
  • lightSleep: Double
  • deepSleep: Double
  • remSleep: Double
  • awakeSleep: Double
  • steps: Int
  • caloriesSpent: Double
  • incomingCalls: Double
  • outgoingCalls: Double
  • blockedCalls: Double
  • missedCalls: Double
  • rejectedCalls: Double
  • incomingCallsAverageDuration: Double
  • outgoingCallsAverageDuration: Double
  • diffWifi: Int
  • whatsAppReport: String
  • heartRate: MutableList
  • attrsFilled: Int
  • onAttrsFilled: ((Int) -> Unit)?

Methods that can be changed

  • setData(dataType: DataType, dataset: DataSet) - Set Google Fit data to corresponding attributes in the class using a DataSet object
  • setData(dataType: DataType, datasets: List) - Set Google Fit data to corresponding attributes in the class using a list of DataSet objects
  • get(): - Get methods for attributes
  • set(): - Set methods for attributes
  • getActivityDescription(value: Int): String - Returns the activity type according to the coded activity code in GoogleFit
  • fullLog() - Saves the Log with all collected data

LoginController.kt

This class presents a set of methods for login control using the Google API, so that it is possible for the user to login using the google account.

Attributes

  • activity: BaseActivity
  • googleApiClient: GoogleApiUtil

Methods that can be changed

  • signIn() - Requests Google API Login. The API calls the login method implemented in the GoogleApiUtil class
  • activityResult(requestCode: Int, data: Intent?) - When returning from the Login request, it returns to the activity or informs that the login failed
  • isLogged():Boolean - Returns true if Login has already been performed

ProfileController.kt

This class presents methods for collecting profile data from the user logged into the Google account.

Attributes

  • activity: BaseActivity
  • googleApiClient: GoogleApiUtil

Methods that can be changed

  • start() - Request Login in Google account
  • callLogin() - Call Login Sreen (LoginACtivity)
  • setName(textView: TextView) - set attribute name with the value of a TextView
  • getName():String - Using the GoogleApiUtil class, it collects the user name in the google account profile, if the user is not logged in, it calls the login screen
  • getEmail():String - Using the GoogleApiUtil class, it collects the user's email in the google account profile, if the user is not logged in, it calls the login screen
  • setEmail(textView: TextView) - set email attribute with the value of a TextView
  • isLogged():Boolean - Returns true if Login has already been performed

[path UpdateControllersSamples]

- AppsExternalParametersController.kt

Attributes

  • activity: BaseActivity
  • tag: String
  • params = hashMapOf<String, String>

Class containing methods to help release and download new releases of the application

Methods that can be changed

  • adjustApp() - Adjust parameters (Constant values) of the application, in case there is a change in the release

  • processExternalParams() - Checks that parameters (example, update date) are in accordance with the latest release

  • downloadAndInstall(version: String) - Download and install new version of the app

  • convertVersion(version: String): Int - Update app version

    Note: All values to be edited to use these methods for your app are in the Constants.kt object in model/utils/Constants.kt

New Controllers

Controllers are classes that can be used for small handling and to connect activities or fragments with some model class, controlled and handling data that is fetched from components on the screen or sending data that should be displayed in components on the screen. We recommend creating new controls to handle data from all screens generated by the developer.