@Override
 public void onHistoryItemSelected(HistoryItem item) {
   TranslationDirection direction = new TranslationDirection(item.getLang());
   App.getInstance().setTranslationDirection(direction);
   mLanguagePicker.updateDirection();
   mOriginalTextInput.setText(item.getOriginal());
   mScrollView.scrollTo(0, 0);
 }
  public Observable<TranslationTask> getTranslationTaskObservable() {
    Observable<String> originalTextObservable =
        RxTextView.textChanges(mOriginalTextInput).map(CharSequence::toString);
    Observable<TranslationDirection> languageDirectionObservable = mLanguagePicker.getObservable();

    return Observable.combineLatest(
        languageDirectionObservable,
        originalTextObservable,
        (direction, text) -> new TranslationTask(text, direction));
  }
  @Override
  public void onDetectedLanguageClicked(DetectedLanguage detectedLanguage) {
    TranslationDirection currentDirection = App.getInstance().getTranslationDirection();

    if (currentDirection.getTo().equals(detectedLanguage.getLanguage())) {
      currentDirection.swap();
      App.getInstance().setTranslationDirection(currentDirection);
    } else {
      App.getInstance()
          .setTranslationDirection(
              new TranslationDirection(detectedLanguage.getLanguage(), currentDirection.getFrom()));
    }

    mLanguagePicker.updateDirection();
  }