Appolica / InteractiveInfoWindowAndroid

Library project, developed and maintained by Appolica, offering an interactive info window for Google maps on Android.
249 stars 56 forks source link

Fixed issue 35 on main repo by setting state of the InfoWindow in propagateShowEvent #36

Closed thederputy closed 5 years ago

thederputy commented 6 years ago

I'm not sure why this doesn't already exist. What's the point of keeping state in the InfoWindow if it doesn't get updated? There should be no reason for a library user to have to do:

final InfoWindowManager infoWindowManager = new InfoWindowManager(getFragmentManager());
infoWindowManager.setWindowShowListener(new InfoWindowManager.WindowShowListener() {
            @Override
            public void onWindowShowStarted(@NonNull InfoWindow infoWindow) {
                infoWindow.setWindowState(InfoWindow.State.SHOWING);
            }

            @Override
            public void onWindowShown(@NonNull InfoWindow infoWindow) {
                infoWindow.setWindowState(InfoWindow.State.SHOWN);
            }

            @Override
            public void onWindowHideStarted(@NonNull InfoWindow infoWindow) {
                infoWindow.setWindowState(InfoWindow.State.HIDING);
            }

            @Override
            public void onWindowHidden(@NonNull InfoWindow infoWindow) {
                infoWindow.setWindowState(InfoWindow.State.HIDDEN);
            }
        });

just to get the state updated.

NOTE: this only makes the change for animated show and all hides. Non-animated show (the else in internalShow) does not call propagateShowEvent, therefore the state does not get changed and the listener does not fire. This should be handled in a separate issue.