summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-02-26 12:06:35 -0800
committerAndrew Lee <anwlee@google.com>2015-02-26 12:16:42 -0800
commite3f59a8f06add2edade829ff043ebee8da5fdc85 (patch)
treed4430f9342f35b8d956ccd1444b744f9ed907606
parentd3e8449f22ed0604509e6bab94aa5ba6781f87d6 (diff)
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
-rw-r--r--src/com/android/dialer/DialtactsActivity.java7
1 files changed, 3 insertions, 4 deletions
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);