mirror of
https://github.com/LawnchairLauncher/lawnchair.git
synced 2026-02-20 03:08:19 +00:00
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:
@@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user