private void callPlaceAutocompleteActivityIntent() { try { Intent intent = new PlaceAutocomplete.IntentBuilder(PlaceAutocomplete.MODE_FULLSCREEN) .build(this); startActivityForResult(intent, PLACE_AUTOCOMPLETE_REQUEST_CODE); //PLACE_AUTOCOMPLETE_REQUEST_CODE is integer for request code } catch (GooglePlayServicesRepairableException | GooglePlayServicesNotAvailableException e) { // TODO: Handle the error. } } @Override protected void onActivityResult(int requestCode, int resultCode, Intent data) { super.onActivityResult(requestCode, resultCode, data); //autocompleteFragment.onActivityResult(requestCode, resultCode, data); if (requestCode == PLACE_AUTOCOMPLETE_REQUEST_CODE) { if (resultCode == RESULT_OK) { Place place = PlaceAutocomplete.getPlace(this, data); Log.i(TAG, "Place:" + place.toString()); } else if (resultCode == PlaceAutocomplete.RESULT_ERROR) { Status status = PlaceAutocomplete.getStatus(this, data); Log.i(TAG, status.getStatusMessage()); } else if (requestCode == RESULT_CANCELED) { } } }
@Override protected void onBind() { super.onBind(); addRegisteredHandler(ResetPresentersEvent.getType(), this); addRegisteredHandler(RevealRootContentEvent.getType(), this); addRegisteredHandler(RevealRootLayoutContentEvent.getType(), this); addRegisteredHandler(RevealRootPopupContentEvent.getType(), this); addRegisteredHandler(LockInteractionEvent.getType(), this); } }
@Override public void onBootstrap() { placeManager.revealCurrentPlace(); } }
/** * Called whenever the user tries to access an page to which he doesn't have access, and we need to reveal the * user-defined unauthorized place. This method will detect infinite reveal loops and throw an {@link * RuntimeException} in that case. * * @param historyToken The history token that was not recognised. */ private void illegalAccess(String historyToken) { startError(); revealUnauthorizedPlace(historyToken); stopError(); }
/** * Called whenever an error occurred that requires the error page to be shown to the user. This method will detect * infinite reveal loops and throw an {@link RuntimeException} in that case. * * @param invalidHistoryToken The history token that was not recognised. */ private void error(String invalidHistoryToken) { startError(); revealErrorPlace(invalidHistoryToken); stopError(); }
@Override public boolean canReveal() { return gatekeeper.canReveal(); } }
@Override public boolean canReveal() { return gatekeeper.withParams(params).canReveal(); } }
@Override protected void failure(final Throwable caught) { // Unlock place manager to prevent UI "freeze" caused by LockInteractionEvent placeManager.unlock(); } });
@Override protected void dispatch(PlaceRequestInternalHandler handler) { handler.onPlaceRequest(this); } }
@Override protected void dispatch(AsyncCallStartHandler handler) { handler.onAsyncCallStart(this); } }
@Override protected void dispatch(AsyncCallFailHandler handler) { handler.onAsyncCallFail(this); } }
@Override protected void dispatch(RevealContentHandler<?> handler) { handler.onRevealContent(this); } }
@Override protected void dispatch(NavigationHandler handler) { handler.onNavigation(this); } }
@Override public final String toString() { return getNameToken(); } }
@Override protected void dispatch(LockInteractionHandler handler) { handler.onLockInteraction(this); } }
@Override protected void dispatch(RevealRootPopupContentHandler handler) { handler.onRevealRootPopupContent(this); } }
public PlaceManagerImpl( EventBus eventBus, TokenFormatter tokenFormatter, Historian historian) { this.eventBus = eventBus; this.tokenFormatter = tokenFormatter; this.historian = historian; registerTowardsHistory(); }
@Override protected void dispatch(RevealRootLayoutContentHandler handler) { handler.onRevealRootLayoutContent(this); } }