From bf0f0fd52ee2315ffd01f7968e5808bea9fdc045 Mon Sep 17 00:00:00 2001 From: Nancy Chen Date: Wed, 18 Nov 2015 14:32:33 -0800 Subject: getContext() -> getActivity() in fragments for backwards compatibility. getContext() did not exist prior to API level 23, so override getContext() to return the activity in dialer code. Bug: 25776171 Change-Id: I817a1ba2ef29c032065b1e7eee6c033b050fb61d --- src/com/android/dialer/dialpad/DialpadFragment.java | 5 +++++ src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java | 5 +++++ src/com/android/dialer/filterednumber/BlockedNumbersFragment.java | 5 +++++ .../android/dialer/filterednumber/ViewNumbersToImportFragment.java | 5 +++++ src/com/android/dialer/settings/SoundSettingsFragment.java | 5 +++++ 5 files changed, 25 insertions(+) (limited to 'src/com/android/dialer') diff --git a/src/com/android/dialer/dialpad/DialpadFragment.java b/src/com/android/dialer/dialpad/DialpadFragment.java index 760b02032..246b0d7fa 100644 --- a/src/com/android/dialer/dialpad/DialpadFragment.java +++ b/src/com/android/dialer/dialpad/DialpadFragment.java @@ -273,6 +273,11 @@ public class DialpadFragment extends Fragment return (TelephonyManager) getActivity().getSystemService(Context.TELEPHONY_SERVICE); } + @Override + public Context getContext() { + return getActivity(); + } + @Override public void beforeTextChanged(CharSequence s, int start, int count, int after) { mWasEmptyBeforeTextChange = TextUtils.isEmpty(s); diff --git a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java index 0f4bd74bd..de4fe99f1 100644 --- a/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java +++ b/src/com/android/dialer/filterednumber/BlockNumberDialogFragment.java @@ -122,6 +122,11 @@ public class BlockNumberDialogFragment extends DialogFragment { return fragment; } + @Override + public Context getContext() { + return getActivity(); + } + @Override public Dialog onCreateDialog(Bundle savedInstanceState) { super.onCreateDialog(savedInstanceState); diff --git a/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java b/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java index 881ec0497..661a3e106 100644 --- a/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java +++ b/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java @@ -50,6 +50,11 @@ public class BlockedNumbersFragment extends ListFragment private View mBlockedNumbersDisabledForEmergency; private View mBlockedNumberListDivider; + @Override + public Context getContext() { + return getActivity(); + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); diff --git a/src/com/android/dialer/filterednumber/ViewNumbersToImportFragment.java b/src/com/android/dialer/filterednumber/ViewNumbersToImportFragment.java index 9912416ec..153d73cde 100644 --- a/src/com/android/dialer/filterednumber/ViewNumbersToImportFragment.java +++ b/src/com/android/dialer/filterednumber/ViewNumbersToImportFragment.java @@ -43,6 +43,11 @@ public class ViewNumbersToImportFragment extends ListFragment private ViewNumbersToImportAdapter mAdapter; + @Override + public Context getContext() { + return getActivity(); + } + @Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); diff --git a/src/com/android/dialer/settings/SoundSettingsFragment.java b/src/com/android/dialer/settings/SoundSettingsFragment.java index 83847004d..35e1dae2d 100644 --- a/src/com/android/dialer/settings/SoundSettingsFragment.java +++ b/src/com/android/dialer/settings/SoundSettingsFragment.java @@ -87,6 +87,11 @@ public class SoundSettingsFragment extends PreferenceFragment } }; + @Override + public Context getContext() { + return getActivity(); + } + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); -- cgit v1.2.3