Reserve space for the searchbox spinner, even when stopped.

Make the searchbox spinner invisible (transparent) when it's not active.  This prevents the size of the text field from varying depending on whether the spinner is spinning or not, which can cause an annoying flicker.

Bug: 2084293
Change-Id: Idd63a296d1f07c5bd47884040f21e4880038f424
diff --git a/core/java/android/app/SearchDialog.java b/core/java/android/app/SearchDialog.java
index 1209d0f..d05c9ab 100644
--- a/core/java/android/app/SearchDialog.java
+++ b/core/java/android/app/SearchDialog.java
@@ -191,7 +191,10 @@
         mSearchPlate = findViewById(com.android.internal.R.id.search_plate);
         mWorkingSpinner = getContext().getResources().
                 getDrawable(com.android.internal.R.drawable.search_spinner);
-        
+        mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
+                null, null, mWorkingSpinner, null);
+        setWorking(false);
+
         // attach listeners
         mSearchAutoComplete.addTextChangedListener(mTextWatcher);
         mSearchAutoComplete.setOnKeyListener(mTextKeyListener);
@@ -407,15 +410,9 @@
      * @param working true to show spinner, false to hide spinner
      */
     public void setWorking(boolean working) {
-        if (working) {
-            mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
-                    null, null, mWorkingSpinner, null);
-            ((Animatable) mWorkingSpinner).start();
-        } else {
-            mSearchAutoComplete.setCompoundDrawablesWithIntrinsicBounds(
-                    null, null, null, null);
-            ((Animatable) mWorkingSpinner).stop();
-        }
+        mWorkingSpinner.setAlpha(working ? 255 : 0);
+        mWorkingSpinner.setVisible(working, false);
+        mWorkingSpinner.invalidateSelf();
     }
     
     /**