Skip to content

Commit

Permalink
Fix dimming animation exit on back press with search view without sug…
Browse files Browse the repository at this point in the history
…gestions
  • Loading branch information
mars885 committed Mar 9, 2019
1 parent 8d3f5f0 commit e4a2607
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 22 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1395,13 +1395,13 @@ public final void expand(boolean animate) {

showKeyboard();

if(!areSuggestionsDisabled()) {
// Cancelling any pending events
cancelExitAnimationEndActionEvent();
// Cancelling any pending events
cancelExitAnimationEndActionEvent();

// Background dimming related
updateBackground(mState, animate);
// Background dimming related
updateBackground(mState, animate);

if(!areSuggestionsDisabled()) {
// Suggestions container related
makeVisible(mSuggestionsContainerLL);
mSuggestionsContainerLL.measure(
Expand Down Expand Up @@ -1456,16 +1456,16 @@ public final void collapse(boolean animate) {

hideKeyboard();

if(!areSuggestionsDisabled()) {
// Cancelling any pending events
cancelExitAnimationEndActionEvent();
// Cancelling any pending events
cancelExitAnimationEndActionEvent();

// Animation related
final long duration = getSuggestionsContainerAnimationDuration(mSuggestionsContainerLL.getMeasuredHeight(), 0);
// Animation related
final long duration = getSuggestionsContainerAnimationDuration(mSuggestionsContainerLL.getMeasuredHeight(), 0);

// Background dimming related
updateBackgroundWithAnimation(mState, duration);
// Background dimming related
updateBackgroundWithAnimation(mState, duration);

if(!areSuggestionsDisabled()) {
// Suggestions container related
makeInvisible(mDividerView);
updateSuggestionsContainerHeightWithAnimation(
Expand Down
11 changes: 1 addition & 10 deletions sample/src/main/java/com/paulrybitskyi/sample/DemoActivity.kt
Original file line number Diff line number Diff line change
Expand Up @@ -205,15 +205,6 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {
}


private fun isSearchViewExpanded(): Boolean {
return when(mMode) {
DemoModes.SIMPLE -> false

else -> persistentSearchView.isExpanded
}
}


private fun canSaveQuery(): Boolean {
return when(mMode) {
DemoModes.RECENT_SEARCH_QUERIES -> true
Expand All @@ -238,7 +229,7 @@ class DemoActivity : AppCompatActivity(), View.OnClickListener {


override fun onBackPressed() {
if(isSearchViewExpanded()) {
if(persistentSearchView.isExpanded) {
persistentSearchView.collapse()
return
}
Expand Down

0 comments on commit e4a2607

Please sign in to comment.