[android] Keep CompassView's state up to date when compass is enabled. (#15606)
* [android] Keep CompassView's state up to date when compass is enabled. * [android] Add unit test for updating compass view. * [android] Add change log.
This commit is contained in:
@@ -417,10 +417,6 @@ public final class UiSettings {
|
||||
}
|
||||
|
||||
void update(@NonNull CameraPosition cameraPosition) {
|
||||
if (!isCompassEnabled()) {
|
||||
return;
|
||||
}
|
||||
|
||||
double clockwiseBearing = -cameraPosition.bearing;
|
||||
compassView.update(clockwiseBearing);
|
||||
}
|
||||
@@ -1073,6 +1069,7 @@ public final class UiSettings {
|
||||
*/
|
||||
public void invalidate() {
|
||||
setLogoMargins(getLogoMarginLeft(), getLogoMarginTop(), getLogoMarginRight(), getLogoMarginBottom());
|
||||
setCompassEnabled(isCompassEnabled());
|
||||
setCompassMargins(getCompassMarginLeft(), getCompassMarginTop(), getCompassMarginRight(), getCompassMarginBottom());
|
||||
setAttributionMargins(getAttributionMarginLeft(), getAttributionMarginTop(), getAttributionMarginRight(),
|
||||
getAttributionMarginBottom());
|
||||
|
||||
@@ -91,6 +91,7 @@ public final class CompassView extends ImageView implements Runnable {
|
||||
resetAnimation();
|
||||
setAlpha(1.0f);
|
||||
setVisibility(View.VISIBLE);
|
||||
update(rotation);
|
||||
} else {
|
||||
resetAnimation();
|
||||
setAlpha(0.0f);
|
||||
|
||||
Reference in New Issue
Block a user