libandroid-navigation-ui/src/main/java/com/mapbox/services/android/navigation/ui/v5/instruction/InstructionView.java
public void subscribe(NavigationViewModel navigationViewModel) {
    this.navigationViewModel = navigationViewModel;
    LifecycleOwner owner = (LifecycleOwner) getContext();
    navigationViewModel.instructionModel.observe(owner, new Observer<InstructionModel>() {
      @Override
      public void onChanged(@Nullable InstructionModel model) {
        if (model != null) {
          updateViews(model);
        }
      }
    });
    navigationViewModel.bannerInstructionModel.observe(owner, new Observer<BannerInstructionModel>() {
      @Override
      public void onChanged(@Nullable BannerInstructionModel bannerInstructionModel) {
        if (bannerInstructionModel != null) {
          updateTextInstruction(bannerInstructionModel);
        }
      }
    });
    navigationViewModel.isOffRoute.observe(owner, new Observer<Boolean>() {
      @Override
      public void onChanged(@Nullable Boolean isOffRoute) {
        if (isOffRoute != null) {
          if (isOffRoute) {
            showRerouteState();
            instructionListAdapter.clear();
          } else if (isRerouting) {
            hideRerouteState();
            showAlertView();
          }
          isRerouting = isOffRoute;
        }
      }
    });

    // ViewModel set - click listeners can be set now
    initClickListeners();
  }
/**
   * Subscribes to a {@link NavigationViewModel} for
   * updates from {@link android.arch.lifecycle.LiveData}.
   * <p>
   * Updates all views with fresh data / shows &amp; hides re-route state.
   *
   * @param navigationViewModel to which this View is subscribing
   * @since 0.6.2
   */
Subscribes to a  NavigationViewModel for
updates from  android.arch.lifecycle.LiveData.

Updates all views with fresh data / shows & hides re-route state.

@param navigationViewModel to which this View is subscribing
@since 0.6.2
Subscribes to a NavigationViewModel for updates from android . arch . lifecycle . LiveData . Updates all views with fresh data / shows & hides re - route state . @param navigationViewModel to which this View is subscribing @since 0 . 6 . 2
public void subscribe(NavigationViewModel navigationViewModel) {
    this.navigationViewModel = navigationViewModel;
    LifecycleOwner owner = (LifecycleOwner) getContext();
    navigationViewModel.instructionModel.observe(owner, new Observer<InstructionModel>() {
      @Override
      public void onChanged(@Nullable InstructionModel model) {
        if (model != null) {
          updateViews(model);
        }
      }
    });
    navigationViewModel.bannerInstructionModel.observe(owner, new Observer<BannerInstructionModel>() {
      @Override
      public void onChanged(@Nullable BannerInstructionModel bannerInstructionModel) {
        if (bannerInstructionModel != null) {
          updateTextInstruction(bannerInstructionModel);
        }
      }
    });
    navigationViewModel.isOffRoute.observe(owner, new Observer<Boolean>() {
      @Override
      public void onChanged(@Nullable Boolean isOffRoute) {
        if (isOffRoute != null) {
          if (isOffRoute) {
            showRerouteState();
            instructionListAdapter.clear();
          } else if (isRerouting) {
            hideRerouteState();
            showAlertView();
          }
          isRerouting = isOffRoute;
        }
      }
    });
    initClickListeners();
  }
public void subscribe ( NavigationViewModel navigationViewModel ) { this . navigationViewModel = navigationViewModel ; LifecycleOwner owner = ( LifecycleOwner ) getContext ( ) ; navigationViewModel . instructionModel . observe ( owner , new Observer < InstructionModel > ( ) { @ Override public void onChanged ( @ Nullable InstructionModel model ) { if ( model != null ) { updateViews ( model ) ; } } } ) ; navigationViewModel . bannerInstructionModel . observe ( owner , new Observer < BannerInstructionModel > ( ) { @ Override public void onChanged ( @ Nullable BannerInstructionModel bannerInstructionModel ) { if ( bannerInstructionModel != null ) { updateTextInstruction ( bannerInstructionModel ) ; } } } ) ; navigationViewModel . isOffRoute . observe ( owner , new Observer < Boolean > ( ) { @ Override public void onChanged ( @ Nullable Boolean isOffRoute ) { if ( isOffRoute != null ) { if ( isOffRoute ) { showRerouteState ( ) ; instructionListAdapter . clear ( ) ; } else if ( isRerouting ) { hideRerouteState ( ) ; showAlertView ( ) ; } isRerouting = isOffRoute ; } } } ) ; initClickListeners ( ) ; }
Subscribes to a {@link NavigationViewModel} for
 updates from {@link android.arch.lifecycle.LiveData}.
Subscribes to a { @link NavigationViewModel } for updates from { @link android . arch . lifecycle . LiveData } .
// ViewModel set - click listeners can be set now