This repository has been archived by the owner on Aug 8, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
OnCameraIdle hook into quickzoom gesture #9339
Merged
tobrun
merged 4 commits into
release-ios-v3.6.0-android-v5.1.0
from
9320-quick-zoom-trigger-camera-idle
Jun 29, 2017
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ public class CameraPositionActivity extends AppCompatActivity implements OnMapRe | |
|
||
private MapView mapView; | ||
private MapboxMap mapboxMap; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
cc/ @tobrun There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. That is a requirement for our autogenerated tests, see https://github.com/mapbox/mapbox-gl-native/blob/master/platform/android/MapboxGLAndroidSDKTestApp/src/androidTest/java/com/mapbox/mapboxsdk/testapp/utils/OnMapReadyIdlingResource.java#L43 where we use reflection on the mapboxMap field. In this specific case we could easily make it accessed by mapboxMap invocations below. |
||
private FloatingActionButton fab; | ||
|
||
@Override | ||
protected void onCreate(Bundle savedInstanceState) { | ||
|
@@ -40,13 +41,14 @@ protected void onCreate(Bundle savedInstanceState) { | |
} | ||
|
||
@Override | ||
public void onMapReady(@NonNull final MapboxMap mapboxMap) { | ||
this.mapboxMap = mapboxMap; | ||
public void onMapReady(@NonNull final MapboxMap map) { | ||
mapboxMap = map; | ||
|
||
mapboxMap.setOnCameraIdleListener(new MapboxMap.OnCameraIdleListener() { | ||
@Override | ||
public void onCameraIdle() { | ||
Timber.e("OnCameraIdle"); | ||
fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_green_dark)); | ||
} | ||
}); | ||
|
||
|
@@ -61,6 +63,7 @@ public void onCameraMoveCanceled() { | |
@Override | ||
public void onCameraMove() { | ||
Timber.e("OnCameraMove"); | ||
fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_orange_dark)); | ||
} | ||
}); | ||
|
||
|
@@ -71,12 +74,13 @@ public void onCameraMove() { | |
@Override | ||
public void onCameraMoveStarted(int reason) { | ||
// reason ranges from 1 <-> 3 | ||
fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, android.R.color.holo_red_dark)); | ||
Timber.e("OnCameraMoveStarted: %s", REASONS[reason - 1]); | ||
} | ||
}); | ||
|
||
// add a listener to FAB | ||
FloatingActionButton fab = (FloatingActionButton) findViewById(R.id.fab); | ||
fab = (FloatingActionButton) findViewById(R.id.fab); | ||
fab.setColorFilter(ContextCompat.getColor(CameraPositionActivity.this, R.color.primary)); | ||
fab.setOnClickListener(new View.OnClickListener() { | ||
@Override | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Guardiola31337 the removal of zoomstarted indicates that both scale as rotation can occur at the same time. I tried reimplementing to make it work but introduced too many changes. I'm punting on this for now, will write a follow up ticket.