Fade out fab buttons and megaphone when entering action mode or search.
Closes #12112
This commit is contained in:
parent
d3096c56cb
commit
d7b793ce4c
2 changed files with 31 additions and 3 deletions
|
@ -66,7 +66,9 @@ public class SearchToolbar extends LinearLayout {
|
||||||
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
searchView.setOnQueryTextListener(new SearchView.OnQueryTextListener() {
|
||||||
@Override
|
@Override
|
||||||
public boolean onQueryTextSubmit(String query) {
|
public boolean onQueryTextSubmit(String query) {
|
||||||
if (listener != null) listener.onSearchTextChange(query);
|
if (listener != null) {
|
||||||
|
listener.onSearchTextChange(query);
|
||||||
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -433,8 +433,12 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private boolean isSearchOpen() {
|
||||||
|
return (requireCallback().getSearchToolbar().resolved() && requireCallback().getSearchToolbar().get().isVisible()) || activeAdapter == searchAdapter;
|
||||||
|
}
|
||||||
|
|
||||||
private boolean closeSearchIfOpen() {
|
private boolean closeSearchIfOpen() {
|
||||||
if ((requireCallback().getSearchToolbar().resolved() && requireCallback().getSearchToolbar().get().isVisible()) || activeAdapter == searchAdapter) {
|
if (isSearchOpen()) {
|
||||||
list.removeItemDecoration(searchAdapterDecoration);
|
list.removeItemDecoration(searchAdapterDecoration);
|
||||||
setAdapter(defaultAdapter);
|
setAdapter(defaultAdapter);
|
||||||
requireCallback().getSearchToolbar().get().collapse();
|
requireCallback().getSearchToolbar().get().collapse();
|
||||||
|
@ -559,6 +563,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||||
|
|
||||||
private void initializeSearchListener() {
|
private void initializeSearchListener() {
|
||||||
requireCallback().getSearchAction().setOnClickListener(v -> {
|
requireCallback().getSearchAction().setOnClickListener(v -> {
|
||||||
|
fadeOutButtonsAndMegaphone(250);
|
||||||
requireCallback().onSearchOpened();
|
requireCallback().onSearchOpened();
|
||||||
requireCallback().getSearchToolbar().get().display(requireCallback().getSearchAction().getX() + (requireCallback().getSearchAction().getWidth() / 2.0f),
|
requireCallback().getSearchToolbar().get().display(requireCallback().getSearchAction().getX() + (requireCallback().getSearchAction().getWidth() / 2.0f),
|
||||||
requireCallback().getSearchAction().getY() + (requireCallback().getSearchAction().getHeight() / 2.0f));
|
requireCallback().getSearchAction().getY() + (requireCallback().getSearchAction().getHeight() / 2.0f));
|
||||||
|
@ -589,6 +594,7 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||||
list.removeItemDecoration(searchAdapterDecoration);
|
list.removeItemDecoration(searchAdapterDecoration);
|
||||||
setAdapter(defaultAdapter);
|
setAdapter(defaultAdapter);
|
||||||
requireCallback().onSearchClosed();
|
requireCallback().onSearchClosed();
|
||||||
|
fadeInButtonsAndMegaphone(250);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
@ -767,7 +773,11 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||||
|
|
||||||
if (view != null) {
|
if (view != null) {
|
||||||
megaphoneContainer.get().addView(view);
|
megaphoneContainer.get().addView(view);
|
||||||
|
if (isSearchOpen() || actionMode != null) {
|
||||||
|
megaphoneContainer.get().setVisibility(View.GONE);
|
||||||
|
} else {
|
||||||
megaphoneContainer.get().setVisibility(View.VISIBLE);
|
megaphoneContainer.get().setVisibility(View.VISIBLE);
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
megaphoneContainer.get().setVisibility(View.GONE);
|
megaphoneContainer.get().setVisibility(View.GONE);
|
||||||
|
|
||||||
|
@ -1035,6 +1045,22 @@ public class ConversationListFragment extends MainFragment implements ActionMode
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fadeOutButtonsAndMegaphone(int fadeDuration) {
|
||||||
|
ViewUtil.fadeOut(fab, fadeDuration);
|
||||||
|
ViewUtil.fadeOut(cameraFab, fadeDuration);
|
||||||
|
if (megaphoneContainer.resolved()) {
|
||||||
|
ViewUtil.fadeOut(megaphoneContainer.get(), fadeDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private void fadeInButtonsAndMegaphone(int fadeDuration) {
|
||||||
|
ViewUtil.fadeIn(fab, fadeDuration);
|
||||||
|
ViewUtil.fadeIn(cameraFab, fadeDuration);
|
||||||
|
if (megaphoneContainer.resolved()) {
|
||||||
|
ViewUtil.fadeIn(megaphoneContainer.get(), fadeDuration);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void startActionMode() {
|
private void startActionMode() {
|
||||||
actionMode = ((AppCompatActivity) getActivity()).startSupportActionMode(ConversationListFragment.this);
|
actionMode = ((AppCompatActivity) getActivity()).startSupportActionMode(ConversationListFragment.this);
|
||||||
ViewUtil.animateIn(bottomActionBar, bottomActionBar.getEnterAnimation());
|
ViewUtil.animateIn(bottomActionBar, bottomActionBar.getEnterAnimation());
|
||||||
|
|
Loading…
Add table
Reference in a new issue