Skip to content

Commit b567ed0

Browse files
committed
Removing debug
1 parent 5d932e4 commit b567ed0

File tree

3 files changed

+22
-11
lines changed

3 files changed

+22
-11
lines changed

app/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ android {
44
compileSdkVersion 26
55
defaultConfig {
66
applicationId "uk.co.appoly.arcore_location"
7-
minSdkVersion 15
7+
minSdkVersion 17
88
targetSdkVersion 26
99
versionCode 1
1010
versionName "1.0"

arcore-location/src/main/java/uk/co/appoly/arcorelocation/LocationScene.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
import java.util.ArrayList;
1515

1616
import uk.co.appoly.arcorelocation.rendering.LocationNode;
17-
import uk.co.appoly.arcorelocation.rendering.LocationNodeRender;
1817
import uk.co.appoly.arcorelocation.sensor.DeviceLocation;
1918
import uk.co.appoly.arcorelocation.sensor.DeviceLocationChanged;
2019
import uk.co.appoly.arcorelocation.sensor.DeviceOrientation;
@@ -53,6 +52,7 @@ public void run() {
5352
mHandler.postDelayed(anchorRefreshTask, anchorRefreshInterval);
5453
}
5554
};
55+
private boolean debugEnabled = false;
5656
private Session mSession;
5757
private DeviceLocationChanged locationChangedEvent;
5858
public LocationScene(Context mContext, Activity mActivity, ArSceneView mArSceneView) {
@@ -69,6 +69,14 @@ public LocationScene(Context mContext, Activity mActivity, ArSceneView mArSceneV
6969
deviceOrientation.resume();
7070
}
7171

72+
public boolean isDebugEnabled() {
73+
return debugEnabled;
74+
}
75+
76+
public void setDebugEnabled(boolean debugEnabled) {
77+
this.debugEnabled = debugEnabled;
78+
}
79+
7280
public boolean minimalRefreshing() {
7381
return minimalRefreshing;
7482
}
@@ -125,8 +133,8 @@ public void setAnchorRefreshInterval(int anchorRefreshInterval) {
125133
}
126134

127135
public void clearMarkers() {
128-
for(LocationMarker lm : mLocationMarkers) {
129-
if(lm.anchorNode != null) {
136+
for (LocationMarker lm : mLocationMarkers) {
137+
if (lm.anchorNode != null) {
130138
lm.anchorNode.getAnchor().detach();
131139
lm.anchorNode.setEnabled(false);
132140
lm.anchorNode = null;
@@ -283,7 +291,7 @@ private void refreshAnchorsIfRequired(Frame frame) {
283291
mLocationMarkers.get(i).anchorNode.setGradualScalingMinScale(mLocationMarkers.get(i).getGradualScalingMinScale());
284292
mLocationMarkers.get(i).anchorNode.setHeight(mLocationMarkers.get(i).getHeight());
285293

286-
if(minimalRefreshing)
294+
if (minimalRefreshing)
287295
mLocationMarkers.get(i).anchorNode.scaleAndRotate();
288296
} catch (Exception e) {
289297
e.printStackTrace();

arcore-location/src/main/java/uk/co/appoly/arcorelocation/sensor/DeviceLocation.java

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,6 @@
11
package uk.co.appoly.arcorelocation.sensor;
22

3-
import android.content.Context;
43
import android.location.Criteria;
5-
import android.location.GpsStatus;
64
import android.location.Location;
75
import android.location.LocationListener;
86
import android.location.LocationManager;
@@ -169,13 +167,16 @@ private boolean filterAndAddLocation(Location location) {
169167
if (age > 5 * 1000) { //more than 5 seconds
170168
Log.d(TAG, "Location is old");
171169
oldLocationList.add(location);
172-
Toast.makeText(locationScene.mContext, "Rejected: old", Toast.LENGTH_SHORT).show();
170+
171+
if (locationScene.isDebugEnabled())
172+
Toast.makeText(locationScene.mContext, "Rejected: old", Toast.LENGTH_SHORT).show();
173173
return false;
174174
}
175175

176176
if (location.getAccuracy() <= 0) {
177177
Log.d(TAG, "Latitidue and longitude values are invalid.");
178-
Toast.makeText(locationScene.mContext, "Rejected: invalid", Toast.LENGTH_SHORT).show();
178+
if (locationScene.isDebugEnabled())
179+
Toast.makeText(locationScene.mContext, "Rejected: invalid", Toast.LENGTH_SHORT).show();
179180
noAccuracyLocationList.add(location);
180181
return false;
181182
}
@@ -185,7 +186,8 @@ private boolean filterAndAddLocation(Location location) {
185186
if (horizontalAccuracy > getMinimumAccuracy()) { //10meter filter
186187
Log.d(TAG, "Accuracy is too low.");
187188
inaccurateLocationList.add(location);
188-
Toast.makeText(locationScene.mContext, "Rejected: innacurate", Toast.LENGTH_SHORT).show();
189+
if (locationScene.isDebugEnabled())
190+
Toast.makeText(locationScene.mContext, "Rejected: innacurate", Toast.LENGTH_SHORT).show();
189191
return false;
190192
}
191193

@@ -220,7 +222,8 @@ private boolean filterAndAddLocation(Location location) {
220222
}
221223

222224
kalmanNGLocationList.add(location);
223-
Toast.makeText(locationScene.mContext, "Rejected: kalman filter", Toast.LENGTH_SHORT).show();
225+
if (locationScene.isDebugEnabled())
226+
Toast.makeText(locationScene.mContext, "Rejected: kalman filter", Toast.LENGTH_SHORT).show();
224227
return false;
225228
} else {
226229
kalmanFilter.consecutiveRejectCount = 0;

0 commit comments

Comments
 (0)