Пример #1
0
 /** Sets the visibility of the search bar */
 public void setSearchBarVisibility(int visibility) {
   Log.d(TAG, "setSearchBarVisibility: ");
   if (mSearchBar != null) {
     mSearchBar.setVisibility(visibility);
     // Always bring the search bar to the top
     mSearchBar.bringToFront();
   }
 }
Пример #2
0
  /** This is called with the full size of the window since we are handling our own insets. */
  @Override
  protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
    Log.d(TAG, "onLayout: ");
    // Get the search bar bounds so that we lay it out
    if (mSearchBar != null) {
      Rect searchBarSpaceBounds = new Rect();
      mConfig.getSearchBarBounds(
          getMeasuredWidth(), getMeasuredHeight(), mConfig.systemInsets.top, searchBarSpaceBounds);
      mSearchBar.layout(
          searchBarSpaceBounds.left,
          searchBarSpaceBounds.top,
          searchBarSpaceBounds.right,
          searchBarSpaceBounds.bottom);
    }

    // Layout each TaskStackView with the full width and height of the window since the
    // transition view is a child of that stack view
    List<TaskStackView> stackViews = getTaskStackViews();
    int stackCount = stackViews.size();
    for (int i = 0; i < stackCount; i++) {
      TaskStackView stackView = stackViews.get(i);
      if (stackView.getVisibility() != GONE) {
        stackView.layout(
            left, top, left + stackView.getMeasuredWidth(), top + stackView.getMeasuredHeight());
      }
    }
  }
Пример #3
0
 @Override
 public void onTaskStackUnfilterTriggered() {
   // Show the search bar
   if (mSearchBar != null) {
     mSearchBar
         .animate()
         .alpha(1f)
         .setStartDelay(0)
         .setInterpolator(mConfig.fastOutSlowInInterpolator)
         .setDuration(mConfig.filteringNewViewsAnimDuration)
         .withLayer()
         .start();
   }
 }
Пример #4
0
  /** This is called with the full size of the window since we are handling our own insets. */
  @Override
  protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
    Log.d(TAG, "onMeasure: ");
    int width = MeasureSpec.getSize(widthMeasureSpec);
    int height = MeasureSpec.getSize(heightMeasureSpec);

    // Get the search bar bounds and measure the search bar layout
    Rect searchBarSpaceBounds = new Rect();
    if (mSearchBar != null) {
      mConfig.getSearchBarBounds(width, height, mConfig.systemInsets.top, searchBarSpaceBounds);
      mSearchBar.measure(
          MeasureSpec.makeMeasureSpec(searchBarSpaceBounds.width(), MeasureSpec.EXACTLY),
          MeasureSpec.makeMeasureSpec(searchBarSpaceBounds.height(), MeasureSpec.EXACTLY));
    }

    Rect taskStackBounds = new Rect();
    mConfig.getAvailableTaskStackBounds(
        width,
        height,
        mConfig.systemInsets.top,
        mConfig.systemInsets.right,
        searchBarSpaceBounds,
        taskStackBounds);

    // Measure each TaskStackView with the full width and height of the window since the
    // transition view is a child of that stack view
    List<TaskStackView> stackViews = getTaskStackViews();
    List<Rect> stackViewsBounds = mLayoutAlgorithm.computeStackRects(stackViews, taskStackBounds);
    int stackCount = stackViews.size();
    for (int i = 0; i < stackCount; i++) {
      TaskStackView stackView = stackViews.get(i);
      if (stackView.getVisibility() != GONE) {
        // We are going to measure the TaskStackView with the whole RecentsView dimensions,
        // but the actual stack is going to be inset to the bounds calculated by the layout
        // algorithm
        stackView.setStackInsetRect(stackViewsBounds.get(i));
        stackView.measure(widthMeasureSpec, heightMeasureSpec);
      }
    }

    setMeasuredDimension(width, height);
  }
Пример #5
0
 /** Returns whether there is currently a search bar */
 public boolean hasValidSearchBar() {
   Log.d(TAG, "hasValidSearchBar: ");
   return mSearchBar != null && !mSearchBar.isReinflateRequired();
 }