From e3f59a8f06add2edade829ff043ebee8da5fdc85 Mon Sep 17 00:00:00 2001 From: Andrew Lee Date: Thu, 26 Feb 2015 12:06:35 -0800 Subject: Fix FrameLayout cast exception. I was seeing a ClassCastException: android.widget.FrameLayout cannot be cast to com.android.dialer.widget.SearchEditTextLayout. But, it's kind of bizarre, because it disappeared after I tried implementing this fix, even when creating what should have been a clean branch replicating the original conditions (?). In any case, this would make us more resilient to changes in the custom view used by the action bar by searching for the SearchEditTextLayout by id. Change-Id: I9f4909b55e4ef29562712643048eb3fb942ff684 --- src/com/android/dialer/DialtactsActivity.java | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'src/com/android/dialer/DialtactsActivity.java') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 01d59c45f..7da13f344 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -371,13 +371,12 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O actionBar.setDisplayShowCustomEnabled(true); actionBar.setBackgroundDrawable(null); - mActionBarController = new ActionBarController(this, - (SearchEditTextLayout) actionBar.getCustomView()); - SearchEditTextLayout searchEditTextLayout = - (SearchEditTextLayout) actionBar.getCustomView(); + (SearchEditTextLayout) actionBar.getCustomView().findViewById(R.id.search_view_container); searchEditTextLayout.setPreImeKeyListener(mSearchEditTextLayoutListener); + mActionBarController = new ActionBarController(this, searchEditTextLayout); + mSearchView = (EditText) searchEditTextLayout.findViewById(R.id.search_view); mSearchView.addTextChangedListener(mPhoneSearchQueryTextListener); mVoiceSearchButton = searchEditTextLayout.findViewById(R.id.voice_search_button); -- cgit v1.2.3