Skip to content

Commit 8ef5391

Browse files
committed
add comments to necessary functions and classes.
1 parent c383457 commit 8ef5391

File tree

7 files changed

+55
-1
lines changed

7 files changed

+55
-1
lines changed

app/src/main/java/com/lcl/lclmeasurementtool/MainActivity.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ public void onCellularNetworkChanged(boolean isConnected) {
9898
Log.e(TAG, "on connection lost");
9999
if (!isConnected) {
100100
updateSignalStrengthTexts(SignalStrengthLevel.NONE, 0);
101-
updateFAB(isConnected);
101+
updateFAB(false);
102102
}
103103
}
104104
});

app/src/main/java/com/lcl/lclmeasurementtool/Managers/CellularChangeListener.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,15 @@
22

33
import com.lcl.lclmeasurementtool.Utils.SignalStrengthLevel;
44

5+
/**
6+
* Listen to the cellular network changes from the device.
7+
*/
58
public interface CellularChangeListener {
9+
10+
/**
11+
* Callback function when the cellular network changes.
12+
* @param level the Signal Strength level.
13+
* @param dBm the signal strength in dBm.
14+
*/
615
void onChange(SignalStrengthLevel level, int dBm);
716
}

app/src/main/java/com/lcl/lclmeasurementtool/Managers/LocationServiceManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@ public void getLastLocation() {
9191
if (task.isSuccessful() && task.getResult() != null) {
9292
mLastLocation = task.getResult();
9393

94+
// TODO: log the location latitude and longitude
9495
Log.i(TAG, String.valueOf(mLastLocation.getLatitude()));
9596
Log.i(TAG, String.valueOf(mLastLocation.getLongitude()));
9697
} else {
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
package com.lcl.lclmeasurementtool.Managers;
22

3+
/**
4+
* An interface that listens to the changes in the network status.
5+
*/
36
public interface NetworkChangeListener {
7+
8+
/**
9+
* callback function when the cellular network becomes available.
10+
*/
411
void onAvailable();
12+
13+
/**
14+
* callback function when the cellular network becomes unavailable.
15+
*/
516
void onUnavailable();
17+
18+
/**
19+
* callback function when the cellular network gets lost.
20+
*/
621
void onLost();
22+
23+
/**
24+
* callback function when the cellular network status gets changed.
25+
*
26+
* @param isConnected boolean parameter indicating whether there is cellular connection.
27+
*/
728
void onCellularNetworkChanged(boolean isConnected);
829
}

app/src/main/java/com/lcl/lclmeasurementtool/Managers/NetworkManager.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -141,6 +141,11 @@ public boolean isCellularConnected() {
141141
this.capabilities.hasTransport(NetworkCapabilities.TRANSPORT_CELLULAR);
142142
}
143143

144+
/**
145+
* Retrieve the downstream bandwidth in Kbps
146+
*
147+
* @return the downstream bandwidth in Kbps as an integer. If no cellular capability, return 0.
148+
*/
144149
public int getLinkDownstreamBandwidthKbps() {
145150
if (this.capabilities != null) {
146151
return this.capabilities.getLinkDownstreamBandwidthKbps();
@@ -149,6 +154,11 @@ public int getLinkDownstreamBandwidthKbps() {
149154
return 0;
150155
}
151156

157+
/**
158+
* Retrieve the upstream bandwidth in Kbps
159+
*
160+
* @return the upstream bandwidth in Kbps as an integer. If no cellular capability, return 0.
161+
*/
152162
public int getLinkUpstreamBandwidthKbps() {
153163
if (this.capabilities != null) {
154164
return this.capabilities.getLinkUpstreamBandwidthKbps();

app/src/main/java/com/lcl/lclmeasurementtool/Utils/SignalStrengthLevel.java

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,11 @@ public String toString() {
6262
"levelCode=" + levelCode;
6363
}
6464

65+
/**
66+
* Retrieve the name of the signal strength.
67+
*
68+
* @return the string representation of the signal strength level.
69+
*/
6570
public String getName() {
6671
switch (this) {
6772
case NONE:
@@ -81,6 +86,11 @@ public String getName() {
8186
return "";
8287
}
8388

89+
/**
90+
* Retrieve the color representation of the signal strength.
91+
* @param context the context of the application/activity
92+
* @return the color representation of the signal strength.
93+
*/
8494
public int getColor(Context context) {
8595
switch (this) {
8696
case GREAT:

app/src/main/java/com/lcl/lclmeasurementtool/Utils/UnitUtils.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@
55
*/
66
public class UnitUtils {
77

8+
/** the signal strength unit */
89
public static final String SIGNAL_STRENGTH_UNIT = "dBm";
10+
11+
/** the ping test unit */
912
public static final String PING_UNIT = "ms";
1013
}

0 commit comments

Comments
 (0)