Skip to content

Commit 24457bb

Browse files
committed
minor updates on styles and improve code conciseness.
1 parent b911b47 commit 24457bb

File tree

3 files changed

+7
-8
lines changed

3 files changed

+7
-8
lines changed

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,11 +33,11 @@ public class MainActivity extends AppCompatActivity {
3333
protected void onCreate(Bundle savedInstanceState) {
3434
super.onCreate(savedInstanceState);
3535
setContentView(R.layout.activity_main);
36-
mNetworkManager = NetworkManager.getManager(this);
37-
mCellularManager = CellularManager.getManager(this);
38-
mLocationManager = LocationServiceManager.getManager(this);
36+
mNetworkManager = NetworkManager.getManager(this.getApplicationContext());
37+
mCellularManager = CellularManager.getManager(this.getApplicationContext());
38+
mLocationManager = LocationServiceManager.getManager(this.getApplicationContext());
3939

40-
locationServiceListener = new LocationServiceListener(this, getLifecycle());
40+
locationServiceListener = new LocationServiceListener(this.getApplicationContext(), getLifecycle());
4141
getLifecycle().addObserver(locationServiceListener);
4242

4343
TextView tv = (TextView) findViewById(R.id.signalStrengthStatus);

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ private LocationServiceManager(@NonNull Context context) {
5656
*/
5757
public static LocationServiceManager getManager(@NonNull Context context) {
5858
if (locationServiceManager == null) {
59-
locationServiceManager = new LocationServiceManager(context.getApplicationContext());
59+
locationServiceManager = new LocationServiceManager(context);
6060
}
6161
return locationServiceManager;
6262
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public class NetworkManager {
3434
private ConnectivityManager.NetworkCallback networkCallback;
3535

3636
// the connectivity manager object that keeps track of all information
37-
// related to phone's connectivyt states.
37+
// related to phone's connectivity states.
3838
private final ConnectivityManager connectivityManager;
3939

4040
// current device supports with regards to networking.
@@ -59,7 +59,6 @@ private NetworkManager(@NonNull Context context) {
5959
* @return a network manager
6060
*/
6161
public static NetworkManager getManager(@NonNull Context context) {
62-
6362
if (networkManager == null) {
6463
networkManager = new NetworkManager(context);
6564
}
@@ -121,7 +120,7 @@ public void onUnavailable() {
121120
*
122121
* @param networkChangeListener the listener to be removed (should not be null)
123122
*/
124-
public void removeNetworokChangeListener(@NonNull NetworkChangeListener networkChangeListener) {
123+
public void removeNetworkChangeListener(@NonNull NetworkChangeListener networkChangeListener) {
125124
mNetworkChangeListeners.remove(networkChangeListener);
126125
}
127126

0 commit comments

Comments
 (0)