Skip to content

Commit

Permalink
showSuggestionsList & hideSuggestionsList methods
Browse files Browse the repository at this point in the history
  • Loading branch information
mancj committed Jan 25, 2017
1 parent 2e4129d commit 693aaa0
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 87 deletions.
2 changes: 1 addition & 1 deletion .idea/compiler.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/encodings.xml

This file was deleted.

3 changes: 0 additions & 3 deletions .idea/markdown-navigator/profiles_settings.xml

This file was deleted.

66 changes: 1 addition & 65 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

3 changes: 0 additions & 3 deletions app/src/main/java/com/mancj/example/MainActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,9 +56,6 @@ public void afterTextChanged(Editable editable) {
Log.d("LOG_TAG", getClass().getSimpleName() + " after text changed " + searchBar.getText());
}
});

showResults();

}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -241,6 +241,14 @@ public void onAnimationUpdate(ValueAnimator animation) {
animator.start();
}

public void showSuggestionsList(){
animateLastRequests(0, getListHeight(false));
}

public void hideSuggestionsList(){
animateLastRequests(getListHeight(false), 0);
}

/**
* Set search icon drawable resource
* @param searchIconResId icon resource id
Expand Down Expand Up @@ -457,7 +465,8 @@ public void onAnimationEnd(Animation animation) {
}else {
searchIcon.setVisibility(GONE);
searchEdit.requestFocus();
animateLastRequests(0, getListHeight(false));
if (!suggestionsVisible)
showSuggestionsList();
}
}

Expand All @@ -484,7 +493,7 @@ public boolean onEditorAction(TextView v, int actionId, KeyEvent event) {
if (listenerExists())
onSearchActionListener.onSearchConfirmed(searchEdit.getText());
if (suggestionsVisible)
animateLastRequests(getListHeight(false), 0);
hideSuggestionsList();
adapter.addSuggestion(searchEdit.getText().toString());
return true;
}
Expand Down Expand Up @@ -634,7 +643,7 @@ public SavedState[] newArray(int size) {

@Override
public boolean dispatchKeyEvent(KeyEvent event) {
if(event.getKeyCode()==KeyEvent.KEYCODE_BACK&&searchEnabled) {
if(event.getKeyCode()==KeyEvent.KEYCODE_BACK && searchEnabled) {
animateLastRequests(getListHeight(false), 0);
disableSearch();
return true;
Expand Down

0 comments on commit 693aaa0

Please sign in to comment.