Fixing some search box issues.

- Voice search still clickable and causes crash (Bug: 5371480)
- Empty search box when QSB is disabled (Bug: 5358074)

Change-Id: I97cef678b012c8294fca9149e22458abed31075d
This commit is contained in:
Winson Chung
2011-10-05 11:44:49 -07:00
parent 9b09219df6
commit c51db6accf
3 changed files with 58 additions and 32 deletions

View File

@@ -21,7 +21,7 @@ import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.content.Context;
import android.content.res.Configuration;
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.View;
import android.view.animation.AccelerateInterpolator;
@@ -52,6 +52,8 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
private int mBarHeight;
private boolean mDeferOnDragEnd = false;
private Drawable mPreviousBackground;
public SearchDropTargetBar(Context context, AttributeSet attrs) {
this(context, attrs, 0);
}
@@ -213,4 +215,18 @@ public class SearchDropTargetBar extends FrameLayout implements DragController.D
mDeferOnDragEnd = false;
}
}
public void onSearchPackagesChanged(boolean searchVisible, boolean voiceVisible) {
if (mQSBSearchBar != null) {
Drawable bg = mQSBSearchBar.getBackground();
if (bg != null && (!searchVisible && !voiceVisible)) {
// Save the background and disable it
mPreviousBackground = bg;
mQSBSearchBar.setBackgroundResource(0);
} else if (mPreviousBackground != null && (searchVisible || voiceVisible)) {
// Restore the background
mQSBSearchBar.setBackgroundDrawable(mPreviousBackground);
}
}
}
}