Skip to content

Commit

Permalink
Hud10837/fixes for sample viewer release (Esri#830)
Browse files Browse the repository at this point in the history
* add recenter on button click slh

* edit attribution view change layout stuff

* change snackbar to toast

* remove animation on fab

* remove return in slh

* update java avc
  • Loading branch information
hud10837 authored Jun 23, 2020
1 parent 6b2637e commit d49b6d7
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -44,14 +44,13 @@ protected void onCreate(Bundle savedInstanceState) {

// create a FAB to respond to attribution bar
FloatingActionButton mFab = findViewById(R.id.floatingActionButton);
mFab.setOnClickListener(v -> Snackbar.make(v, "Button responds to attribution bar", Snackbar.LENGTH_LONG)
.setAction("Action", null).show());
mFab.setOnClickListener(v -> Toast.makeText(this, "Tap the attribution bar to expand it.", Toast.LENGTH_LONG).show());

// set attribution bar listener
mMapView.addAttributionViewLayoutChangeListener(
(v, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom) -> {
int heightDelta = oldBottom - bottom;
mFab.animate().translationYBy(heightDelta);
mFab.setY(mFab.getY() + heightDelta);
Toast.makeText(MainActivity.this, "new bounds [" + left + ',' + top + ',' + right + ',' + bottom + ']' +
" old bounds [" + oldLeft + ',' + oldTop + ',' + oldRight + ',' + oldBottom + ']', Toast.LENGTH_SHORT)
.show();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,15 +38,14 @@ class MainActivity : AppCompatActivity() {
mapView.map = map

// create a FAB to respond to attribution bar
fab.setOnClickListener { view ->
Snackbar.make(view, resources.getString(R.string.message), Snackbar.LENGTH_LONG)
.setAction("Action", null).show()
fab.setOnClickListener {
Toast.makeText(this@MainActivity, "Tap the attribution bar to expand it.", Toast.LENGTH_LONG).show()
}

// set attribution bar listener
mapView.addAttributionViewLayoutChangeListener { _, left, top, right, bottom, oldLeft, oldTop, oldRight, oldBottom ->
val heightDelta = oldBottom - bottom
fab.animate().translationYBy(heightDelta.toFloat())
fab.y += heightDelta
Toast.makeText(
this@MainActivity,
"new bounds [$left,$top,$right,$bottom] old bounds [$oldLeft,$oldTop,$oldRight,$oldBottom]",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="com.esri.arcgisruntime.sample.attributionchange.MainActivity">
tools:context="com.esri.arcgisruntime.sample.attributionviewchange.MainActivity">

<!-- MapView -->
<com.esri.arcgisruntime.mapping.view.MapView
android:id="@+id/mapView"
android:layout_width="match_parent"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -102,8 +102,13 @@ class MainActivity : AppCompatActivity() {
initialZoomScale = 7000.0
}

// change the isTrackLocation flag and the button's icon
// reset location display and change the isTrackLocation flag and the button's icon
button.setOnClickListener {
// if the user has panned away from the location display, turn it on again
if (mapView.locationDisplay.autoPanMode == LocationDisplay.AutoPanMode.OFF) {
mapView.locationDisplay.autoPanMode = LocationDisplay.AutoPanMode.RECENTER
}

if (isTrackLocation) {
isTrackLocation = false
button.setImageResource(R.drawable.ic_my_location_white_24dp)
Expand Down

0 comments on commit d49b6d7

Please sign in to comment.