diff options
-rw-r--r-- | src/com/android/dialer/DialtactsActivity.java | 6 | ||||
-rw-r--r-- | src/com/android/dialer/list/RegularSearchFragment.java | 28 | ||||
-rw-r--r-- | src/com/android/dialerbind/ObjectFactory.java | 4 |
3 files changed, 9 insertions, 29 deletions
diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index d44e8e7cf..bfb908f04 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -90,6 +90,7 @@ import com.android.dialer.widget.ActionBarController; import com.android.dialer.widget.SearchEditTextLayout; import com.android.dialer.widget.SearchEditTextLayout.Callback; import com.android.dialerbind.DatabaseHelperManager; +import com.android.dialerbind.ObjectFactory; import com.android.incallui.Call.LogState; import com.android.phone.common.animation.AnimUtils; import com.android.phone.common.animation.AnimationListenerAdapter; @@ -110,7 +111,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O ListsFragment.HostInterface, SpeedDialFragment.HostInterface, SearchFragment.HostInterface, - RegularSearchFragment.CapabilityChecker, OnDragDropListener, OnPhoneNumberPickerActionListener, PopupMenu.OnMenuItemClickListener, @@ -607,7 +607,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } else if (fragment instanceof SearchFragment) { mRegularSearchFragment = (RegularSearchFragment) fragment; mRegularSearchFragment.setOnPhoneNumberPickerActionListener(this); - mRegularSearchFragment.setCapabilityChecker(this); } else if (fragment instanceof ListsFragment) { mListsFragment = (ListsFragment) fragment; mListsFragment.addOnPageChangeListener(this); @@ -872,7 +871,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O } } - @Override public boolean isNearbyPlacesSearchEnabled() { return false; } @@ -1020,7 +1018,7 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O if (smartDialSearch) { fragment = new SmartDialSearchFragment(); } else { - fragment = new RegularSearchFragment(); + fragment = ObjectFactory.newRegularSearchFragment(); fragment.setOnTouchListener(new View.OnTouchListener() { @Override public boolean onTouch(View v, MotionEvent event) { diff --git a/src/com/android/dialer/list/RegularSearchFragment.java b/src/com/android/dialer/list/RegularSearchFragment.java index 33ce95f78..6b89ef0a3 100644 --- a/src/com/android/dialer/list/RegularSearchFragment.java +++ b/src/com/android/dialer/list/RegularSearchFragment.java @@ -16,7 +16,6 @@ package com.android.dialer.list; import static android.Manifest.permission.READ_CONTACTS; -import static android.Manifest.permission.ACCESS_FINE_LOCATION; import android.app.Activity; import android.content.pm.PackageManager; @@ -38,7 +37,7 @@ import com.android.dialer.widget.EmptyContentView.OnEmptyViewActionButtonClicked public class RegularSearchFragment extends SearchFragment implements OnEmptyViewActionButtonClickedListener { - private static final int PERMISSION_REQUEST_CODE = 1; + public static final int PERMISSION_REQUEST_CODE = 1; private static final int SEARCH_DIRECTORY_RESULT_LIMIT = 5; @@ -49,8 +48,7 @@ public class RegularSearchFragment extends SearchFragment public boolean isNearbyPlacesSearchEnabled(); } - private String mPermissionToRequest; - private CapabilityChecker mCapabilityChecker; + protected String mPermissionToRequest; public RegularSearchFragment() { configureDirectorySearch(); @@ -64,7 +62,6 @@ public class RegularSearchFragment extends SearchFragment @Override public void onDetach() { - mCapabilityChecker = null; super.onDetach(); } @@ -110,13 +107,6 @@ public class RegularSearchFragment extends SearchFragment descriptionResource = R.string.permission_no_search; listener = this; mPermissionToRequest = READ_CONTACTS; - } else if (isNearbyPlacesSearchEnabled() - && !PermissionsUtil.hasPermission(getActivity(), ACCESS_FINE_LOCATION)) { - imageResource = R.drawable.empty_contacts; - actionLabelResource = R.string.permission_single_turn_on; - descriptionResource = R.string.permission_no_location_for_search; - listener = this; - mPermissionToRequest = ACCESS_FINE_LOCATION; } else { imageResource = EmptyContentView.NO_IMAGE; actionLabelResource = EmptyContentView.NO_LABEL; @@ -141,8 +131,7 @@ public class RegularSearchFragment extends SearchFragment return; } - if (READ_CONTACTS.equals(mPermissionToRequest) - || ACCESS_FINE_LOCATION.equals(mPermissionToRequest)) { + if (READ_CONTACTS.equals(mPermissionToRequest)) { requestPermissions(new String[] {mPermissionToRequest}, PERMISSION_REQUEST_CODE); } } @@ -164,15 +153,4 @@ public class RegularSearchFragment extends SearchFragment return isRemoteDirectory ? LogState.INITIATION_REMOTE_DIRECTORY : LogState.INITIATION_REGULAR_SEARCH; } - - public void setCapabilityChecker(CapabilityChecker capabilityChecker) { - mCapabilityChecker = capabilityChecker; - } - - private boolean isNearbyPlacesSearchEnabled() { - if (mCapabilityChecker != null) { - return mCapabilityChecker.isNearbyPlacesSearchEnabled(); - } - return false; - } } diff --git a/src/com/android/dialerbind/ObjectFactory.java b/src/com/android/dialerbind/ObjectFactory.java index c64afe83a..a1753fab3 100644 --- a/src/com/android/dialerbind/ObjectFactory.java +++ b/src/com/android/dialerbind/ObjectFactory.java @@ -65,4 +65,8 @@ public class ObjectFactory { // no-op return null; } + + public static RegularSearchFragment newRegularSearchFragment() { + return new RegularSearchFragment(); + } } |