Skip to content

Commit

Permalink
Added new javadocs (#125)
Browse files Browse the repository at this point in the history
* Added new javadocs

* javadocs for classes related to tags

* javadocs for tags comparator and one method in select fragment

* Made two variables private

* small javadoc

* add part 4's generated javadocs

---------

Co-authored-by: Matthew <matthewryneufeld@gmail.com>
Co-authored-by: Sami Jagirdar <jagirdar@ualberta.ca>
Co-authored-by: owencooke <ocooke@ualberta.ca>
  • Loading branch information
4 people authored Dec 4, 2023
1 parent 46a5bec commit 9705c68
Show file tree
Hide file tree
Showing 242 changed files with 20,896 additions and 1,406 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,6 @@
import com.google.android.material.textfield.TextInputEditText;
import com.google.android.material.textview.MaterialTextView;

import java.io.Serializable;

/**
* This fragment is responsible for editing an existing item in the database.
*
Expand Down Expand Up @@ -134,7 +132,10 @@ public void setListener(OnItemUpdateListener listener) {
this.listener = listener;
}

public interface OnItemUpdateListener extends Serializable {
/**
* Interface definition for when an Item is updated.
*/
public interface OnItemUpdateListener {
void onItemUpdated(Item updatedItem);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,10 @@ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup c
return rootView;
}

/**
* Setter for itemIdMap where it populates the Hashmap, by mapping
* each of the items' ID to the actual item obects from our itemList
*/
private void createItemIdMap() {
for (Item item : itemList) {
itemIdMap.put(item.getId(), item);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
* A class for handling the scanning and decoding of barcodes
* and updating item information accordingly
* @author Sami
* @see ImageScanner
*/
public class BarcodeImageScanner extends ImageScanner{

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,11 @@
package com.example.househomey.scanner;

/**
* An abstract class defining an ImageScanner. All children must have the public scanImage()
* function
* @author Lukas Bonkowski
* @see ScannerPickerDialog
*/
public abstract class ImageScanner {

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,16 @@

/**
* A class for handling the scanning of serial numbers and updating item information accordingly
* @author Lukas
* @author Lukas Bonkowski
* @see ImageScanner
*/
public class SNImageScanner extends ImageScanner {
private Context context;
private OnImageScannedListener listener;

/**
* Interface definition for when serial number scanning is complete.
*/
public interface OnImageScannedListener {
void onSNScanningComplete(String serialNumber);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,14 @@
import com.google.android.material.bottomsheet.BottomSheetDialogFragment;


/**
* Creates a dialog to select the appropriate scanner. After selection it prompts the user to
* choose image upload method
* @see ImagePickerDialog
*/
public class ScannerPickerDialog extends BottomSheetDialogFragment implements ImagePickerDialog.OnImagePickedListener {
ImageScanner scanner;
ImagePickerDialog imagePickerDialog;
private ImageScanner scanner;
private ImagePickerDialog imagePickerDialog;

/**
* Create new Scanner picker dialog
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@
import java.util.regex.Matcher;
import java.util.regex.Pattern;

/**
* Defines the sign up/register page and links back to the SignInFragment.
* Deals with validating registration information from user.
* @author Antonio Lech Martin-Ozimek
*/
public class SignUpFragment extends Fragment {
private EditText usernameEdittext;
private EditText emailEdittext;
Expand Down
11 changes: 11 additions & 0 deletions app/src/main/java/com/example/househomey/sort/TagComparator.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
import java.util.Comparator;
import java.util.Set;

/**
* Comparator for an Item that compares items based on their tags, more specifically
* the first tag lexicographically
*/
public class TagComparator implements Comparator<Item> {
/**
* Compares the first tag of each item
Expand All @@ -29,6 +33,13 @@ public int compare(Item item1, Item item2) {
}
}

/**
* If an item has tags, returns the first tag from an ordered set of tags,
* ordered lexicographically
* @param item item whose first tag is being returned
* @return Lexicographically first tag of given item
*/

private Tag getFirstTag(Item item) {
Set<Tag> tags = item.getTags();
if (tags.isEmpty()) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.stream.Collectors;

/**
* DialogFragment that allows users to add new tags
* Dialog that allows users to select and apply existing tags
* @author Matthew Neufeld
*/
public class ApplyTagFragment extends TagFragment implements Serializable {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@
import java.util.Map;
import java.util.stream.Collectors;

/**
* Dialog that allows users to manage (add and delete) tags
* @author Matthew Neufeld
*/
public class ManageTagFragment extends TagFragment {
private EditText tagEditText;
private Button addTagButton;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

import androidx.fragment.app.DialogFragment;

import com.google.android.material.chip.Chip;
import com.google.android.material.chip.ChipGroup;
import com.google.firebase.firestore.CollectionReference;
import com.google.firebase.firestore.QueryDocumentSnapshot;
Expand All @@ -11,6 +10,9 @@
import java.util.List;
import java.util.stream.Collectors;

/**
* The base DialogFragment that makes a tag chip and gets the tag collection. Used by apply and manage tag fragments
*/
public abstract class TagFragment extends DialogFragment {
protected CollectionReference tagRef;
protected List<Tag> tagList = new ArrayList<>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@
import com.example.househomey.signin.SignInActivity;
import com.google.firebase.auth.FirebaseAuth;

/**
* This fragment is responsible for displaying the currently signed-in user's details
*
* @author Antonio Lech Martin-Ozimek
*/
public class UserProfileFragment extends Fragment {
private final FirebaseAuth auth = FirebaseAuth.getInstance();

Expand Down
15 changes: 13 additions & 2 deletions app/src/main/java/com/example/househomey/utils/FragmentUtils.java
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@ public static void goBack(Context context) {
* @return datePicker
*/
public static MaterialDatePicker<Long> createDatePicker() {

// Create constraint to restrict dates to past/present
CalendarConstraints.Builder constraintsBuilder = new CalendarConstraints.Builder();
constraintsBuilder.setEnd(System.currentTimeMillis());
Expand Down Expand Up @@ -125,7 +124,6 @@ public static String formatDate(Date date) {
* @param textColour text colour of the chip
* @return a new chip
*/

public static Chip makeChip(String label, Boolean closeIconVisibility, ChipGroup chipGroup, Context context, int backgroundColour, int strokeColour, int textColour, boolean checkable) {
Chip chip = new Chip(context);
chip.setText(label);
Expand All @@ -137,6 +135,19 @@ public static Chip makeChip(String label, Boolean closeIconVisibility, ChipGroup
chipGroup.addView(chip);
return chip;
}

/**
* uses MakeChip to make a new chip
*
* @param label label that will go on the chip
* @param closeIconVisibility boolean: if true, closeIcon is visible, if false, not visible
* @param chipGroup group of chips the chip will be added to
* @param context the given context
* @param backgroundColour background colour of the chip
* @param strokeColour stroke colour of the chip
* @param textColour text colour of the chip
* @return a chip provided by makeChip
*/
public static Chip makeChip(String label, Boolean closeIconVisibility, ChipGroup chipGroup, Context context, int backgroundColour, int strokeColour, int textColour) {
return makeChip(label, closeIconVisibility, chipGroup, context, backgroundColour, strokeColour, textColour, false);
}
Expand Down
Loading

0 comments on commit 9705c68

Please sign in to comment.