summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-06-05 15:58:27 -0700
committerAndrew Lee <anwlee@google.com>2015-06-05 16:02:48 -0700
commit0284f76fe813c4ebdf1d0d3472060719757fe394 (patch)
tree2240ffab04a6a08963dd8c4fc57dd49054b3ec8c /src
parent208736530d88386d6d1d23624ec03cd84881bf32 (diff)
Show empty view after load returns empty.
... instead of before. Mildly disorienting as a loading experience. Bug: 19937778 Change-Id: Id1c7d48f3379350030aaed4f4a50320d22f970f6
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/list/AllContactsFragment.java19
1 files changed, 16 insertions, 3 deletions
diff --git a/src/com/android/dialer/list/AllContactsFragment.java b/src/com/android/dialer/list/AllContactsFragment.java
index eaa5cc808..20e88e22b 100644
--- a/src/com/android/dialer/list/AllContactsFragment.java
+++ b/src/com/android/dialer/list/AllContactsFragment.java
@@ -16,6 +16,7 @@
package com.android.dialer.list;
+import android.content.Loader;
import android.database.Cursor;
import android.net.Uri;
import android.provider.ContactsContract.CommonDataKinds.Phone;
@@ -39,6 +40,8 @@ import com.android.dialer.util.DialerUtils;
*/
public class AllContactsFragment extends ContactEntryListFragment<ContactEntryListAdapter> {
+ private View mEmptyListView;
+
public AllContactsFragment() {
setQuickContactEnabled(false);
setAdjustSelectionBoundsEnabled(true);
@@ -52,10 +55,11 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi
public void onViewCreated(View view, android.os.Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- View emptyListView = view.findViewById(R.id.empty_list_view);
- DialerUtils.configureEmptyListView(emptyListView, R.drawable.empty_contacts,
+ View mEmptyListView = view.findViewById(R.id.empty_list_view);
+ DialerUtils.configureEmptyListView(mEmptyListView, R.drawable.empty_contacts,
R.string.all_contacts_empty, getResources());
- getListView().setEmptyView(emptyListView);
+ getListView().setEmptyView(mEmptyListView);
+ mEmptyListView.setVisibility(View.GONE);
ViewUtil.addBottomPaddingToListViewForFab(getListView(), getResources());
}
@@ -68,6 +72,15 @@ public class AllContactsFragment extends ContactEntryListFragment<ContactEntryLi
}
@Override
+ public void onLoadFinished(Loader<Cursor> loader, Cursor data) {
+ super.onLoadFinished(loader, data);
+
+ if (data.getCount() == 0) {
+ mEmptyListView.setVisibility(View.VISIBLE);
+ }
+ }
+
+ @Override
protected ContactEntryListAdapter createListAdapter() {
if (!PermissionsUtil.hasContactsPermissions(getActivity())) {
return new EmptyContactsListAdapter(getActivity());