diff options
Diffstat (limited to 'java/com/android/dialer/app/list')
7 files changed, 59 insertions, 15 deletions
diff --git a/java/com/android/dialer/app/list/BlockedListSearchAdapter.java b/java/com/android/dialer/app/list/BlockedListSearchAdapter.java index a90ce7a0d..96d02d7bf 100644 --- a/java/com/android/dialer/app/list/BlockedListSearchAdapter.java +++ b/java/com/android/dialer/app/list/BlockedListSearchAdapter.java @@ -19,10 +19,10 @@ import android.content.Context; import android.content.res.Resources; import android.database.Cursor; import android.view.View; -import com.android.contacts.common.GeoUtil; import com.android.contacts.common.list.ContactListItemView; import com.android.dialer.app.R; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; +import com.android.dialer.location.GeoUtil; /** List adapter to display search results for adding a blocked number. */ public class BlockedListSearchAdapter extends RegularSearchListAdapter { diff --git a/java/com/android/dialer/app/list/BlockedListSearchFragment.java b/java/com/android/dialer/app/list/BlockedListSearchFragment.java index 0f96e2d6e..8d42221c0 100644 --- a/java/com/android/dialer/app/list/BlockedListSearchFragment.java +++ b/java/com/android/dialer/app/list/BlockedListSearchFragment.java @@ -28,7 +28,6 @@ import android.view.View; import android.widget.AdapterView; import android.widget.EditText; import android.widget.Toast; -import com.android.contacts.common.GeoUtil; import com.android.contacts.common.list.ContactEntryListAdapter; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.app.R; @@ -37,6 +36,7 @@ import com.android.dialer.blocking.BlockNumberDialogFragment; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler; import com.android.dialer.blocking.FilteredNumberAsyncQueryHandler.OnCheckBlockedListener; import com.android.dialer.common.LogUtil; +import com.android.dialer.location.GeoUtil; import com.android.dialer.logging.InteractionEvent; import com.android.dialer.logging.Logger; diff --git a/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java b/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java index 542501cfd..537f488d5 100644 --- a/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java +++ b/java/com/android/dialer/app/list/DialerPhoneNumberListAdapter.java @@ -24,11 +24,11 @@ import android.text.BidiFormatter; import android.text.TextDirectionHeuristics; import android.view.View; import android.view.ViewGroup; -import com.android.contacts.common.GeoUtil; import com.android.contacts.common.list.ContactListItemView; import com.android.contacts.common.list.PhoneNumberListAdapter; import com.android.contacts.common.util.ContactDisplayUtils; import com.android.dialer.app.R; +import com.android.dialer.location.GeoUtil; import com.android.dialer.util.CallUtil; /** @@ -47,11 +47,13 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { public static final int SHORTCUT_MAKE_VIDEO_CALL = 4; public static final int SHORTCUT_BLOCK_NUMBER = 5; public static final int SHORTCUT_COUNT = 6; + private final boolean[] mShortcutEnabled = new boolean[SHORTCUT_COUNT]; private final BidiFormatter mBidiFormatter = BidiFormatter.getInstance(); + private final boolean mVideoCallingEnabled; + private final String mCountryIso; + private String mFormattedQueryString; - private String mCountryIso; - private boolean mVideoCallingEnabled = false; public DialerPhoneNumberListAdapter(Context context) { super(context); @@ -108,7 +110,8 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { return convertView; } else { final ContactListItemView v = - new ContactListItemView(getContext(), null, mVideoCallingEnabled); + new ContactListItemView( + getContext(), null, mVideoCallingEnabled, isCallAndShareEnabled()); assignShortcutToView(v, shortcutType); return v; } @@ -123,6 +126,7 @@ public class DialerPhoneNumberListAdapter extends PhoneNumberListAdapter { final ContactListItemView view = super.newView(context, partition, cursor, position, parent); view.setSupportVideoCallIcon(mVideoCallingEnabled); + view.setSupportCallAndShareIcon(isCallAndShareEnabled()); return view; } diff --git a/java/com/android/dialer/app/list/ListsFragment.java b/java/com/android/dialer/app/list/ListsFragment.java index 02498939c..8dd52a9d4 100644 --- a/java/com/android/dialer/app/list/ListsFragment.java +++ b/java/com/android/dialer/app/list/ListsFragment.java @@ -48,6 +48,7 @@ import com.android.dialer.logging.DialerImpression; import com.android.dialer.logging.Logger; import com.android.dialer.logging.ScreenEvent; import com.android.dialer.speeddial.SpeedDialFragment; +import com.android.dialer.util.PermissionsUtil; import com.android.dialer.voicemailstatus.VisualVoicemailEnabledChecker; import com.android.dialer.voicemailstatus.VoicemailStatusHelper; import java.util.ArrayList; @@ -183,10 +184,15 @@ public class ListsFragment extends Fragment mRemoveView = (RemoveView) parentView.findViewById(R.id.remove_view); mRemoveViewContent = parentView.findViewById(R.id.remove_view_content); - getActivity() - .getContentResolver() - .registerContentObserver( - VoicemailContract.Status.CONTENT_URI, true, mVoicemailStatusObserver); + if (PermissionsUtil.hasReadVoicemailPermissions(getContext()) + && PermissionsUtil.hasAddVoicemailPermissions(getContext())) { + getActivity() + .getContentResolver() + .registerContentObserver( + VoicemailContract.Status.CONTENT_URI, true, mVoicemailStatusObserver); + } else { + LogUtil.w("ListsFragment.onCreateView", "no voicemail read/add permissions"); + } Trace.endSection(); Trace.endSection(); diff --git a/java/com/android/dialer/app/list/OldSpeedDialFragment.java b/java/com/android/dialer/app/list/OldSpeedDialFragment.java index 4ae84b6d9..40fe74565 100644 --- a/java/com/android/dialer/app/list/OldSpeedDialFragment.java +++ b/java/com/android/dialer/app/list/OldSpeedDialFragment.java @@ -123,7 +123,7 @@ public class OldSpeedDialFragment extends Fragment if (mContactTileAdapter != null) { mContactTileAdapter.refreshContactsPreferences(); } - if (PermissionsUtil.hasContactsPermissions(getActivity())) { + if (PermissionsUtil.hasContactsReadPermissions(getActivity())) { if (getLoaderManager().getLoader(LOADER_ID_CONTACT_TILE) == null) { getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, mContactTileLoaderListener); @@ -235,7 +235,7 @@ public class OldSpeedDialFragment extends Fragment // Use initLoader() instead of restartLoader() to refraining unnecessary reload. // This method call implicitly assures ContactTileLoaderListener's onLoadFinished() will // be called, on which we'll check if "all" contacts should be reloaded again or not. - if (PermissionsUtil.hasContactsPermissions(activity)) { + if (PermissionsUtil.hasContactsReadPermissions(activity)) { getLoaderManager().initLoader(LOADER_ID_CONTACT_TILE, null, mContactTileLoaderListener); } else { setEmptyViewVisibility(true); diff --git a/java/com/android/dialer/app/list/SearchFragment.java b/java/com/android/dialer/app/list/SearchFragment.java index 264bdf81b..fcf8236e3 100644 --- a/java/com/android/dialer/app/list/SearchFragment.java +++ b/java/com/android/dialer/app/list/SearchFragment.java @@ -380,7 +380,7 @@ public class SearchFragment extends PhoneNumberPickerFragment { return; } - if (PermissionsUtil.hasContactsPermissions(getActivity())) { + if (PermissionsUtil.hasContactsReadPermissions(getActivity())) { super.startLoading(); } else if (TextUtils.isEmpty(getQueryString())) { // Clear out any existing call shortcuts. diff --git a/java/com/android/dialer/app/list/SmartDialSearchFragment.java b/java/com/android/dialer/app/list/SmartDialSearchFragment.java index 5d72ee615..eb1508c72 100644 --- a/java/com/android/dialer/app/list/SmartDialSearchFragment.java +++ b/java/com/android/dialer/app/list/SmartDialSearchFragment.java @@ -18,6 +18,10 @@ package com.android.dialer.app.list; import static android.Manifest.permission.CALL_PHONE; import android.app.Activity; +import android.content.BroadcastReceiver; +import android.content.Context; +import android.content.Intent; +import android.content.IntentFilter; import android.content.Loader; import android.database.Cursor; import android.os.Bundle; @@ -27,6 +31,8 @@ import com.android.dialer.app.R; import com.android.dialer.app.dialpad.SmartDialCursorLoader; import com.android.dialer.app.widget.EmptyContentView; import com.android.dialer.callintent.CallInitiationType; +import com.android.dialer.common.LogUtil; +import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.util.PermissionsUtil; /** Implements a fragment to load and display SmartDial search results. */ @@ -34,10 +40,17 @@ public class SmartDialSearchFragment extends SearchFragment implements EmptyContentView.OnEmptyViewActionButtonClickedListener, FragmentCompat.OnRequestPermissionsResultCallback { - private static final String TAG = SmartDialSearchFragment.class.getSimpleName(); - private static final int CALL_PHONE_PERMISSION_REQUEST_CODE = 1; + private final BroadcastReceiver mSmartDialUpdatedReceiver = + new BroadcastReceiver() { + @Override + public void onReceive(Context context, Intent intent) { + LogUtil.i("SmartDialSearchFragment.onReceive", "smart dial update broadcast received"); + reloadData(); + } + }; + /** Creates a SmartDialListAdapter to display and operate on search results. */ @Override protected ContactEntryListAdapter createListAdapter() { @@ -83,6 +96,27 @@ public class SmartDialSearchFragment extends SearchFragment } @Override + public void onStart() { + super.onStart(); + + LogUtil.i("SmartDialSearchFragment.onStart", "registering smart dial update receiver"); + + getActivity() + .registerReceiver( + mSmartDialUpdatedReceiver, + new IntentFilter(DialerDatabaseHelper.ACTION_SMART_DIAL_UPDATED)); + } + + @Override + public void onStop() { + super.onStop(); + + LogUtil.i("SmartDialSearchFragment.onStop", "unregistering smart dial update receiver"); + + getActivity().unregisterReceiver(mSmartDialUpdatedReceiver); + } + + @Override public void onEmptyViewActionButtonClicked() { final Activity activity = getActivity(); if (activity == null) { |