From 38019af70eb1ca084d36291390bbc54dc81027de Mon Sep 17 00:00:00 2001 From: Yorke Lee Date: Tue, 14 Jul 2015 17:05:38 -0700 Subject: Update Dialer UI to prompt for permissions First pass at adding functionality to Dialer to prompt for permissions. Also updates the UI for various fragments when there are no contacts/calls available to unify the UI with the new UI for the permissions denied state. * Refactor existing empty view functionality and encapsulate into a new custom view class * Add action buttons to existing empty views in various fragments -> Speed Dial (Add to favorites) - scrolls to all contacts fragment -> Recents (Make a call) - shows dialpad -> All contacts (Add a contact) - Launches add contact dialog * Add functionality to various fragments to detect if permissions are denied, and request the permission when the action button is pressed. -> Speed Dial (request for contacts permission) -> Call Log (request for phone permission) -> All contacts (request for contacts permission) * Remove now unneeded EmptyContactsListAdapter Remaining issues (to be addressed in a follow up CL to avoid bloating this CL): UI alignment tweaks for empty view to match mocks If the read contacts permission is requested from the speed dial screen, the all contacts fragment doesn't update with the list of contacts until restarted. Bug: 22174668 Change-Id: I70721914bb9b32910d746de288ccac049749e42e --- src/com/android/dialer/DialtactsActivity.java | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) (limited to 'src/com/android/dialer/DialtactsActivity.java') diff --git a/src/com/android/dialer/DialtactsActivity.java b/src/com/android/dialer/DialtactsActivity.java index 31d1b94bf..85197a530 100644 --- a/src/com/android/dialer/DialtactsActivity.java +++ b/src/com/android/dialer/DialtactsActivity.java @@ -66,6 +66,7 @@ import com.android.contacts.common.util.PermissionsUtil; import com.android.contacts.common.widget.FloatingActionButtonController; import com.android.contacts.commonbind.analytics.AnalyticsUtil; import com.android.dialer.calllog.CallLogActivity; +import com.android.dialer.calllog.CallLogFragment; import com.android.dialer.database.DialerDatabaseHelper; import com.android.dialer.dialpad.DialpadFragment; import com.android.dialer.dialpad.SmartDialNameMatcher; @@ -101,6 +102,7 @@ import java.util.List; public class DialtactsActivity extends TransactionSafeActivity implements View.OnClickListener, DialpadFragment.OnDialpadQueryChangedListener, OnListFragmentScrolledListener, + CallLogFragment.HostInterface, ListsFragment.HostInterface, SpeedDialFragment.HostInterface, SearchFragment.HostInterface, @@ -1207,6 +1209,24 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O mListsFragment.getRemoveView().setDragDropController(dragController); } + /** + * Implemented to satisfy {@link SpeedDialFragment.HostInterface} + */ + @Override + public void showAllContactsTab() { + if (mListsFragment != null) { + mListsFragment.showTab(ListsFragment.TAB_INDEX_ALL_CONTACTS); + } + } + + /** + * Implemented to satisfy {@link CallLogFragment.HostInterface} + */ + @Override + public void showDialpad() { + showDialpadFragment(true); + } + @Override public void onPickPhoneNumberAction(Uri dataUri) { // Specify call-origin so that users will see the previous tab instead of @@ -1322,7 +1342,6 @@ public class DialtactsActivity extends TransactionSafeActivity implements View.O return mActionBarHeight; } - private int getFabAlignment() { if (!mIsLandscape && !isInSearchUi() && mListsFragment.getCurrentTabIndex() == ListsFragment.TAB_INDEX_SPEED_DIAL) { -- cgit v1.2.3