Skip to content

Commit

Permalink
Maintain spinner state on screen rotation in line styling demos
Browse files Browse the repository at this point in the history
Change-Id: Ide8749b1061890316651fbb32dfbc435d67cdf6f
  • Loading branch information
stephenmcd committed Mar 16, 2017
1 parent 33f310a commit b8d8fb1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -252,6 +252,11 @@ public void onCircleClick(Circle circle) {
circle.setStrokeColor(circle.getStrokeColor() ^ 0x00ffffff);
}
});

List<PatternItem> pattern = getSelectedPattern(mStrokePatternSpinner.getSelectedItemPosition());
for (DraggableCircle draggableCircle : mCircles) {
draggableCircle.setStrokePattern(pattern);
}
}

private List<PatternItem> getSelectedPattern(int pos) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,9 @@ public void onMapReady(GoogleMap map) {
mStrokeJointTypeSpinner.setOnItemSelectedListener(this);
mStrokePatternSpinner.setOnItemSelectedListener(this);

mMutablePolygon.setStrokeJointType(getSelectedJointType(mStrokeJointTypeSpinner.getSelectedItemPosition()));
mMutablePolygon.setStrokePattern(getSelectedPattern(mStrokePatternSpinner.getSelectedItemPosition()));

// Move the map so that it is centered on the mutable polygon.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(CENTER, 4));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ private String[] getResourceStrings(int[] resourceIds) {

@Override
public void onMapReady(GoogleMap map) {

// Override the default content description on the view, for accessibility mode.
map.setContentDescription(getString(R.string.polyline_demo_description));

Expand Down Expand Up @@ -199,6 +200,11 @@ public void onMapReady(GoogleMap map) {
mJointTypeSpinner.setOnItemSelectedListener(this);
mPatternSpinner.setOnItemSelectedListener(this);

mMutablePolyline.setStartCap(getSelectedCap(mStartCapSpinner.getSelectedItemPosition()));
mMutablePolyline.setEndCap(getSelectedCap(mEndCapSpinner.getSelectedItemPosition()));
mMutablePolyline.setJointType(getSelectedJointType(mJointTypeSpinner.getSelectedItemPosition()));
mMutablePolyline.setPattern(getSelectedPattern(mPatternSpinner.getSelectedItemPosition()));

// Move the map so that it is centered on the mutable polyline.
map.moveCamera(CameraUpdateFactory.newLatLngZoom(MELBOURNE, 3));

Expand Down

0 comments on commit b8d8fb1

Please sign in to comment.