[android] - remove timer from compassView, make fading when facing north optional. (#6786)

save state for recreating map view

fix review comments

unit test covering default value for fading and setting a new value

fixup setter, fix default value
This commit is contained in:
Tobrun
2016-10-25 15:53:16 +02:00
committed by GitHub
parent 94b1a53f06
commit b0485bccd9
11 changed files with 165 additions and 76 deletions

View File

@@ -58,6 +58,7 @@ public class PolygonActivity extends AppCompatActivity implements OnMapReadyCall
.attributionTintColor(RED_COLOR)
// deprecated feature!
.textureMode(true)
.compassFadesWhenFacingNorth(false)
.styleUrl(Style.MAPBOX_STREETS)
.camera(new CameraPosition.Builder()
.target(new LatLng(45.520486, -122.673541))

View File

@@ -28,6 +28,7 @@
android:layout_height="match_parent"
app:center_latitude="51.506675"
app:center_longitude="-0.128699"
app:compass_fade_facing_north="false"
app:direction="90"
app:tilt="40"
app:zoom="10" />

View File

@@ -7,6 +7,7 @@ import org.junit.Test;
import org.mockito.InjectMocks;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertFalse;
import static org.junit.Assert.assertNotNull;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.mock;
@@ -56,6 +57,13 @@ public class UiSettingsTest {
assertTrue("Compass margin bottom should be same", uiSettings.getCompassMarginBottom() == 4);
}
@Test
public void testCompassFadeWhenFacingNorth(){
assertTrue("Compass should fade when facing north by default.", uiSettings.isCompassFadeWhenFacingNorth());
uiSettings.setCompassFadeFacingNorth(false);
assertFalse("Compass fading should be disabled", uiSettings.isCompassFadeWhenFacingNorth());
}
@Test
public void testLogoEnabled() {
uiSettings.setLogoEnabled(true);