Fix item
This commit is contained in:
parent
d56dc04314
commit
352eafcb9e
@ -665,7 +665,6 @@ public class ActionBarMenuItem extends FrameLayout {
|
|||||||
return searchContainer.getVisibility() == VISIBLE;
|
return searchContainer.getVisibility() == VISIBLE;
|
||||||
}
|
}
|
||||||
|
|
||||||
AnimatorSet searchContainerAnimator;
|
|
||||||
|
|
||||||
public boolean toggleSearch(boolean openKeyboard) {
|
public boolean toggleSearch(boolean openKeyboard) {
|
||||||
if (searchContainer == null || (listener != null && !listener.canToggleSearch())) {
|
if (searchContainer == null || (listener != null && !listener.canToggleSearch())) {
|
||||||
@ -678,41 +677,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ArrayList<View> menuIcons = new ArrayList<>();
|
if (searchContainer.getVisibility() == VISIBLE) {
|
||||||
for (int i = 0; i < parentMenu.getChildCount(); i++) {
|
searchContainer.setVisibility(GONE);
|
||||||
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();
|
|
||||||
|
|
||||||
searchField.clearFocus();
|
searchField.clearFocus();
|
||||||
setVisibility(VISIBLE);
|
setVisibility(VISIBLE);
|
||||||
@ -734,29 +700,8 @@ public class ActionBarMenuItem extends FrameLayout {
|
|||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
} else {
|
} else {
|
||||||
searchContainer.setTag(1);
|
|
||||||
searchContainer.setVisibility(VISIBLE);
|
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);
|
searchContainer.setAlpha(1f);
|
||||||
for (int i = 0; i < menuIcons.size(); i++) {
|
|
||||||
menuIcons.get(i).setAlpha(0f);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
});
|
|
||||||
searchContainerAnimator.start();
|
|
||||||
setVisibility(GONE);
|
setVisibility(GONE);
|
||||||
searchField.setText("");
|
searchField.setText("");
|
||||||
searchField.requestFocus();
|
searchField.requestFocus();
|
||||||
|
Loading…
Reference in New Issue
Block a user