Skip to content

Commit c3251c9

Browse files
author
lycha
committed
Method refactor
1 parent e19a34c commit c3251c9

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

app/src/main/java/com/lycha/example/augmentedreality/CameraViewActivity.java

+8-7
Original file line numberDiff line numberDiff line change
@@ -113,15 +113,19 @@ private boolean isBetween(double minAngle, double maxAngle, double azimuth) {
113113
return false;
114114
}
115115

116+
private void updateDescription() {
117+
descriptionTextView.setText(mPoi.getPoiName() + " azimuthTeoretical "
118+
+ mAzimuthTeoretical + " azimuthReal " + mAzimuthReal + " latitude "
119+
+ mMyLatitude + " longitude " + mMyLongitude);
120+
}
121+
116122
@Override
117123
public void onLocationChanged(Location location) {
118124
mMyLatitude = location.getLatitude();
119125
mMyLongitude = location.getLongitude();
120-
descriptionTextView.setText(mPoi.getPoiName() + " azimuthTeoretical "
121-
+ mAzimuthTeoretical + " azimuthReal " + mAzimuthReal + " latitude "
122-
+ mMyLatitude + " longitude " + mMyLongitude);
123126
mAzimuthTeoretical = calculateTeoreticalAzimuth();
124127
Toast.makeText(this,"latitude: "+location.getLatitude()+" longitude: "+location.getLongitude(), Toast.LENGTH_SHORT).show();
128+
updateDescription();
125129
}
126130

127131
@Override
@@ -140,9 +144,7 @@ public void onAzimuthChanged(float azimuthChangedFrom, float azimuthChangedTo) {
140144
pointerIcon.setVisibility(View.INVISIBLE);
141145
}
142146

143-
descriptionTextView.setText(mPoi.getPoiName() + " mAzimuthTeoretical "
144-
+ mAzimuthTeoretical + " mAzimuthReal " + mAzimuthReal + " mMyLatitude "
145-
+ mMyLatitude + " lon " + mMyLongitude);
147+
updateDescription();
146148
}
147149

148150
@Override
@@ -168,7 +170,6 @@ private void setupListeners() {
168170
myCurrentAzimuth.start();
169171
}
170172

171-
172173
private void setupLayout() {
173174
descriptionTextView = (TextView) findViewById(R.id.cameraTextView);
174175

0 commit comments

Comments
 (0)