Beispiel #1
0
  @Override
  public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
    super.onViewCreated(view, savedInstanceState);
    mWatchMeAdapter = getWatchMeAdapter();

    WatchMeApplication application = WatchMeApplication.getApplication();
    application.inject(this);
    application.inject(getScrollManager());
    application.inject(mWatchMeAdapter);

    setupToolbar(true, savedInstanceState);
    setupParent();

    if (getArguments() != null) {
      Bundle args = getArguments();
      mQuery = args.getString(SEARCH_QUERY);
      mCurrentPageNumber = args.getInt(SEARCH_CURRENT_PAGE);

      SearchView search = getWatchMeActivity().getToolbar().getSearchView();
      search.setQuery(mQuery);

      mPendingJobId = mJobManager.addJob(new FetchSearchPage(mQuery, mCurrentPageNumber));
    }
  }
Beispiel #2
0
  void setupToolbar(boolean init, Bundle state) {
    Toolbar toolbar = getWatchMeActivity().getToolbar();
    toolbar.setTitleVisible(!init);

    MenuDrawable drawable = (MenuDrawable) toolbar.getNavigationIcon();
    drawable.setRotation(init ? 1 : 0, true);

    SearchView search = toolbar.getSearchView();
    search.setCallback(init ? this : null);

    if (init) {
      search.expand();
      search.setQueryHintText(getString(R.string.toolbar_search_hint));

      if (state != null) {
        search.setQuery(state.getString(SEARCH_QUERY));
      }

    } else {
      search.collapse();
    }
  }