diff options
author | tobrun <tobrun.van.nuland@gmail.com> | 2018-10-29 15:43:46 +0100 |
---|---|---|
committer | Tobrun <tobrun@mapbox.com> | 2018-11-05 18:25:49 +0100 |
commit | 1c733568b0e14f0d2bb1b81fdf5527b300d039a4 (patch) | |
tree | c429aae4eeab7618fd985d192ed8f8e53653399e /platform/android/MapboxGLAndroidSDKTestApp/src/main/java | |
parent | 68fd3a28225cccf9f1564af9dec0151f13cc8700 (diff) | |
download | qtlocation-mapboxgl-1c733568b0e14f0d2bb1b81fdf5527b300d039a4.tar.gz |
[android] - expose moveBy, replace CameraUpdateFactory hook to moveBy for scrolling api
Diffstat (limited to 'platform/android/MapboxGLAndroidSDKTestApp/src/main/java')
-rw-r--r-- | platform/android/MapboxGLAndroidSDKTestApp/src/main/java/com/mapbox/mapboxsdk/testapp/activity/camera/ScrollByActivity.java | 22 |
1 files changed, 10 insertions, 12 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 4906559935..957f63329f 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 @@ -11,7 +11,6 @@ import android.support.v7.widget.Toolbar; import android.view.MenuItem; import android.widget.SeekBar; import android.widget.TextView; - import com.mapbox.mapboxsdk.camera.CameraUpdateFactory; import com.mapbox.mapboxsdk.maps.MapView; import com.mapbox.mapboxsdk.maps.MapboxMap; @@ -36,7 +35,7 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal super.onCreate(savedInstanceState); setContentView(R.layout.activity_scroll_by); - Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); + Toolbar toolbar = findViewById(R.id.toolbar); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); @@ -45,15 +44,15 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal actionBar.setDisplayShowHomeEnabled(true); } - seekBarX = (SeekBar) findViewById(R.id.seekbar_move_x); - TextView textViewX = (TextView) findViewById(R.id.textview_x); + seekBarX = findViewById(R.id.seekbar_move_x); + TextView textViewX = findViewById(R.id.textview_x); seekBarX.setOnSeekBarChangeListener(new PixelBarChangeListener(textViewX, R.string.scrollby_x_value)); - seekBarY = (SeekBar) findViewById(R.id.seekbar_move_y); - TextView textViewY = (TextView) findViewById(R.id.textview_y); + seekBarY = findViewById(R.id.seekbar_move_y); + TextView textViewY = findViewById(R.id.textview_y); seekBarY.setOnSeekBarChangeListener(new PixelBarChangeListener(textViewY, R.string.scrollby_y_value)); - mapView = (MapView) findViewById(R.id.mapView); + mapView = findViewById(R.id.mapView); mapView.setTag(true); mapView.onCreate(savedInstanceState); mapView.getMapAsync(this); @@ -65,11 +64,10 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal UiSettings uiSettings = mapboxMap.getUiSettings(); uiSettings.setLogoEnabled(false); uiSettings.setAttributionEnabled(false); - - FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); + FloatingActionButton fab = findViewById(R.id.fab); fab.setColorFilter(ContextCompat.getColor(ScrollByActivity.this, R.color.primary)); - fab.setOnClickListener(view -> mapboxMap.easeCamera(CameraUpdateFactory.scrollBy( - seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, + fab.setOnClickListener(view -> mapboxMap.easeCamera( + CameraUpdateFactory.scrollBy(seekBarX.getProgress() * MULTIPLIER_PER_PIXEL, seekBarY.getProgress() * MULTIPLIER_PER_PIXEL) )); } @@ -133,7 +131,7 @@ public class ScrollByActivity extends AppCompatActivity implements OnMapReadyCal private int prefixTextResource; private TextView valueView; - public PixelBarChangeListener(@NonNull TextView textView, @StringRes int textRes) { + PixelBarChangeListener(@NonNull TextView textView, @StringRes int textRes) { valueView = textView; prefixTextResource = textRes; } |