diff options
author | Tobrun <tobrun.van.nuland@gmail.com> | 2016-08-17 08:53:33 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-08-17 08:53:33 +0200 |
commit | fff0ebaa1754aabd9584c994624b7b948bec95af (patch) | |
tree | 745006b1a761856e6651738cd7d26e0e08c6cbbf /platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java | |
parent | 0062cf2f949fe1b0080e2de45aaf0b3d5e028bf3 (diff) | |
download | qtlocation-mapboxgl-fff0ebaa1754aabd9584c994624b7b948bec95af.tar.gz |
5859 generate sanity tests (#5870)
* [android] #5859 - generate espresso tests
[android] #5859 - cleanup xml files, use all the same resource id for map view
[android] #5859 - update scripts
[android] #5859 - update Activity to match mapboxMap naming
[android] #5859 - make SurfaceViewMediaControlActivity compatible
[android] #5859 - make MarkerViewScaleActivity test generation compatible
[android] #5859 - make PolygonActivity test generation compatible
[android] #5859 - integration within make file
[android] #5859 - made CameraPostion generation safe
[android] #5859 - generate sanity test
[android] #5859 - add generated test cases
[android] #5859 - add documentation
* [android] #5859 - remove generated files, introduce gen package, added gitignore to package
* [android] #5859 - regenerated test code
* [android] #5859 - added AWS gradle plugin + bitrise configuration
* [android] #5859 - fixes running locally without having the properties configured
* [android] #6010 - remove python from android sdk
* [android] #5859 - update docs about aws gradle plugin
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java | 63 |
1 files changed, 32 insertions, 31 deletions
diff --git a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java index 729a08758e..1154cccb6e 100644 --- a/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java +++ b/platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java @@ -20,11 +20,13 @@ import com.mapbox.mapboxsdk.maps.OnMapReadyCallback; import com.mapbox.mapboxsdk.maps.UiSettings; import com.mapbox.mapboxsdk.testapp.R; -public class ScrollByActivity extends AppCompatActivity { +public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCallback { public static final int MULTIPLIER_PER_PIXEL = 50; - private MapView mMapView; + private MapView mapView; + private MapboxMap mapboxMap; + private SeekBar xBar, yBar; @Override protected void onCreate(Bundle savedInstanceState) { @@ -40,35 +42,36 @@ public class ScrollByActivity extends AppCompatActivity { actionBar.setDisplayShowHomeEnabled(true); } - final SeekBar xBar = (SeekBar) findViewById(R.id.seekbar_move_x); + xBar = (SeekBar) findViewById(R.id.seekbar_move_x); TextView xText = (TextView) findViewById(R.id.textview_x); xBar.setOnSeekBarChangeListener(new PixelBarChangeListener(xText, R.string.scrollby_x_value)); - final SeekBar yBar = (SeekBar) findViewById(R.id.seekbar_move_y); + yBar = (SeekBar) findViewById(R.id.seekbar_move_y); TextView yText = (TextView) findViewById(R.id.textview_y); yBar.setOnSeekBarChangeListener(new PixelBarChangeListener(yText, R.string.scrollby_y_value)); - mMapView = (MapView) findViewById(R.id.mapView); - mMapView.setTag(true); - mMapView.onCreate(savedInstanceState); - mMapView.getMapAsync(new OnMapReadyCallback() { + mapView = (MapView) findViewById(R.id.mapView); + mapView.setTag(true); + mapView.onCreate(savedInstanceState); + mapView.getMapAsync(this); + } + + @Override + public void onMapReady(MapboxMap map) { + mapboxMap = map; + UiSettings uiSettings = mapboxMap.getUiSettings(); + uiSettings.setLogoEnabled(false); + uiSettings.setAttributionEnabled(false); + + FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + fab.setColorFilter(ContextCompat.getColor(ScrollByActivity.this, R.color.primary)); + fab.setOnClickListener(new View.OnClickListener() { @Override - public void onMapReady(@NonNull final MapboxMap mapboxMap) { - UiSettings uiSettings = mapboxMap.getUiSettings(); - uiSettings.setLogoEnabled(false); - uiSettings.setAttributionEnabled(false); - - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); - fab.setColorFilter(ContextCompat.getColor(ScrollByActivity.this, R.color.primary)); - fab.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( - xBar.getProgress() * MULTIPLIER_PER_PIXEL, - yBar.getProgress() * MULTIPLIER_PER_PIXEL) - ); - } - }); + public void onClick(View v) { + mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( + xBar.getProgress() * MULTIPLIER_PER_PIXEL, + yBar.getProgress() * MULTIPLIER_PER_PIXEL) + ); } }); } @@ -76,31 +79,31 @@ public class ScrollByActivity extends AppCompatActivity { @Override public void onResume() { super.onResume(); - mMapView.onResume(); + mapView.onResume(); } @Override public void onPause() { super.onPause(); - mMapView.onPause(); + mapView.onPause(); } @Override protected void onSaveInstanceState(Bundle outState) { super.onSaveInstanceState(outState); - mMapView.onSaveInstanceState(outState); + mapView.onSaveInstanceState(outState); } @Override protected void onDestroy() { super.onDestroy(); - mMapView.onDestroy(); + mapView.onDestroy(); } @Override public void onLowMemory() { super.onLowMemory(); - mMapView.onLowMemory(); + mapView.onLowMemory(); } @Override @@ -141,6 +144,4 @@ public class ScrollByActivity extends AppCompatActivity { } } - - }
\ No newline at end of file |