From 0a28ebe9f6eef9d3df42b125e99c25f9b7cc1806 Mon Sep 17 00:00:00 2001 From: calderwoodra Date: Thu, 12 Apr 2018 12:51:15 -0700 Subject: Get dialpad fragment hint text sooner and hold onto it. Bug: 77908301 Test: opened dialpad, didn't crash PiperOrigin-RevId: 192654487 Change-Id: If5bf9b6df7f15364358fb601d154d4bb99dd5b55 --- java/com/android/dialer/dialpadview/DialpadFragment.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/java/com/android/dialer/dialpadview/DialpadFragment.java b/java/com/android/dialer/dialpadview/DialpadFragment.java index 9d88d8e0f..2745a71b1 100644 --- a/java/com/android/dialer/dialpadview/DialpadFragment.java +++ b/java/com/android/dialer/dialpadview/DialpadFragment.java @@ -166,6 +166,7 @@ public class DialpadFragment extends Fragment private OnDialpadQueryChangedListener dialpadQueryListener; private DialpadView dialpadView; private EditText digits; + private TextView digitsHint; private int dialpadSlideInDuration; /** Remembers if we need to clear digits field when the screen is completely gone. */ private boolean clearDigitsOnStop; @@ -402,6 +403,7 @@ public class DialpadFragment extends Fragment dialpadView = fragmentView.findViewById(R.id.dialpad_view); dialpadView.setCanDigitsBeEdited(true); digits = dialpadView.getDigits(); + digitsHint = dialpadView.getDigitsHint(); digits.setKeyListener(UnicodeDialerKeyListener.INSTANCE); digits.setOnClickListener(this); digits.setOnKeyListener(this); @@ -462,18 +464,18 @@ public class DialpadFragment extends Fragment * difficult. */ private void updateDialpadHint() { - TextView hint = dialpadView.getDigitsHint(); if (!TextUtils.isEmpty(digits.getText())) { - hint.setVisibility(View.GONE); + digitsHint.setVisibility(View.GONE); return; } if (shouldShowEmergencyCallWarning(getContext())) { - hint.setText(getContext().getString(R.string.dialpad_hint_emergency_calling_not_available)); - hint.setVisibility(View.VISIBLE); + digitsHint.setText( + getContext().getString(R.string.dialpad_hint_emergency_calling_not_available)); + digitsHint.setVisibility(View.VISIBLE); return; } - hint.setVisibility(View.GONE); + digitsHint.setVisibility(View.GONE); } /** -- cgit v1.2.3