ShowUser - ShutUpPaulo/TecProg_2016-01 GitHub Wiki
Class ShowUser
1. Class Attributes
Name | Type | Description | Default Value |
---|---|---|---|
INVALID_IDENTIFIER | final int | Stores a invalid identifier to initialize identifier variables | -2 |
userEvaluatedId | String | Stores the identifier of the user who has your information shown and can be evaluated | INVALID_IDENTIFIER |
currentUserId | int | Stores the identifier of the user logged in | INVALID_IDENTIFIER |
2. Methods
2.1. ShowUser
2.1.1. Description:
- Constructor to instantiate a ShowUser object
2.1.2. Arguments:
- No arguments
2.1.3. Return:
- Type: Constructor
2.2. onCreateView
2.2.1. Description:
- Overridden method that creates and returns the view hierarchy associated with the fragment
2.2.2. Arguments:
- LayoutInflater inflater: Object used to inflate any views in the fragment
- ViewGroup container: If non-null, is the parent view that the fragment should be attached to
- Bundle savedInstanceState: If non-null, this fragment is being re-constructed from a previous saved state as given here
2.2.3. Return:
- Type: View
- Description: View of the Register fragment
2.2.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
showUserView | View | Stores the view of the fragment obtained through the layout XML | * * * |
isUserLoggedIn | boolean | Stores the user login status, must be true if the user is logged in and false if the user is logged out | * * * |
loginUtility | LoginUtility | Object that allows the access of the login utility methods | * * * |
2.3. onRatingChanged
2.3.1. Description:
- Triggers actions that must be done when the rating changes
2.3.2. Arguments:
- RatingBar ratingBar: The RatingBar whose rating has changed
- float rating: The current rating (Must be >=0 and <=5)
- boolean fromUser: True if the rating change was initiated by a user's touch gesture or arrow key/horizontal trackbell movement
2.3.3. Return:
- Type: void
2.3.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
userEvaluation | UserEvaluation | Object to instantiate an user evaluation when the evaluator user set the rating at the ratingBar | null |
userEvaluationDAOn | UserEvaluationDAO | Object to access DAO method that allows to save the user evaluation at database | * * * |
2.4. setUserEvaluation
2.4.1. Description:
- Instantiates an UserEvaluation object
2.4.2. Arguments:
- Float rating: Evaluation given to the user (Must be >=0 and <=5)
- Integer userId: Identifier of the evaluator user
- Integer userEvaluatedId: Identifier of the user evaluated
2.4.3. Return:
- Type: void
2.4.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
SUCCESSFUL_EVALUATION_MESSAGE | String | Message for inform that the evaluation was registered with success | "Avaliação cadastrada com sucesso" |
2.5 getUserInfoFromDataBase
2.5.1. Description:
- Get the user name, birth date and mail from database
2.5.2. Arguments:
- String userName: String to stores the name of the user
- String userBirthDate: String to stores the birth date of the user
- String userMail: String to stores the mail of the user
2.5.3. Return:
- Type: void
2.5.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
userDAO | UserDAO | Object that allows access the DAO method to search user information at database | * * * |
userData | JSONObject | Stores the result of the search that contains the user information | * * * |
2.6. setEvaluationAtRatingBar
2.6.1. Description:
- If the user already has an evaluation, this method sets it at ratingBar
2.6.2. Arguments:
- RatingBar ratingBar: RatingBar to sets the evaluation
2.6.3. Return:
- Type: void
2.6.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
userEvaluationDAO | UserEvaluationDAO | Object that allows access the DAO method to search an user evaluation at database | * * * |
userEvaluationAtDataBase | JSONObject | Stores the result of the search that contains the data of the user evaluation if the user already has, or null if he has not | * * * |
currentEvaluation | Float | Stores the user evaluation as float obtained through the data stored in the JSONObject userEvaluationAtDataBase | * * * |
2.7. showUserInformationOnTextView
2.7.1. Description:
- Sets the TextViews to show the user information
2.7.2. Arguments:
- View showUserView: View that contains the TextViews
- String userName: Name to be set at the text view that shows the user name
- String userBirthDate: Date to be set at the text view that shows the user birth date
- String userMail: Mail to be set at the text view that shows the user mail
2.7.3. Return:
- Type: void
2.7.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
userNameTextView | TextView | TextView that shows the name of the user | * * * |
userDateTextView | TextView | TextView that shows the birth date of the user | * * * |
userMailTextView | TextView | TextView that shows the mail of the user | * * * |
2.8. getUserLoginStatus
2.8.1. Description:
- Verify if the user is logged in or logged out
2.8.2. Arguments:
- No arguments
2.8.3. Return:
- Type: boolean
- Description: True if the user is logged in and false if the user is logged out
2.8.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
isUserLoggedIn | boolean | True if the user is logged in and false if the user is logged out | false |
loginUtility | LoginUtility | Object that allows access the LoginUtility method to check if the user is logged | * * * |
2.9. setRatingMessage
2.9.1. Description:
- Sets the message of the ratingBar label based on user login status
2.9.2. Arguments:
- View showUserView: View that contains the ratingBar label
- String message: Message to be displayed at the label
2.9.3. Return:
- Type: void
2.9.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
ratingMessageTextView | TextView | TextView that shows the message of the ratingBar label | * * * |
2.10. setUpRatingBar
2.10.1. Description:
- Sets the necessary configurations of the ratingBar based on user login status
2.10.2. Arguments:
- boolean isUserLoggedIn: User login status
- View showUserView: View that contains the ratingBarlabel
2.10.3. Return:
- Type: void
2.10.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
LOGGED_IN_MESSAGE | final String | Message to be displayed at the rating bar label for the users logged in | "Sua avaliação:" |
LOGGED_OUT_MESSAGE | final String | Message to be displayed at the rating bar label for the users logged out | "Faça login para avaliar este usuário!" |
ratingBar | RatingBar | Rating bar to be configured | * * * |
2.11. setRatingBarStyle
2.11.1. Description:
- Sets the style of the ratingBar
2.11.2. Arguments:
- RatingBar ratingBar: RatingBar to have its style set
2.11.3. Return:
- Type: void
2.11.4. Variables:
Name | Type | Description | Default Value |
---|---|---|---|
stars | LayerDrawable | Stars of the rating bar to have their color set | * * * |