@Override
 public void onSaveInstanceState(Bundle outState) {
   if (courseData != null) outState.putSerializable(Router.EXTRA_ENROLLMENT, courseData);
   if (courseComponentId != null)
     outState.putString(Router.EXTRA_COURSE_COMPONENT_ID, courseComponentId);
   super.onSaveInstanceState(outState);
 }
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState == null) {
      sortOptions.putOrder(SortOrder.LABEL);

      FragmentTransaction transaction = getChildFragmentManager().beginTransaction();

      favoritesController = FavoritesControllerFragment_.builder().build();
      transaction.replace(
          R.id.resource_controller, favoritesController, FavoritesControllerFragment.TAG);

      FavoritesSearchFragment searchFragment = FavoritesSearchFragment_.builder().build();
      transaction.replace(R.id.search_controller, searchFragment);

      transaction.commit();

      analytics.sendEvent(
          Analytics.EventCategory.CATALOG.getValue(),
          Analytics.EventAction.VIEWED.getValue(),
          Analytics.EventLabel.FAVORITES.getValue());
    } else {
      favoritesController =
          (FavoritesControllerFragment)
              getChildFragmentManager().findFragmentByTag(FavoritesControllerFragment.TAG);
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    //  setupRecyclerView();

  }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (book != null) {
      bookTitleView.setText(book.getFilename());
      String imageUrl = book.getImageUrl();
      if (!TextUtils.isEmpty(imageUrl)) {
        Picasso.with(getActivity()).load(imageUrl).into(bookImageView);
      }

      downloadButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              downloadManager.download(book);
            }
          });
    }

    if (optimizedBooks.size() > 0) {
      optimizedBooksContainer.setVisibility(View.VISIBLE);
      for (OptimizedBook optimizedBook : optimizedBooks) {
        LayoutInflater layoutInflater = getLayoutInflater(savedInstanceState);
        View optimizedBookView = createOptimizedBookView(layoutInflater, optimizedBook);
        optimizedBooksList.addView(optimizedBookView);
      }
    } else {
      optimizedBooksContainer.setVisibility(View.GONE);
    }
  }
  @Override
  public void onActivityCreated(Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);
    if (courseData == null || !isCoursewareAccessible) return;

    final String headerImageUrl = courseData.getCourse().getCourse_image(environment.getConfig());
    Glide.with(CourseDashboardFragment.this)
        .load(headerImageUrl)
        .placeholder(R.drawable.edx_map_login)
        .transform(new TopAnchorFillWidthTransformation(getActivity()))
        .into(headerImageView);

    courseTextName.setText(courseData.getCourse().getName());
    CourseEntry course = courseData.getCourse();
    courseTextDetails.setText(course.getDescription(getActivity(), true));

    if (environment.getConfig().isShareCourseEnabled()) {
      shareButton.setVisibility(headerImageView.VISIBLE);
      shareButton.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              openShareMenu();
            }
          });
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    final Bundle args = getArguments();
    courseData = (EnrolledCoursesResponse) args.getSerializable(CourseData);
    if (courseData != null) {
      isCoursewareAccessible = courseData.getCourse().getCoursewareAccess().hasAccess();
    }
  }
  @Override
  public void onResume() {
    super.onResume();
    uiLifecycleHelper.onResume();

    if (getView() != null) {
      TextView groups_tv = (TextView) getView().findViewById(R.id.drawer_option_my_groups);
      boolean allowSocialFeatures =
          socialPref.getBoolean(PrefManager.Key.ALLOW_SOCIAL_FEATURES, true);
      groups_tv.setVisibility(allowSocialFeatures ? View.VISIBLE : View.GONE);
    }
  }
  @Override
  public void onSaveInstanceState(Bundle outState) {

    Set<Long> toInvite = friendListAdapter.getSelectedList();
    Long inviteLongArray[] = toInvite.toArray(new Long[toInvite.size()]);

    Set<Long> alreadyGrouped = friendListAdapter.getAlreadyInGroupList();
    Long alreadyGroupedLongArray[] = alreadyGrouped.toArray(new Long[alreadyGrouped.size()]);

    outState.putParcelableArrayList(
        FRIEND_LIST_MODELS, new ArrayList<Parcelable>(friendListAdapter.getItems()));
    outState.putLongArray(FRIEND_LIST_STATES, JavaUtil.toPrimitive(inviteLongArray));
    outState.putLongArray(
        FRIEND_LIST_ALREADY_IN_GROUP, JavaUtil.toPrimitive(alreadyGroupedLongArray));

    super.onSaveInstanceState(outState);
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    try {
      String filename = getArgumentFilename();
      book = bookDaoHelper.dao().queryForId(filename).toBook();
      List<OptimizedBookRecord> optimizedBookRecords = optimizedBookDaoHelper.dao().queryForAll();
      for (OptimizedBookRecord optimizedBookRecord : optimizedBookRecords) {
        if (optimizedBookRecord.getFilename().endsWith(filename)) {
          optimizedBooks.add(optimizedBookRecord.toOptimizedBook());
        }
      }
    } catch (SQLException e) {
      LOG.error(e.getMessage(), e);
    }
  }
  @Override
  public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    doneMenuItem = menu.findItem(R.id.done_btn);
    doneMenuItem.setVisible(true);

    doneMenuItem
        .getActionView()
        .setOnClickListener(
            new View.OnClickListener() {

              @Override
              public void onClick(View view) {
                onDone();
              }
            });
    refreshMenu();
  }
  @Override
  public void onActivityCreated(@Nullable Bundle savedInstanceState) {
    super.onActivityCreated(savedInstanceState);

    if (savedInstanceState != null) {
      ArrayList<SocialMember> friends =
          savedInstanceState.getParcelableArrayList(FRIEND_LIST_MODELS);

      friendListAdapter.setItems(friends);

      // Restore the saved selected set
      long[] selected = savedInstanceState.getLongArray(FRIEND_LIST_STATES);
      if (selected != null) {
        friendListAdapter.setSelectedList(JavaUtil.primitiveLongToSet(selected));
      }
      // Restore the saved already in group set
      long[] alreadyInGroup = savedInstanceState.getLongArray(FRIEND_LIST_ALREADY_IN_GROUP);
      if (alreadyInGroup != null) {
        friendListAdapter.setAlreadyInGroupList(JavaUtil.primitiveLongToSet(alreadyInGroup));
      }
      refreshPage(State.LOADED);
    } else if (getArguments() != null && getArguments().containsKey(EXTRA_OPT_FRIENDS_LIST)) {
      List<SocialMember> friends = getArguments().getParcelableArrayList(EXTRA_OPT_FRIENDS_LIST);
      friendListAdapter.setItems(friends);
      refreshPage(State.LOADED);
    } else {
      friendProvider.getMyFriends(getActivity(), this);
      refreshPage(State.LOADING);
    }

    // Retrieve the already in group list
    if (getArguments() != null && getArguments().containsKey(EXTRA_OPT_IN_GROUP)) {

      long[] alreadyInGroup = getArguments().getLongArray(EXTRA_OPT_IN_GROUP);
      friendListAdapter.setAlreadyInGroupList(JavaUtil.primitiveLongToSet(alreadyInGroup));
    }
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {

    super.onCreate(savedInstanceState);

    setHasOptionsMenu(true);

    friendProvider = new FacebookProvider();
    friendListAdapter = new FriendListAdapter(getActivity());
    friendListAdapter.setOnSelectChangeListener(
        new FriendListAdapter.OnSelectedItemCountChangeListener() {

          @Override
          public void onSelectionItemCountChange(int itemSelectCount) {
            refreshMenu();
          }
        });

    try {
      segIO.screenViewsTracking("Social Friend Picker");
    } catch (Exception e) {
      logger.error(e);
    }
  }
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
 }
 @Override
 public void onPause() {
   super.onPause();
   searchText.clearFocus();
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   logger.debug("ProgramInfoFragment onCreate");
   super.onCreate(savedInstanceState);
 }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    if (isCoursewareAccessible) {
      final LayoutInflater inflater = LayoutInflater.from(getActivity());

      if (courseData.isCertificateEarned()
          && environment.getConfig().areCertificateLinksEnabled()) {
        final View child = inflater.inflate(R.layout.row_course_dashboard_cert, parent, false);
        child
            .findViewById(R.id.get_certificate)
            .setOnClickListener(
                new View.OnClickListener() {
                  @Override
                  public void onClick(View v) {
                    environment.getRouter().showCertificate(getActivity(), courseData);
                  }
                });
        parent.addView(child);
      }

      // Implementation Note: - we can create a list view and populate the list.
      // but as number of rows are fixed and each row is different. the only common
      // thing is UI layout. so we reuse the same UI layout programmatically here.
      ViewHolder holder = createViewHolder(inflater, parent);

      holder.typeView.setIcon(Iconify.IconValue.fa_list_alt);
      holder.titleView.setText(R.string.courseware_title);
      holder.subtitleView.setText(R.string.courseware_subtitle);
      holder.rowView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              environment.getRouter().showCourseContainerOutline(getActivity(), courseData);
            }
          });

      if (courseData != null
          && !TextUtils.isEmpty(courseData.getCourse().getDiscussionUrl())
          && environment.getConfig().isDiscussionsEnabled()) {
        holder = createViewHolder(inflater, parent);

        holder.typeView.setIcon(Iconify.IconValue.fa_comments_o);
        holder.titleView.setText(R.string.discussion_title);
        holder.subtitleView.setText(R.string.discussion_subtitle);
        holder.rowView.setOnClickListener(
            new View.OnClickListener() {
              @Override
              public void onClick(View v) {
                environment.getRouter().showCourseDiscussionTopics(getActivity(), courseData);
              }
            });
      }

      holder = createViewHolder(inflater, parent);

      holder.typeView.setIcon(Iconify.IconValue.fa_file_text_o);
      holder.titleView.setText(R.string.handouts_title);
      holder.subtitleView.setText(R.string.handouts_subtitle);
      holder.rowView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (courseData != null)
                environment.getRouter().showHandouts(getActivity(), courseData);
            }
          });

      holder = createViewHolder(inflater, parent);

      holder.typeView.setIcon(Iconify.IconValue.fa_bullhorn);
      holder.titleView.setText(R.string.announcement_title);
      holder.subtitleView.setText(R.string.announcement_subtitle);
      holder.rowView.setOnClickListener(
          new View.OnClickListener() {
            @Override
            public void onClick(View v) {
              if (courseData != null)
                environment.getRouter().showCourseAnnouncement(getActivity(), courseData);
            }
          });
    } else {
      errorText.setText(R.string.course_not_started);
    }
  }
 @Override
 public void onActivityCreated(Bundle savedInstanceState) {
   super.onActivityCreated(savedInstanceState);
   actorsGridView.setAdapter(actorsGridViewAdapter);
 }
 @Override
 public void onPause() {
   super.onPause();
   uiLifecycleHelper.onPause();
 }
 @Override
 public void onActivityResult(int requestCode, int resultCode, Intent data) {
   super.onActivityResult(requestCode, resultCode, data);
   uiLifecycleHelper.onActivityResult(requestCode, resultCode, data);
 }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    getActivity().setTitle(formField.getLabel());
    final List<FormOption> options = new ArrayList<>();
    final FormOptions formOptions = formField.getOptions();
    final ArrayAdapter<FormOption> adapter =
        new ArrayAdapter<>(getActivity(), R.layout.edx_selectable_list_item, options);
    if (formOptions.getReference() != null) {
      new GetFormOptionsTask(getActivity(), formOptions.getReference()) {
        @Override
        protected void onSuccess(List<FormOption> formOptions) throws Exception {
          options.addAll(formOptions);
          adapter.notifyDataSetChanged();
          selectCurrentOption();
        }
      }.execute();

    } else if (formOptions.getRangeMin() != null && formOptions.getRangeMax() != null) {
      for (int i = formOptions.getRangeMax(); i >= formOptions.getRangeMin(); --i) {
        options.add(new FormOption(String.valueOf(i), String.valueOf(i)));
      }
    } else if (formOptions.getValues() != null && formOptions.getValues().size() > 0) {
      options.addAll(formOptions.getValues());
    }
    if (!TextUtils.isEmpty(formField.getInstructions())) {
      final View instructionsContainer =
          LayoutInflater.from(view.getContext())
              .inflate(R.layout.form_field_instructions_header, listView, false);
      final TextView instructions =
          (TextView) instructionsContainer.findViewById(R.id.instructions);
      final TextView subInstructions =
          (TextView) instructionsContainer.findViewById(R.id.sub_instructions);
      instructions.setText(formField.getInstructions());
      if (TextUtils.isEmpty(formField.getSubInstructions())) {
        subInstructions.setVisibility(View.GONE);
      } else {
        subInstructions.setText(formField.getSubInstructions());
      }
      listView.addHeaderView(instructionsContainer, null, false);
    }
    if (null != formField.getDataType()) {
      switch (formField.getDataType()) {
        case COUNTRY:
          {
            final Locale locale = Locale.getDefault();
            addDetectedValueHeader(
                listView,
                R.string.edit_user_profile_current_location,
                "current_location",
                locale.getDisplayCountry(),
                locale.getCountry(),
                FontAwesomeIcons.fa_map_marker);
            break;
          }
        case LANGUAGE:
          {
            final Locale locale = Locale.getDefault();
            addDetectedValueHeader(
                listView,
                R.string.edit_user_profile_current_language,
                "current_language",
                locale.getDisplayLanguage(),
                locale.getLanguage(),
                FontAwesomeIcons.fa_comment);
            break;
          }
      }
    }
    if (formField.getOptions().isAllowsNone()) {
      final TextView textView =
          (TextView)
              LayoutInflater.from(listView.getContext())
                  .inflate(R.layout.edx_selectable_list_item, listView, false);
      final String label = formField.getOptions().getNoneLabel();
      textView.setText(label);
      listView.addHeaderView(textView, new FormOption(label, null), true);
    }
    listView.setAdapter(adapter);
    listView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            final FormOption item = (FormOption) parent.getItemAtPosition(position);
            getActivity()
                .setResult(
                    Activity.RESULT_OK,
                    new Intent()
                        .putExtra(FormFieldActivity.EXTRA_FIELD, formField)
                        .putExtra(FormFieldActivity.EXTRA_VALUE, item.getValue()));
            getActivity().finish();
          }
        });
    selectCurrentOption();
  }
 @Override
 public void onResume() {
   super.onResume();
   updateCurrentProgramValues(programsService);
 }
 @Override
 public void onDestroy() {
   super.onDestroy();
   uiLifecycleHelper.onDestroy();
 }
 @Override
 public void onStop() {
   super.onStop();
   uiLifecycleHelper.onStop();
 }
 @Override
 public void onSaveInstanceState(Bundle outState) {
   super.onSaveInstanceState(outState);
   uiLifecycleHelper.onSaveInstanceState(outState);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
 }
 @Override
 public void onStop() {
   super.onStop();
   EventBus.getDefault().unregister(this);
 }
 @Override
 public void onCreate(Bundle savedInstanceState) {
   super.onCreate(savedInstanceState);
   uiLifecycleHelper = IUiLifecycleHelper.Factory.getInstance(getActivity(), callback);
   uiLifecycleHelper.onCreate(savedInstanceState);
 }
  @Override
  public void onViewCreated(View view, Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);

    final LayoutInflater inflater = LayoutInflater.from(getActivity());

    // Add "All posts" item
    {
      final TextView header =
          (TextView)
              inflater.inflate(R.layout.row_discussion_topic, discussionTopicsListView, false);
      header.setText(R.string.discussion_posts_filter_all_posts);

      final DiscussionTopic discussionTopic = new DiscussionTopic();
      discussionTopic.setIdentifier(DiscussionTopic.ALL_TOPICS_ID);
      discussionTopic.setName(getString(R.string.discussion_posts_filter_all_posts));
      discussionTopicsListView.addHeaderView(
          header, new DiscussionTopicDepth(discussionTopic, 0, true), true);
    }

    // Add "Posts I'm following" item
    {
      final TextView header =
          (TextView)
              inflater.inflate(R.layout.row_discussion_topic, discussionTopicsListView, false);
      header.setText(R.string.forum_post_i_am_following);
      TextViewCompat.setCompoundDrawablesRelativeWithIntrinsicBounds(
          header,
          new IconDrawable(getActivity(), Iconify.IconValue.fa_star)
              .colorRes(R.color.edx_grayscale_neutral_dark)
              .sizeRes(R.dimen.edx_base),
          null,
          null,
          null);
      final DiscussionTopic discussionTopic = new DiscussionTopic();
      discussionTopic.setIdentifier(DiscussionTopic.FOLLOWING_TOPICS_ID);
      discussionTopic.setName(getString(R.string.forum_post_i_am_following));
      discussionTopicsListView.addHeaderView(
          header, new DiscussionTopicDepth(discussionTopic, 0, true), true);
    }

    discussionTopicsListView.setAdapter(discussionTopicsAdapter);

    discussionTopicsSearchView.setOnQueryTextListener(
        new SearchView.OnQueryTextListener() {
          @Override
          public boolean onQueryTextSubmit(String query) {
            if (query == null || query.trim().length() == 0) return false;

            router.showCourseDiscussionPostsForSearchQuery(getActivity(), query, courseData);
            return true;
          }

          @Override
          public boolean onQueryTextChange(String newText) {
            return false;
          }
        });

    discussionTopicsListView.setOnItemClickListener(
        new AdapterView.OnItemClickListener() {
          @Override
          public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
            router.showCourseDiscussionPostsForDiscussionTopic(
                getActivity(),
                ((DiscussionTopicDepth) parent.getItemAtPosition(position)).getDiscussionTopic(),
                courseData);
          }
        });

    // TODO: Find a better way to hide the keyboard AND take the focus away from the SearchView
    discussionTopicsSearchView.requestFocus();
    discussionTopicsSearchView.clearFocus();

    getTopicList();
  }
  @Override
  public View onCreateView(
      LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    super.onCreateView(inflater, container, savedInstanceState);
    Context context = getActivity().getBaseContext();

    socialPref = new PrefManager(context, PrefManager.Pref.FEATURES);

    pref = new PrefManager(context, PrefManager.Pref.LOGIN);

    View layout = inflater.inflate(R.layout.drawer_navigation, null);

    TextView name_tv = (TextView) layout.findViewById(R.id.name_tv);
    TextView email_tv = (TextView) layout.findViewById(R.id.email_tv);

    TextView tvMyCourses = (TextView) layout.findViewById(R.id.drawer_option_my_courses);
    tvMyCourses.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            Activity act = getActivity();
            ((BaseFragmentActivity) act).closeDrawer();

            if (!(act instanceof MyCoursesListActivity)) {
              environment.getRouter().showMyCourses(act);
              act.finish();
            }
          }
        });

    TextView tvMyVideos = (TextView) layout.findViewById(R.id.drawer_option_my_videos);
    tvMyVideos.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Activity act = getActivity();
            ((BaseFragmentActivity) act).closeDrawer();

            if (!(act instanceof MyVideosTabActivity)) {
              environment.getRouter().showMyVideos(act);
              // Finish need not be called if the current activity is MyCourseListing
              // as on returning back from FindCourses,
              // the student should be returned to the MyCourses screen
              if (!(act instanceof MyCoursesListActivity)) {
                act.finish();
              }
            }
          }
        });

    TextView tvFindCourses = (TextView) layout.findViewById(R.id.drawer_option_find_courses);
    tvFindCourses.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            try {
              ISegment segIO = environment.getSegment();
              segIO.trackUserFindsCourses();
            } catch (Exception e) {
              logger.error(e);
            }
            Activity act = getActivity();
            ((BaseFragmentActivity) act).closeDrawer();
            if (environment.getConfig().getEnrollmentConfig().isEnabled()) {
              if (!(act instanceof FindCoursesActivity)) {
                environment.getRouter().showFindCourses(act);

                // Finish need not be called if the current activity is MyCourseListing
                // as on returning back from FindCourses,
                // the student should be returned to the MyCourses screen
                if (!(act instanceof MyCoursesListActivity)) {
                  act.finish();
                }
              }
            } else {
              // Show the dialog only if the activity is started. This is to avoid Illegal state
              // exceptions if the dialog fragment tries to show even if the application is not in
              // foreground
              if (isAdded() && isVisible()) {
                FindCoursesDialogFragment findCoursesFragment = new FindCoursesDialogFragment();
                findCoursesFragment.setStyle(
                    DialogFragment.STYLE_NORMAL, android.R.style.Theme_Black_NoTitleBar_Fullscreen);
                findCoursesFragment.setCancelable(false);
                findCoursesFragment.show(getFragmentManager(), "dialog-find-courses");
              }
            }
          }
        });

    TextView tvMyGroups = (TextView) layout.findViewById(R.id.drawer_option_my_groups);
    tvMyGroups.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            Activity act = getActivity();
            ((BaseFragmentActivity) act).closeDrawer();

            if (!(act instanceof MyGroupsListActivity)) {
              environment.getRouter().showMyGroups(act);

              if (!(act instanceof MyCoursesListActivity)) {
                act.finish();
              }
            }
          }
        });

    TextView tvSettings = (TextView) layout.findViewById(R.id.drawer_option_my_settings);
    tvSettings.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View view) {
            Activity act = getActivity();
            ((BaseFragmentActivity) act).closeDrawer();

            if (!(act instanceof SettingsActivity)) {
              environment.getRouter().showSettings(act);

              if (!(act instanceof MyCoursesListActivity)) {
                act.finish();
              }
            }
          }
        });

    TextView tvSubmitFeedback = (TextView) layout.findViewById(R.id.drawer_option_submit_feedback);
    tvSubmitFeedback.setOnClickListener(
        new OnClickListener() {
          @Override
          public void onClick(View v) {
            String to = environment.getConfig().getFeedbackEmailAddress();
            String subject = getString(R.string.email_subject);
            String email = "";
            EmailUtil.sendEmail(getActivity(), to, subject, email, environment.getConfig());
          }
        });

    ProfileModel profile = pref.getCurrentUserProfile();
    if (profile != null) {
      if (profile.name != null) {
        name_tv.setText(profile.name);
      }
      if (profile.email != null) {
        email_tv.setText(profile.email);
      }
    }

    Button logout_btn = (Button) layout.findViewById(R.id.logout_button);
    logout_btn.setOnClickListener(
        new OnClickListener() {

          @Override
          public void onClick(View v) {
            environment
                .getRouter()
                .forceLogout(
                    getActivity(), environment.getSegment(), environment.getNotificationDelegate());
          }
        });

    TextView version_tv = (TextView) layout.findViewById(R.id.tv_version_no);
    try {
      String versionName = PropertyUtil.getManifestVersionName(getActivity());

      if (versionName != null) {
        String envDisplayName = environment.getConfig().getEnvironmentDisplayName();
        String text =
            String.format(
                "%s %s %s", getString(R.string.label_version), versionName, envDisplayName);
        version_tv.setText(text);
      }
    } catch (Exception e) {
      logger.error(e);
    }

    return layout;
  }
  @Override
  public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);

    if (!EventBus.getDefault().isRegistered(this)) EventBus.getDefault().register(this);
  }