Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Documented 11 functions across 1 file #1

Open
wants to merge 26 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
3659182
Added comments to 11 functions across 1 file
komment-ai-beta[bot] Aug 12, 2024
9f90772
Added comments to 6 functions across 1 file
komment-ai-beta[bot] Aug 12, 2024
39b8616
Added comments to 19 functions across 4 files
komment-ai-beta[bot] Aug 12, 2024
cdf1465
Added comments to 25 functions across 4 files
komment-ai-beta[bot] Aug 12, 2024
bb1f39e
Added comments to 99 functions across 9 files
komment-ai-beta[bot] Aug 12, 2024
e14b138
Added comments to 29 functions across 5 files
komment-ai-beta[bot] Aug 12, 2024
f932473
Added comments to 1 function across 1 file
komment-ai-beta[bot] Aug 12, 2024
320de0a
Added comments to 87 functions across 8 files
komment-ai-beta[bot] Aug 12, 2024
72e6c19
Added comments to 13 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
2f5ddc8
Added comments to 10 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
7861148
Added comments to 10 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
8fc4902
Added comments to 10 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
30cb72f
Added comments to 7 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
5767678
Added comments to 7 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
c14dec1
Added comments to 7 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
5a4a46f
Added comments to 10 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
276169e
Added comments to 10 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
eea02b2
Added comments to 7 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
88e777f
Added comments to 24 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
b0d4d07
Added comments to 23 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
ff79362
Added comments to 9 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
99edace
Added comments to 21 functions across 1 file
komment-ai-beta[bot] Aug 13, 2024
1ad69ac
Added comments to 13 items across 1 file
komment-ai-beta[bot] Aug 30, 2024
5fcd980
Added comments to 5 items across 1 file
komment-ai-beta[bot] Aug 30, 2024
2b44acd
Added comments to 1 item across 1 file
komment-ai-beta[bot] Aug 30, 2024
76c3d12
Added comments to 3 items across 2 files
komment-ai-beta[bot] Oct 18, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10,036 changes: 10,036 additions & 0 deletions .komment/00000.json

Large diffs are not rendered by default.

54 changes: 54 additions & 0 deletions .komment/komment.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
{
"meta": {
"version": "1",
"updated_at": "2024-08-12T22:02:43.281Z",
"created_at": "2024-08-12T18:03:18.789Z",
"pipelines": [
"5290e9fb-b07e-4f3a-b1dc-ade204499fa5",
"6ce8c123-10dc-4848-87ac-c2fd538e4116",
"e3c5077a-79f2-4dd1-9c80-093fc7876e9c",
"586cd072-1664-40b6-a86b-eabc588d477a",
"7d927ab4-6aa0-44dd-9a21-5bba27f58a29",
"92451fc3-3e0e-44b7-ba54-9467bb091828",
"0a87801e-c9a0-4025-b165-54a14a406829",
"3e235bd1-bafe-4fc5-8d1d-927ea8b78489"
]
},
"lookup": [
[
"client/src/main/java/io/sensable/client/adapter/ExpandableListAdapter.java",
"client/src/main/java/io/sensable/client/component/FontFitTextView.java",
"client/src/main/java/io/sensable/client/adapter/TabsPagerAdapter.java",
"client/src/main/java/io/sensable/client/SensorHelper.java",
"client/src/main/java/io/sensable/client/SensableUser.java",
"client/src/main/java/io/sensable/client/SensorListActivity.java",
"client/src/main/java/io/sensable/client/scheduler/BootReceiver.java",
"client/src/main/java/io/sensable/client/scheduler/ScheduledSensableService.java",
"client/src/main/java/io/sensable/client/scheduler/ScheduleHelper.java",
"client/src/main/java/io/sensable/client/settings/Config.java",
"client/src/main/java/io/sensable/client/AboutActivity.java",
"client/src/main/java/io/sensable/client/CreateSensableFragment.java",
"client/src/main/java/io/sensable/client/MainActivity.java",
"client/src/main/java/io/sensable/client/SensableActivity.java",
"client/src/main/java/io/sensable/client/SensableLoginFragment.java",
"client/src/main/java/io/sensable/client/views/SensableListAdapter.java",
"client/src/main/java/io/sensable/client/views/RemoteSensablesFragment.java",
"client/src/main/java/io/sensable/client/views/LocalSensablesFragment.java",
"client/src/main/java/io/sensable/client/views/FavouriteSensablesFragment.java",
"client/src/main/java/io/sensable/client/sqlite/SavedSensablesTable.java",
"client/src/main/java/io/sensable/client/sqlite/ScheduledSensableContentProvider.java",
"client/src/main/java/io/sensable/client/sqlite/ScheduledSensablesTable.java",
"client/src/main/java/io/sensable/client/sqlite/SensableContentProvider.java",
"client/src/main/java/io/sensable/client/sqlite/SensableDatabaseHelper.java",
"library/src/main/java/io/sensable/SensableService.java",
"library/src/main/java/io/sensable/model/Sample.java",
"library/src/main/java/io/sensable/model/SampleResponse.java",
"library/src/main/java/io/sensable/model/SampleSender.java",
"library/src/main/java/io/sensable/model/ScheduledSensable.java",
"library/src/main/java/io/sensable/model/Sensable.java",
"library/src/main/java/io/sensable/model/Statistics.java",
"library/src/main/java/io/sensable/model/User.java",
"library/src/main/java/io/sensable/model/UserLogin.java"
]
]
}
16 changes: 16 additions & 0 deletions client/src/main/java/io/sensable/client/AboutActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,27 @@
import java.text.DecimalFormat;
import java.text.NumberFormat;

/**
* Displays information about the application, including a formatted text view and
* retrieves sample count from sensable.io via Rest API.
*/
public class AboutActivity extends Activity {
private static final String TAG = AboutActivity.class.getSimpleName();

private TextView statistics;

/**
* Initializes the activity's layout and displays formatted text from a string resource,
* along with loading additional statistics.
*
* @param savedInstanceState bundle of information previously saved by the activity,
* allowing it to restore its state after being destroyed.
*
* Destructure `savedInstanceState` into its main properties:
* - `boolean isRestored`
* - `Bundle` `state`
* - `ClassLoader` `loader`
*/
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Expand Down
384 changes: 128 additions & 256 deletions client/src/main/java/io/sensable/client/CreateSensableFragment.java

Large diffs are not rendered by default.

348 changes: 142 additions & 206 deletions client/src/main/java/io/sensable/client/MainActivity.java

Large diffs are not rendered by default.

369 changes: 140 additions & 229 deletions client/src/main/java/io/sensable/client/SensableActivity.java

Large diffs are not rendered by default.

148 changes: 55 additions & 93 deletions client/src/main/java/io/sensable/client/SensableLoginFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,10 @@
* Created by madine on 01/07/14.
*/
/**
* is a custom Dialog Fragment that allows users to log in to a sensable system. It
* Is a custom Dialog Fragment that allows users to log in to a sensable system. It
* has an EditText field for username and password, and a submit button that triggers
* an listener when clicked. The listener can be set using the setSensableLoginListener
* method, which will call the onConfirmed method of the listener when the login is
* confirmed.
* the login process when clicked. The fragment also provides an interface for receiving
* confirmed UserLogin objects.
*/
public class SensableLoginFragment extends DialogFragment {

Expand All @@ -28,7 +27,7 @@ public class SensableLoginFragment extends DialogFragment {
private SensableLoginListener sensableLoginListener;

/**
* defines a method for receiving confirmed UserLogin objects.
* Defines a method to receive confirmed UserLogin objects from login operations.
*/
public static interface SensableLoginListener {
public void onConfirmed(UserLogin userLogin);
Expand All @@ -38,56 +37,35 @@ public SensableLoginFragment() {
}

/**
* inflates a layout, sets the dialog title, and adds an event listener to a button.
*
* @param inflater inflation tool that is used to inflate the layout from the resource
* file.
*
* - `inflater`: An instance of the `LayoutInflater` class, which provides a way to
* inflate layouts from XML files into Android views.
* - `view`: The View object that is being inflated and modified.
* - `container`: The parent ViewGroup that will hold the newly inflated view.
* - `savedInstanceState`: A Bundle object that contains any saved state information
* about the fragment, which can be used to restore the state of the view when the
* fragment is re-created.
*
* In this function, the `inflater` instance is not modified or destroyed, as it is
* a required parameter for the `onCreateView` method.
*
* @param container parent view group that will contain the inflated layout.
*
* - `inflater`: The `LayoutInflater` object used to inflate the layout of the view.
* - `savedInstanceState`: A `Bundle` object containing any saved state from a
* previous instance of the view.
* - `container`: The parent view group that contains the view being created. It can
* be used to access its properties and attributes, such as size, position, and visibility.
*
* @param savedInstanceState saved state of the activity, which can be used to restore
* the view and its components if the activity is recreated due to a configuration
* change or app restart.
*
* - `R.id.login_username_field`: An ID resource identifier for an EditText view.
* - `R.id.login_password_field`: An ID resource identifier for an EditText view.
* - `getActivity().getString(R.string.dialogTitleSensableLogin)`: The title of the
* dialog shown when the user clicks on the login button.
*
* @returns a View object representing the layout for the login screen.
*
* - `View view`: This is the inflated layout for the login screen, which contains
* several elements such as text fields for entering username and password, and a
* button to initiate the login process.
* - `getDialog().setTitle(getActivity().getString(R.string.dialogTitleSensableLogin))`:
* This sets the title of the dialog window to "Sensable Login".
* - `loginUsername = (EditText) view.findViewById(R.id.login_username_field)`: This
* assigns a reference to an EditText field in the layout for entering the username.
* - `loginPassword = (EditText) view.findViewById(R.id.login_password_field)`: This
* assigns a reference to another EditText field in the layout for entering the password.
* - `addListenerOnButton(view)`: This adds an listener to a button in the layout,
* which will be triggered when clicked.
*
* Overall, the `onCreateView` function is responsible for creating and inflating the
* layout for the login screen, setting the title of the dialog window, and adding
* listeners to the login fields and button.
* Inflates a layout, sets a title to the dialog, finds and initializes UI components
* such as EditTexts for username and password fields, and adds an event listener to
* a button. It returns the inflated view.
*
* @param inflater LayoutInflater object that is used to inflate or load the layout
* resource file into a View object.
*
* Inflate an instance of type layout from the given resource. It uses null as a root
* view, and attach to the parent ViewGroup if flag is specified. The inflater is
* used for inflating layouts and views.
*
* @param container 2D ViewGroup that this view is to be added to, and it is used by
* LayoutInflater to set the parent of the inflated view.
*
* Is null or zero-sized if the parent view group is an invalid type.
* Has layout parameters set to wrap its content.
* Is passed as part of the inflate method's arguments.
*
* @param savedInstanceState bundle of data previously saved by onSaveInstanceState
* and is not used in this function.
*
* Bundle object containing saved key-value pairs. Bundle stores data that can be
* saved across process death.
*
* @returns a view of the sensable login layout.
*
* The returned object is a View, which represents a UI component in Android's layout
* hierarchy. The View is inflated from the sensable_login_layout resource and has
* two child views: an EditText for login username and another EditText for login password.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
Expand All @@ -104,41 +82,30 @@ public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle sa
}

/**
* sets a reference to an instance of `SensableLoginListener`. This listener will
* receive events related to login functionality.
*
* @param sensableLoginListener listener for authentication events, allowing the
* method to assign and manage the listener object for further processing.
*
* - This object's `sensableLoginListener` attribute or property is set to the
* provided value.
*
* The `sensableLoginListener` field or property is set to the specified value in
* this method.
* Establishes a connection between an object and its login listener, storing the
* listener in the `sensableLoginListener` field for potential future use. This enables
* the object to notify the listener when certain login-related events occur. The
* function sets the listener without any validation or processing.
*
* @param sensableLoginListener listener that is assigned to handle login-related events.
*/
public void setSensableLoginListener(SensableLoginListener sensableLoginListener) {
this.sensableLoginListener = sensableLoginListener;
}


/**
* sets an event listener on a `Button` element in an Android activity, which upon
* click will check if the login username and password fields have content and pass
* the values to a `UserLogin` object. If both fields are empty, it displays a Toast
* message.
*
* @param view button that was clicked, and is used to obtain the Button object that
* is being passed as an argument to the `OnClickListener`.
*
* 1/ `submitButton`: The `Button` object found by calling `findViewById(R.id.login_submit_button)`.
* 2/ `OnClickListener`: The `OnClickListener` interface implemented by a reference
* to an anonymous inner class that contains the `onClick()` method.
* 3/ `onClick()`: An instance method of the anonymous inner class that is called
* when the button is clicked. It performs the following actions:
* - Checks if the `loginUsername` and `loginPassword` fields have valid text content.
* - Creates a new `UserLogin` object with the values of `loginUsername` and `loginPassword`.
* - Calls the `onConfirmed()` method of the `sensableLoginListener` object.
* - Dismisses the current `DialogFragment` instance.
* Sets a click listener for a submit button, verifying if login credentials are
* provided. If valid, it creates a `UserLogin` object and passes it to a listener,
* then dismisses the dialog. If invalid, it displays a toast message requiring
* username and password.
*
* @param view view that was clicked, which is then used to find the submit button
* within it by calling `findViewById(R.id.login_submit_button)`.
*
* View represents a base class for widgets and other graphical user interface
* components. It implements the Component interface to provide methods for handling
* events such as clicks, touches, and other gestures.
*/
public void addListenerOnButton(View view) {

Expand All @@ -147,16 +114,11 @@ public void addListenerOnButton(View view) {
submitButton.setOnClickListener(new View.OnClickListener() {

/**
* verifies if the login credentials are provided, then it passes the login information
* to a listener and dismisses the dialog.
*
* @param v view that was clicked, and is passed to the function as an argument when
* the button is pressed.
*
* - `v`: A `View` object that represents the button clicked to initiate the login
* process.
* - `loginUsername`: A `EditText` field containing the user's login username.
* - `loginPassword`: A `EditText` field containing the user's login password.
* Triggers when a view is clicked. It checks if username and password are provided,
* then creates a `UserLogin` object with the input data, notifies the listener, and
* dismisses the dialog if valid; otherwise, it displays an error message.
*
* @param v View that was clicked, triggering the execution of the `onClick` method.
*/
@Override
public void onClick(View v) {
Expand Down
Loading