Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 772b6b12 authored by Winson Chung's avatar Winson Chung
Browse files

Fixing regression in search bar not appearing after clearing all your tasks and creating new ones.

parent 7aceb9a0
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -203,8 +203,14 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        }
        if (mConfig.launchedWithNoRecentTasks) {
            mEmptyView.setVisibility(View.VISIBLE);
            mRecentsView.setSearchBarVisibility(View.GONE);
        } else {
            mEmptyView.setVisibility(View.GONE);
            if (mRecentsView.hasSearchBar()) {
                mRecentsView.setSearchBarVisibility(View.VISIBLE);
            } else {
                addSearchBarAppWidgetView();
            }
        }

        // Show the scrim if we animate into Recents without window transitions
@@ -351,13 +357,10 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        mFullscreenOverlayStub = (ViewStub) findViewById(R.id.fullscreen_overlay_stub);
        mScrimViews = new SystemBarScrimViews(this, mConfig);

        // Update the recent tasks
        updateRecentsTasks(getIntent());

        // Bind the search app widget when we first start up
        bindSearchBarAppWidget();
        // Add the search bar layout
        addSearchBarAppWidgetView();
        // Update the recent tasks
        updateRecentsTasks(getIntent());

        // Update if we are getting a configuration change
        if (savedInstanceState != null) {
+12 −5
Original line number Diff line number Diff line
@@ -66,8 +66,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV

    // The space partitioning root of this container
    SpaceNode mBSP;
    // Whether there are any tasks
    boolean mHasTasks;
    // Search bar view
    View mSearchBar;
    // Recents view callbacks
@@ -110,13 +108,11 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        }

        // Create and add all the stacks for this partition of space.
        mHasTasks = false;
        ArrayList<TaskStack> stacks = mBSP.getStacks();
        for (TaskStack stack : stacks) {
            TaskStackView stackView = new TaskStackView(getContext(), stack);
            stackView.setCallbacks(this);
            addView(stackView);
            mHasTasks |= (stack.getTaskCount() > 0);
        }

        // Enable debug mode drawing
@@ -246,7 +242,6 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
            // Add the new search bar
            if (searchBar != null) {
                mSearchBar = searchBar;
                mSearchBar.setVisibility(mHasTasks ? View.VISIBLE : View.GONE);
                addView(mSearchBar);

                if (Console.Enabled) {
@@ -258,6 +253,18 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        }
    }

    /** Returns whether there is currently a search bar */
    public boolean hasSearchBar() {
        return mSearchBar != null;
    }

    /** Sets the visibility of the search bar */
    public void setSearchBarVisibility(int visibility) {
        if (mSearchBar != null) {
            mSearchBar.setVisibility(visibility);
        }
    }

    /**
     * This is called with the full size of the window since we are handling our own insets.
     */