Skip to content

Commit

Permalink
Merge pull request #210 from RenniePet/Cosmetic-changes
Browse files Browse the repository at this point in the history
Cosmetic changes
  • Loading branch information
davidgyoung committed Jun 10, 2015
2 parents d0cec5e + b0fca0e commit e8f3f68
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 24 deletions.
2 changes: 1 addition & 1 deletion src/main/java/org/altbeacon/beacon/Beacon.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
* <pre>A Beacon is identified by a unique multi-part identifier, with the first of the ordered
* identifiers being more significant for the purposes of grouping beacons.
*
* An Beacon sends a Bluetooth Low Energy (BLE) advertisement that contains these
* A Beacon sends a Bluetooth Low Energy (BLE) advertisement that contains these
* three identifiers, along with the calibrated tx power (in RSSI) of the
* Beacon's Bluetooth transmitter.
*
Expand Down
19 changes: 9 additions & 10 deletions src/main/java/org/altbeacon/beacon/BeaconManager.java
Original file line number Diff line number Diff line change
Expand Up @@ -219,28 +219,27 @@ public static BeaconManager getInstanceForApplication(Context context) {
return client;
}

/**
protected BeaconManager(Context context) {
mContext = context;
if (!sManifestCheckingDisabled) {
verifyServiceDeclaration();
}
this.beaconParsers.add(new AltBeaconParser());
}

/**
* Gets a list of the active beaconParsers. This list may only be modified before any consumers
* are bound to the beacon service
*
* @return list of active BeaconParsers
*/

public List<BeaconParser> getBeaconParsers() {
if (isAnyConsumerBound()) {
return Collections.unmodifiableList(beaconParsers);
}
return beaconParsers;
}

protected BeaconManager(Context context) {
mContext = context;
if (!sManifestCheckingDisabled) {
verifyServiceDeclaration();
}
this.beaconParsers.add(new AltBeaconParser());
}

/**
* Check if Bluetooth LE is supported by this Android device, and if so, make sure it is enabled.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ public class ModelSpecificDistanceCalculator implements DistanceCalculator {
public ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlString) {
this(context, remoteUpdateUrlString, AndroidModel.forThisDevice());
}

/**
* Obtains the best possible <code>DistanceCalculator</code> for the Android device passed
* as an argument
Expand All @@ -80,6 +81,7 @@ public ModelSpecificDistanceCalculator(Context context, String remoteUpdateUrlSt
public AndroidModel getModel() {
return mModel;
}

/**
* @return the Android device model requested to be used for distance calculations
*/
Expand Down Expand Up @@ -130,10 +132,10 @@ private DistanceCalculator findCalculatorForModel(AndroidModel model) {
private void loadModelMap() {
boolean mapLoaded = false;
if (mRemoteUpdateUrlString != null) {
mapLoaded= loadModelMapFromFile();
mapLoaded = loadModelMapFromFile();
// We only want to try to download an update from the server the first time the app is
// run. If we successfully download an update it gets saved to a file, so if the file
// is present that means should not download again
// is present that means should not download again.
if (!mapLoaded) {
requestModelMapFromWeb();
}
Expand Down Expand Up @@ -224,7 +226,6 @@ public void onComplete(String body, Exception ex, int code) {
else if (code != 200) {
LogManager.w(TAG, "Cannot updated distance models from online database at %s "
+ "due to HTTP status code %s", mRemoteUpdateUrlString, code);

}
else {
LogManager.d(TAG,
Expand Down Expand Up @@ -272,6 +273,7 @@ private void buildModelMap(String jsonString) throws JSONException {
}
}
}

private void loadDefaultModelMap() {
mModelMap = new HashMap<AndroidModel, DistanceCalculator>();
try {
Expand All @@ -287,21 +289,20 @@ private String stringFromFilePath(String path) throws IOException {
BufferedReader bufferedReader = null;
StringBuilder inputStringBuilder = new StringBuilder();
try {
stream = ModelSpecificDistanceCalculator.class.getResourceAsStream("/"+path);
stream = ModelSpecificDistanceCalculator.class.getResourceAsStream("/" + path);
if (stream == null) {
stream = this.getClass().getClassLoader().getResourceAsStream("/"+path);
stream = this.getClass().getClassLoader().getResourceAsStream("/" + path);
}

if (stream == null) {
throw new RuntimeException("Cannot load resource at "+path);
throw new RuntimeException("Cannot load resource at " + path);
}
bufferedReader = new BufferedReader(new InputStreamReader(stream, "UTF-8"));
String line = bufferedReader.readLine();
while(line != null){
inputStringBuilder.append(line);inputStringBuilder.append('\n');
line = bufferedReader.readLine();
}

}
finally {
if (bufferedReader != null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public BackgroundPowerSaver(Context context, boolean countActiveActivityStrategy
LogManager.w(TAG, "BackgroundPowerSaver requires API 18 or higher.");
return;
}
if (context instanceof Application ) {
if (context instanceof Application) {
((Application)context).registerActivityLifecycleCallbacks(this);
}
else {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
* is connected or disconnected from a device if the user has force terminated the app.
*
* IMPORTANT NOTE: The RegionBootstrap class registers an internal MonitorNotifier with the
* BeaconManager. If you use the RegionBootstrap, your application must not manually register
* BeaconManager. If you use the RegionBootstrap, your application must not manually register
* a second MonitorNotifier, otherwise it will unregister the one configured by the RegionBootstrap,
* effectively disabling it. When using the RegionBootstrap, any custom monitoring code must must
* therefore be placed in the callback methods in the BootsrapNotifier implementation passed to the
* effectively disabling it. When using the RegionBootstrap, any custom monitoring code must
* therefore be placed in the callback methods in the BootstrapNotifier implementation passed to the
* RegionBootstrap.
*/
public class RegionBootstrap {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
* Bluetooth LE devices in the background (e.g. beacon-enabled apps), especially when these users
* are around Bluetooth LE devices that randomize their mac address like Gimbal beacons.
*
* This class can both recover from crashes and prevent crashes from happening in the first place
* This class can both recover from crashes and prevent crashes from happening in the first place.
*
* More details on the bug can be found at the following URLs:
*
Expand All @@ -44,7 +44,7 @@ public class BluetoothCrashResolver {
private static final String TAG = "BluetoothCrashResolver";
private static final boolean PREEMPTIVE_ACTION_ENABLED = true;
/**
* This is not the same file that Bluedroid uses. This is just to maintain state of this module
* This is not the same file that Bluedroid uses. This is just to maintain state of this module.
*/
private static final String DISTINCT_BLUETOOTH_ADDRESSES_FILE = "BluetoothCrashResolverState.txt";
private boolean recoveryInProgress = false;
Expand Down

0 comments on commit e8f3f68

Please sign in to comment.