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

Commit c5017462 authored by Yashar Ahmedizadeh's avatar Yashar Ahmedizadeh Committed by Steve Kondik
Browse files

SystemUI: Add option to disable search bar in recents (2/2)

Coded from scratch by yashade2001.
Firstly written for Project D.I.S.C.O. ROM.
Thanks to TheMrcool212 for his help.

Change-Id: I3f985aab873d05350c8301bdedae5eeee49f70c7
parent 918e7aa9
Loading
Loading
Loading
Loading
+6 −0
Original line number Diff line number Diff line
@@ -3385,6 +3385,12 @@ public final class Settings {
          */
         public static final String VOLUME_KEY_CURSOR_CONTROL = "volume_key_cursor_control";

        /**
         * Show search bar in recents
         * @hide
         */
        public static final String RECENTS_SHOW_SEARCH_BAR = "recents_show_search_bar";

        /**
         * Whether to enable voice wakeup.  The value is boolean (1 or 0).
         * @hide
+21 −2
Original line number Diff line number Diff line
@@ -27,9 +27,11 @@ import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.os.SystemClock;
import android.os.UserHandle;
import android.provider.Settings;
import android.util.Pair;
import android.view.KeyEvent;
import android.view.View;
@@ -37,6 +39,7 @@ import android.view.ViewStub;
import android.widget.Toast;

import com.android.systemui.R;
import com.android.systemui.recents.RecentsConfiguration;
import com.android.systemui.recents.misc.DebugTrigger;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
@@ -249,13 +252,29 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
                mEmptyView.setVisibility(View.GONE);
            }
            findViewById(R.id.clear_recents).setVisibility(View.VISIBLE);
            boolean showSearchBar = Settings.System.getInt(getContentResolver(),
                       Settings.System.RECENTS_SHOW_SEARCH_BAR, 1) == 1;
            if (mRecentsView.hasSearchBar()) {
                if (showSearchBar) {
                    mRecentsView.setSearchBarVisibility(View.VISIBLE);
                } else {
                    mRecentsView.setSearchBarVisibility(View.GONE);
                }
            } else {
                if (showSearchBar) {
                    addSearchBarAppWidgetView();
                }
            }

            // Update search bar space height
            if (showSearchBar) {
                RecentsConfiguration.searchBarSpaceHeightPx = getResources().getDimensionPixelSize(
                    R.dimen.recents_search_bar_space_height);
            } else {
                RecentsConfiguration.searchBarSpaceHeightPx = 0;
            }
        }

        // Animate the SystemUI scrims into view
        mScrimViews.prepareEnterRecentsAnimation();
    }
+1 −2
Original line number Diff line number Diff line
@@ -77,7 +77,7 @@ public class RecentsConfiguration {

    /** Search bar */
    int searchBarAppWidgetId = -1;
    public int searchBarSpaceHeightPx;
    public static int searchBarSpaceHeightPx;

    /** Task stack */
    public int taskStackScrollDuration;
@@ -211,7 +211,6 @@ public class RecentsConfiguration {
        maxNumTasksToLoad = ActivityManager.getMaxRecentTasksStatic();

        // Search Bar
        searchBarSpaceHeightPx = res.getDimensionPixelSize(R.dimen.recents_search_bar_space_height);
        searchBarAppWidgetId = settings.getInt(Constants.Values.App.Key_SearchAppWidgetId, -1);

        // Task stack