Skip to content

Commit af09998

Browse files
committed
Merge pull request #12 from RenniePet/Cosmetic-changes
Cosmetic changes.
2 parents 1b26bf2 + db91a28 commit af09998

File tree

2 files changed

+24
-21
lines changed

2 files changed

+24
-21
lines changed

app/src/main/java/org/altbeacon/beacon/TimedBeaconSimulator.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ public class TimedBeaconSimulator implements org.altbeacon.beacon.simulator.Beac
2424
* Uncomment the lines in BeaconReferenceApplication starting with:
2525
* // If you wish to test beacon detection in the Android Emulator, you can use code like this:
2626
* Then set USE_SIMULATED_BEACONS = true to initialize the sample code in this class.
27-
* If using a bluetooth incapable test device (i.e. Emulator), you will want to comment
27+
* If using a Bluetooth incapable test device (i.e. Emulator), you will want to comment
2828
* out the verifyBluetooth() in MonitoringActivity.java as well.
2929
*
3030
* Any simulated beacons will automatically be ignored when building for production.

app/src/main/java/org/altbeacon/beaconreference/RangingActivity.java

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -24,51 +24,54 @@ public class RangingActivity extends Activity implements BeaconConsumer {
2424
@Override
2525
protected void onCreate(Bundle savedInstanceState) {
2626
super.onCreate(savedInstanceState);
27-
setContentView(R.layout.activity_ranging);
27+
setContentView(R.layout.activity_ranging);
2828

2929
beaconManager.bind(this);
3030
}
31+
3132
@Override
3233
protected void onDestroy() {
3334
super.onDestroy();
3435
beaconManager.unbind(this);
3536
}
37+
3638
@Override
3739
protected void onPause() {
38-
super.onPause();
39-
if (beaconManager.isBound(this)) beaconManager.setBackgroundMode(true);
40+
super.onPause();
41+
if (beaconManager.isBound(this)) beaconManager.setBackgroundMode(true);
4042
}
43+
4144
@Override
4245
protected void onResume() {
43-
super.onResume();
44-
if (beaconManager.isBound(this)) beaconManager.setBackgroundMode(false);
46+
super.onResume();
47+
if (beaconManager.isBound(this)) beaconManager.setBackgroundMode(false);
4548
}
4649

4750
@Override
4851
public void onBeaconServiceConnect() {
4952
beaconManager.setRangeNotifier(new RangeNotifier() {
50-
@Override
51-
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
52-
if (beacons.size() > 0) {
53-
EditText editText = (EditText)RangingActivity.this
54-
.findViewById(R.id.rangingText);
55-
Beacon firstBeacon = beacons.iterator().next();
56-
logToDisplay("The first beacon "+firstBeacon.toString()+" is about "+firstBeacon.getDistance()+" meters away."); }
57-
}
53+
@Override
54+
public void didRangeBeaconsInRegion(Collection<Beacon> beacons, Region region) {
55+
if (beacons.size() > 0) {
56+
//EditText editText = (EditText)RangingActivity.this.findViewById(R.id.rangingText);
57+
Beacon firstBeacon = beacons.iterator().next();
58+
logToDisplay("The first beacon " + firstBeacon.toString() + " is about " + firstBeacon.getDistance() + " meters away.");
59+
}
60+
}
5861

5962
});
6063

6164
try {
6265
beaconManager.startRangingBeaconsInRegion(new Region("myRangingUniqueId", null, null, null));
6366
} catch (RemoteException e) { }
6467
}
68+
6569
private void logToDisplay(final String line) {
66-
runOnUiThread(new Runnable() {
67-
public void run() {
68-
EditText editText = (EditText)RangingActivity.this
69-
.findViewById(R.id.rangingText);
70-
editText.append(line+"\n");
71-
}
72-
});
70+
runOnUiThread(new Runnable() {
71+
public void run() {
72+
EditText editText = (EditText)RangingActivity.this.findViewById(R.id.rangingText);
73+
editText.append(line+"\n");
74+
}
75+
});
7376
}
7477
}

0 commit comments

Comments
 (0)