diff options
author | Yorke Lee <yorkelee@google.com> | 2013-09-09 12:29:28 -0700 |
---|---|---|
committer | Yorke Lee <yorkelee@google.com> | 2013-09-11 15:59:35 -0700 |
commit | 18e7fdd55f67e3636c161462cb54e7f5555a04de (patch) | |
tree | 7c830edacb5abe0973ac06dc6bbf4eeb2362f8f6 /src/com/android/dialer/list/PhoneFavoriteFragment.java | |
parent | e44b3c6a990f41d3e58406310183b16db0dab3ea (diff) |
Add no contacts view to Dialer
Bug: 10330508
Change-Id: I5f73a63118558e734cd36e681c59f4b82050a49c
Diffstat (limited to 'src/com/android/dialer/list/PhoneFavoriteFragment.java')
-rw-r--r-- | src/com/android/dialer/list/PhoneFavoriteFragment.java | 18 |
1 files changed, 7 insertions, 11 deletions
diff --git a/src/com/android/dialer/list/PhoneFavoriteFragment.java b/src/com/android/dialer/list/PhoneFavoriteFragment.java index d7c387e57..c2a1b03b7 100644 --- a/src/com/android/dialer/list/PhoneFavoriteFragment.java +++ b/src/com/android/dialer/list/PhoneFavoriteFragment.java @@ -144,18 +144,17 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen private CallLogAdapter mCallLogAdapter; private CallLogQueryHandler mCallLogQueryHandler; - private TextView mEmptyView; private PhoneFavoriteListView mListView; + private View mShowAllContactsButton; private final HashMap<Long, Integer> mItemIdTopMap = new HashMap<Long, Integer>(); private final HashMap<Long, Integer> mItemIdLeftMap = new HashMap<Long, Integer>(); /** - * Layout used when contacts load is slower than expected and thus "loading" view should be - * shown. + * Layout used when there are no favorites. */ - private View mLoadingView; + private View mEmptyView; private final ContactTileView.Listener mContactTileAdapterListener = new ContactTileAdapterListener(); @@ -171,7 +170,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen // Construct two base adapters which will become part of PhoneFavoriteMergedAdapter. // We don't construct the resultant adapter at this moment since it requires LayoutInflater // that will be available on onCreateView(). - mContactTileAdapter = new PhoneFavoritesTileAdapter(activity, mContactTileAdapterListener, this, getResources().getInteger(R.integer.contact_tile_column_count_in_favorites_new), @@ -214,7 +212,8 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen mListView.setScrollBarStyle(ListView.SCROLLBARS_OUTSIDE_OVERLAY); mListView.setOnItemSwipeListener(mContactTileAdapter); - mLoadingView = inflater.inflate(R.layout.phone_loading_contacts, mListView, false); + mEmptyView = inflater.inflate(R.layout.phone_no_favorites, mListView, false); + mShowAllContactsButton = inflater.inflate(R.layout.show_all_contact_button, mListView, false); mShowAllContactsButton.setOnClickListener(new OnClickListener() { @@ -224,8 +223,9 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen } }); + mContactTileAdapter.setEmptyView(mEmptyView); mAdapter = new PhoneFavoriteMergedAdapter(getActivity(), mContactTileAdapter, - mCallLogAdapter, mLoadingView, mShowAllContactsButton); + mCallLogAdapter, mShowAllContactsButton); mListView.setAdapter(mAdapter); @@ -233,10 +233,6 @@ public class PhoneFavoriteFragment extends Fragment implements OnItemClickListen mListView.setFastScrollEnabled(false); mListView.setFastScrollAlwaysVisible(false); - mEmptyView = (TextView) listLayout.findViewById(R.id.contact_tile_list_empty); - mEmptyView.setText(getString(R.string.listTotalAllContactsZero)); - mListView.setEmptyView(mEmptyView); - return listLayout; } |