diff --git a/app/src/main/java/com/courseproject/tindar/ui/home/HomeFragment.java b/app/src/main/java/com/courseproject/tindar/ui/home/HomeFragment.java index 8bfcd1ea..339eaf90 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/home/HomeFragment.java +++ b/app/src/main/java/com/courseproject/tindar/ui/home/HomeFragment.java @@ -14,9 +14,11 @@ import com.courseproject.tindar.R; import com.courseproject.tindar.databinding.FragmentHomeBinding; - +/** This class implements the home screen fragment of the app */ public class HomeFragment extends Fragment { + /** FragmentHomeBinding instance to help display home page */ private FragmentHomeBinding binding; + /** ImageView of home screen */ ImageView home; /** diff --git a/app/src/main/java/com/courseproject/tindar/ui/home/SecondViewProfileFragment.java b/app/src/main/java/com/courseproject/tindar/ui/home/SecondViewProfileFragment.java index 9833d0f9..a3569976 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/home/SecondViewProfileFragment.java +++ b/app/src/main/java/com/courseproject/tindar/ui/home/SecondViewProfileFragment.java @@ -39,28 +39,43 @@ import java.util.Locale; import java.util.concurrent.TimeUnit; +/** This class implements a second home view fragment in order to switch between profiles + * to like/unlike. + */ public class SecondViewProfileFragment extends Fragment { + /** boolean to see if a user does like the other */ boolean doesLike; + /** current user id index */ private int currentViewProfileUserIdIndex; + /** the other users userId*/ private String otherUserId; - + /** the current users userId */ private String userId; + /** a list containing all userIds */ private ArrayList allUserIds; - + /** FragmentHomeBinding instance to help display second view profile screen */ private FragmentSecondViewProfileBinding binding; + /** BlankViewModel instance for a blank view */ private BlankNavViewModel blankNavViewModel; - + /** image of like button */ ImageButton likeButton; + /** text veiw of display name */ TextView displayNameView; + /** text view of preferred gender */ TextView genderView; + /** text view of birthdate */ TextView birthdateView; + /** text view of location */ TextView locationView; + /** text view of about me information*/ TextView aboutMeView; + /** profile photo image */ ImageView profilePic; + /** string link to profile */ String profileLink; - + /** ViewProfilesController instance for methods*/ ViewProfilesController viewProfilesController; - + /** instantiate a DateFormat to have a consistent date format */ private final DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy", Locale.CANADA ); /** diff --git a/app/src/main/java/com/courseproject/tindar/ui/home/ViewProfileFragment.java b/app/src/main/java/com/courseproject/tindar/ui/home/ViewProfileFragment.java index 04fddc4e..5ee0c9bc 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/home/ViewProfileFragment.java +++ b/app/src/main/java/com/courseproject/tindar/ui/home/ViewProfileFragment.java @@ -38,29 +38,43 @@ import java.util.ArrayList; import java.util.Locale; import java.util.concurrent.TimeUnit; - +/** This class implements a home view fragment in order to switch between profiles + * to like/unlike. + */ public class ViewProfileFragment extends Fragment { + /** boolean to see if a user does like the other */ boolean doesLike; + /** current user id index */ private int currentViewProfileUserIdIndex; + /** the other users userId*/ private String otherUserId; - + /** the current users userId */ private String userId; + /** a list containing all userIds */ private ArrayList allUserIds; - + /** FragmentHomeBinding instance to help display second view profile screen */ private FragmentViewProfileBinding binding; + /** BlankViewModel instance for a blank view */ private BlankNavViewModel blankNavViewModel; - + /** image of like button */ ImageButton likeButton; + /** text veiw of display name */ TextView displayNameView; + /** text view of preferred gender */ TextView genderView; + /** text view of birthdate */ TextView birthdateView; + /** text view of location */ TextView locationView; + /** text view of about me information*/ TextView aboutMeView; + /** profile photo image */ ImageView profilePic; + /** string link to profile */ String profileLink; - + /** ViewProfilesController instance for methods*/ ViewProfilesController viewProfilesController; - + /** instantiate a DateFormat to have a consistent date format */ private final DateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy", Locale.CANADA ); /** diff --git a/app/src/main/java/com/courseproject/tindar/ui/login/LoginActivity.java b/app/src/main/java/com/courseproject/tindar/ui/login/LoginActivity.java index 1871c339..ae34903d 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/login/LoginActivity.java +++ b/app/src/main/java/com/courseproject/tindar/ui/login/LoginActivity.java @@ -19,12 +19,16 @@ import com.courseproject.tindar.usecases.login.LoginDsGateway; import com.courseproject.tindar.usecases.login.LoginInteractor; +/** This class implements the Login Activity for the front end. Allows the user to see and manipulate + * the log-in actions */ public class LoginActivity extends AppCompatActivity { - + /** edit email text box */ private EditText emailText; + /** edit password text box */ private EditText passwordText; - + /** string containing the users email */ private String email; + /** string containing the users password */ private String password; /** diff --git a/app/src/main/java/com/courseproject/tindar/ui/settings/ChangeEmailActivity.java b/app/src/main/java/com/courseproject/tindar/ui/settings/ChangeEmailActivity.java index e61df272..6033126f 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/settings/ChangeEmailActivity.java +++ b/app/src/main/java/com/courseproject/tindar/ui/settings/ChangeEmailActivity.java @@ -14,23 +14,25 @@ import com.courseproject.tindar.usecases.editaccount.EditAccountDsGateway; import com.courseproject.tindar.usecases.editaccount.EditAccountInteractor; +/** This class implements the ability to change the users long-in email after creating an account + */ public class ChangeEmailActivity extends AppCompatActivity { - // Button that sends user back to the settings screen. + /** Button that sends user back to the settings screen. */ ImageButton changeEmailBackButton; - // Button that submits changes to the email. + /** Button that submits changes to the email.*/ Button submitEmailChangeButton; - // Text box to put in new email. + /** Text box to put in new email.*/ EditText changeEmailText; - // Text box to put in new email again. + /** Text box to put in new email again.*/ EditText changeEmailRetype; - // Text box to put in the current password for validation. + /** Text box to put in the current password for validation.*/ EditText changeEmailPasswordValidation; - // userId of the account. + /*8 userId of the account.*/ String userId; /** * Creates the email change screen for the user to view. - * + * @param savedInstanceState the saved instance state */ @Override protected void onCreate(Bundle savedInstanceState) { diff --git a/app/src/main/java/com/courseproject/tindar/ui/settings/ChangePasswordActivity.java b/app/src/main/java/com/courseproject/tindar/ui/settings/ChangePasswordActivity.java index f13a4fda..bca8a669 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/settings/ChangePasswordActivity.java +++ b/app/src/main/java/com/courseproject/tindar/ui/settings/ChangePasswordActivity.java @@ -13,19 +13,20 @@ import com.courseproject.tindar.ds.DatabaseHelper; import com.courseproject.tindar.usecases.editaccount.EditAccountDsGateway; import com.courseproject.tindar.usecases.editaccount.EditAccountInteractor; - +/** This class implements the ability to change the users password after creating an account + */ public class ChangePasswordActivity extends AppCompatActivity { - // Button that sends the user back to the settings screen. + /** Button that sends the user back to the settings screen.*/ ImageButton changePasswordBackButton; - // Button that submits the changes to the password. + /** Button that submits the changes to the password.*/ Button submitPasswordChangeButton; - // Text box that contains the new password. + /** Text box that contains the new password.*/ EditText changePasswordText; - // Text box to type the new password a second time. + /** Text box to type the new password a second time.*/ EditText changePasswordRetype; - // Text box to type the current password for validation. + /** Text box to type the current password for validation.*/ EditText changePasswordValidation; - // The user id of the account. + /** The user id of the account.*/ String userId; /** diff --git a/app/src/main/java/com/courseproject/tindar/ui/settings/SettingsActivity.java b/app/src/main/java/com/courseproject/tindar/ui/settings/SettingsActivity.java index 25f08c3b..c3915a11 100644 --- a/app/src/main/java/com/courseproject/tindar/ui/settings/SettingsActivity.java +++ b/app/src/main/java/com/courseproject/tindar/ui/settings/SettingsActivity.java @@ -7,15 +7,17 @@ import android.os.Bundle; import com.courseproject.tindar.BlankNavActivity; import com.courseproject.tindar.R; - +/** This class implements settings activity that allows the user to change account information + * like email or password. + */ public class SettingsActivity extends AppCompatActivity { - // Button that sends user to change email screen. + /** Button that sends user to change email screen.*/ Button changeEmailButton; - // Button that sends user to change password screen. + /** Button that sends user to change password screen.*/ Button changePasswordButton; - // Button that sends user back to the home screen. + /** Button that sends user back to the home screen.*/ ImageButton settingsBackButton; - // userId of the account. + /** userId of the account.*/ String userId; /** diff --git a/app/src/main/java/com/courseproject/tindar/usecases/login/LoginDsGateway.java b/app/src/main/java/com/courseproject/tindar/usecases/login/LoginDsGateway.java index a23fa403..a82f03cd 100644 --- a/app/src/main/java/com/courseproject/tindar/usecases/login/LoginDsGateway.java +++ b/app/src/main/java/com/courseproject/tindar/usecases/login/LoginDsGateway.java @@ -1,5 +1,18 @@ package com.courseproject.tindar.usecases.login; +/** + * This interface defines the gateway for accessing the data source related to user login + * information. + * It provides methods to read user IDs based on their email and password. + */ public interface LoginDsGateway { + + /** + * Retrieves the user ID associated with the given email and password. + * + * @param email The email address of the user. + * @param password The password of the user. + * @return The user ID if the email and password match; otherwise, null. + */ String readUserId(String email, String password); } diff --git a/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInputBoundary.java b/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInputBoundary.java index 5b47c0a9..de6f78f1 100644 --- a/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInputBoundary.java +++ b/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInputBoundary.java @@ -1,6 +1,27 @@ package com.courseproject.tindar.usecases.login; +/** + * This interface defines the input boundary for the user login use case. + * It provides methods for checking user credentials and retrieving user IDs based on email + * and password. + */ public interface LoginInputBoundary { + + /** + * Checks whether the provided email and password match a user's credentials. + * + * @param email The email address of the user. + * @param password The password of the user. + * @return boolean True if the provided credentials are valid, otherwise + */ Boolean checkUserPassword(String email, String password); + + /** + * Retrieves the user ID associated with the given email and password. + * + * @param email The email address of the user. + * @param password The password of the user. + * @return The user ID if the email and password are valid, otherwise null + */ String getUserId(String email, String password); } diff --git a/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInteractor.java b/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInteractor.java index fd737e8a..a4fa4501 100644 --- a/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInteractor.java +++ b/app/src/main/java/com/courseproject/tindar/usecases/login/LoginInteractor.java @@ -1,18 +1,41 @@ package com.courseproject.tindar.usecases.login; +/** + * This class implements the login use case's input boundary. + * It interacts with the data source gateway to authenticate users and retrieve user IDs. + */ public class LoginInteractor implements LoginInputBoundary { final LoginDsGateway loginDsGateway; + /** + * Constructs a new LoginInteractor with the specified LoginDsGateway. + * + * @param loginDsGateway The data source gateway for login-related operations. + */ public LoginInteractor(LoginDsGateway loginDsGateway){ this.loginDsGateway = loginDsGateway; } + /** + * Checks whether the provided email and password match a user's credentials. + * + * @param email The email address of the user. + * @param password The password of the user. + * @return Boolean if the provided credentials are valid, otherwise false + */ @Override public Boolean checkUserPassword(String email, String password){ return !(loginDsGateway.readUserId(email, password) == null); } + /** + * Retrieves the user ID associated with the given email and password. + * + * @param email The email address of the user. + * @param password The password of the user. + * @return The user ID if the email and password are valid, otherwise null + */ @Override public String getUserId(String email, String password){ return loginDsGateway.readUserId(email, password); diff --git a/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListDsGateway.java b/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListDsGateway.java index 08be468b..e445c46e 100644 --- a/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListDsGateway.java +++ b/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListDsGateway.java @@ -2,6 +2,17 @@ import java.util.ArrayList; +/** + * This interface defines the gateway for accessing the data source related to user lists. + * It provides a method to retrieve a list of user IDs excluding the provided user's ID. + */ public interface UserListDsGateway { + + /** + * Retrieves a list of user IDs excluding the provided user's ID. + * + * @param userId The ID of the user for whom the list is being generated. + * @return An ArrayList containing the user IDs of other users, excluding the provided user's ID. + */ ArrayList getAllOtherUserIds(String userId); } diff --git a/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInputBoundary.java b/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInputBoundary.java index 86d02b8c..e7a884c2 100644 --- a/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInputBoundary.java +++ b/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInputBoundary.java @@ -2,6 +2,18 @@ import java.util.ArrayList; +/** + * This interface defines the input boundary for the user list use case. + * It provides a method to retrieve a list of user IDs excluding the provided user's ID. + */ public interface UserListInputBoundary { + + + /** + * Retrieves a list of user IDs excluding the provided user's ID. + * + * @param userId The ID of the user for whom the list is being generated. + * @return An ArrayList containing the user IDs of other users, excluding the provided user's ID. + */ ArrayList getAllOtherUserIds(String userId); } diff --git a/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInteractor.java b/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInteractor.java index 4730de85..2de9d2fa 100644 --- a/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInteractor.java +++ b/app/src/main/java/com/courseproject/tindar/usecases/userlist/UserListInteractor.java @@ -1,15 +1,30 @@ package com.courseproject.tindar.usecases.userlist; import java.util.ArrayList; - +/** + * This class implements the user list use case's input boundary. + * It interacts with the data source gateway to retrieve a list of user IDs excluding the + * provided user's ID. + */ public class UserListInteractor implements UserListInputBoundary{ final UserListDsGateway userListDsGateway; + /** + * Constructs a new UserListInteractor with the specified UserListDsGateway. + * + * @param userListDsGateway The data source gateway for user list-related operations. + */ public UserListInteractor(UserListDsGateway userListDsGateway) { this.userListDsGateway = userListDsGateway; } + /** + * Retrieves a list of user IDs excluding the provided user's ID. + * + * @param userId The ID of the user for whom the list is being generated. + * @return An ArrayList containing the user IDs of other users, excluding the provided user's ID. + */ public ArrayList getAllOtherUserIds(String userId){ return userListDsGateway.getAllOtherUserIds(userId); }