Skip to content
This repository has been archived by the owner on Mar 17, 2023. It is now read-only.

Commit

Permalink
Null check the EditText's action.
Browse files Browse the repository at this point in the history
  • Loading branch information
Jeff Meyerhoff committed Dec 9, 2014
1 parent 2c7fcd4 commit f57d0a7
Showing 1 changed file with 16 additions and 7 deletions.
23 changes: 16 additions & 7 deletions src/com/ideabag/playtunes/fragment/search/SearchFragment.java
Original file line number Diff line number Diff line change
Expand Up @@ -121,21 +121,30 @@ public SearchFragment( String query ) {

@Override public boolean onEditorAction( TextView view, int actionId, KeyEvent event ) {

if ( actionId == EditorInfo.IME_ACTION_SEARCH || event.getKeyCode() == KeyEvent.KEYCODE_ENTER ) {
boolean mConsumed = false;
String query = mQueryTextView.getEditableText().toString();

if ( event != null && event.getKeyCode() == KeyEvent.KEYCODE_ENTER ) {

setMediaID( query );

mConsumed = true;

} else if ( event != null && event.getAction() == KeyEvent.ACTION_DOWN ) {

setMediaID( mQueryTextView.getEditableText().toString() );
setMediaID( query );

return true;
mConsumed = true;

} else if ( event.getAction() == KeyEvent.ACTION_DOWN ) {
} else if ( actionId == EditorInfo.IME_ACTION_SEARCH ) {

android.util.Log.i( TAG, "key down");
setMediaID( query );

setMediaID( mQueryTextView.getEditableText().toString() );
mConsumed = true;

}

return false;
return mConsumed;

}

Expand Down

0 comments on commit f57d0a7

Please sign in to comment.