Fix item
This commit is contained in:
parent
d56dc04314
commit
352eafcb9e
@ -665,7 +665,6 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
return searchContainer.getVisibility() == VISIBLE;
|
||||
}
|
||||
|
||||
AnimatorSet searchContainerAnimator;
|
||||
|
||||
public boolean toggleSearch(boolean openKeyboard) {
|
||||
if (searchContainer == null || (listener != null && !listener.canToggleSearch())) {
|
||||
@ -678,41 +677,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
ArrayList<View> menuIcons = new ArrayList<>();
|
||||
for (int i = 0; i < parentMenu.getChildCount(); i++) {
|
||||
View view = parentMenu.getChildAt(i);
|
||||
if (view instanceof ActionBarMenuItem) {
|
||||
View iconView = ((ActionBarMenuItem) view).getIconView();
|
||||
if (iconView != null) {
|
||||
menuIcons.add(iconView);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (searchContainer.getTag() != null) {
|
||||
searchContainer.setTag(null);
|
||||
if (searchContainerAnimator != null) {
|
||||
searchContainerAnimator.removeAllListeners();
|
||||
searchContainerAnimator.cancel();
|
||||
}
|
||||
searchContainerAnimator = new AnimatorSet();
|
||||
searchContainerAnimator.playTogether(ObjectAnimator.ofFloat(searchContainer, View.ALPHA, searchContainer.getAlpha(), 0f));
|
||||
for (int i = 0; i < menuIcons.size(); i++) {
|
||||
menuIcons.get(i).setAlpha(0f);
|
||||
searchContainerAnimator.playTogether(ObjectAnimator.ofFloat(menuIcons.get(i), View.ALPHA, menuIcons.get(i).getAlpha(), 1f));
|
||||
}
|
||||
searchContainerAnimator.setDuration(150);
|
||||
searchContainerAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
searchContainer.setAlpha(0);
|
||||
for (int i = 0; i < menuIcons.size(); i++) {
|
||||
menuIcons.get(i).setAlpha(1f);
|
||||
}
|
||||
searchContainer.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
searchContainerAnimator.start();
|
||||
if (searchContainer.getVisibility() == VISIBLE) {
|
||||
searchContainer.setVisibility(GONE);
|
||||
|
||||
searchField.clearFocus();
|
||||
setVisibility(VISIBLE);
|
||||
@ -734,29 +700,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
||||
}
|
||||
return false;
|
||||
} else {
|
||||
searchContainer.setTag(1);
|
||||
searchContainer.setVisibility(VISIBLE);
|
||||
searchContainer.setAlpha(0);
|
||||
if (searchContainerAnimator != null) {
|
||||
searchContainerAnimator.removeAllListeners();
|
||||
searchContainerAnimator.cancel();
|
||||
}
|
||||
searchContainerAnimator = new AnimatorSet();
|
||||
searchContainerAnimator.playTogether(ObjectAnimator.ofFloat(searchContainer, View.ALPHA, searchContainer.getAlpha(), 1f));
|
||||
for (int i = 0; i < menuIcons.size(); i++) {
|
||||
searchContainerAnimator.playTogether(ObjectAnimator.ofFloat(menuIcons.get(i), View.ALPHA, menuIcons.get(i).getAlpha(), 0f));
|
||||
}
|
||||
searchContainerAnimator.setDuration(150);
|
||||
searchContainerAnimator.addListener(new AnimatorListenerAdapter() {
|
||||
@Override
|
||||
public void onAnimationEnd(Animator animation) {
|
||||
searchContainer.setAlpha(1f);
|
||||
for (int i = 0; i < menuIcons.size(); i++) {
|
||||
menuIcons.get(i).setAlpha(0f);
|
||||
}
|
||||
}
|
||||
});
|
||||
searchContainerAnimator.start();
|
||||
setVisibility(GONE);
|
||||
searchField.setText("");
|
||||
searchField.requestFocus();
|
||||
|
Loading…
Reference in New Issue
Block a user