summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrew Lee <anwlee@google.com>2015-04-07 14:40:36 -0700
committerAndrew Lee <anwlee@google.com>2015-04-07 14:45:22 -0700
commitff6adf9a746a6199729a9e227396929667496306 (patch)
treee7b0dd86c8a00430819491c88ad50c9ff62f0f9a /src
parentd32de0ab729ff20c0ed627581ab9ea9454eed927 (diff)
Separate empty view logic from ListView.
Don't rely on setting the empty list on the ListView for controlling visibility of the list view and empty view. Save the reference and control this in the call log fragment. This removes a dependency on ListView-specific functionality which is not found in the RecyclerView. Bug: 19372817 Change-Id: I0a7e2e2366e258013ddbe30bd2ee7efb38349421
Diffstat (limited to 'src')
-rw-r--r--src/com/android/dialer/calllog/CallLogFragment.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/dialer/calllog/CallLogFragment.java b/src/com/android/dialer/calllog/CallLogFragment.java
index cc2ce9cc9..2410b6079 100644
--- a/src/com/android/dialer/calllog/CallLogFragment.java
+++ b/src/com/android/dialer/calllog/CallLogFragment.java
@@ -87,6 +87,7 @@ public class CallLogFragment extends ListFragment
private VoicemailStatusHelper mVoicemailStatusHelper;
private View mStatusMessageView;
+ private View mEmptyListView;
private TextView mStatusMessageText;
private TextView mStatusMessageAction;
private KeyguardManager mKeyguardManager;
@@ -220,8 +221,13 @@ public class CallLogFragment extends ListFragment
mAdapter.changeCursor(cursor);
// This will update the state of the "Clear call log" menu item.
getActivity().invalidateOptionsMenu();
+
+ final ListView listView = getListView();
+ boolean showListView = cursor.getCount() > 0;
+ listView.setVisibility(showListView ? View.VISIBLE : View.GONE);
+ mEmptyListView.setVisibility(!showListView ? View.VISIBLE : View.GONE);
+
if (mScrollToTop) {
- final ListView listView = getListView();
// The smooth-scroll animation happens over a fixed time period.
// As a result, if it scrolls through a large portion of the list,
// each frame will jump so far from the previous one that the user
@@ -294,7 +300,7 @@ public class CallLogFragment extends ListFragment
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
- getListView().setEmptyView(view.findViewById(R.id.empty_list_view));
+ mEmptyListView = view.findViewById(R.id.empty_list_view);
getListView().setItemsCanFocus(true);
maybeAddFooterView();
@@ -414,7 +420,7 @@ public class CallLogFragment extends ListFragment
+ filterType);
}
DialerUtils.configureEmptyListView(
- getListView().getEmptyView(), R.drawable.empty_call_log, messageId, getResources());
+ mEmptyListView, R.drawable.empty_call_log, messageId, getResources());
}
CallLogAdapter getAdapter() {