diff options
author | Andrew Lee <anwlee@google.com> | 2015-10-21 01:27:04 -0700 |
---|---|---|
committer | Andrew Lee <anwlee@google.com> | 2015-10-21 01:27:04 -0700 |
commit | d625d28ec6cf22c128d0ef0b8e64a9fff4b64aec (patch) | |
tree | 107564f429b2d5211cca417d1dba9f5ee5f077c2 /src | |
parent | 9af1b36e999036f4045b07285962cfdb7bfbcca7 (diff) |
Fix scrolling in blocked numbers list.
+ Add elements as header, so they scroll with the list.
+ Shuffle around some layouts to make this work correctly.
+ Replace default ListView divider with custom drawable, to achieve
the desired effect of removing the divider on the first list item.
+ Override BlockedNumberAdapter to never report itself as empty.
Otherwise, the header will disappear.
+ Tweak some padding.
Bug: 25134186
Change-Id: I07711437fea2d3042d3987983667ab5316d51fcc
Diffstat (limited to 'src')
-rw-r--r-- | src/com/android/dialer/filterednumber/BlockedNumberAdapter.java | 8 | ||||
-rw-r--r-- | src/com/android/dialer/filterednumber/BlockedNumbersFragment.java | 4 |
2 files changed, 11 insertions, 1 deletions
diff --git a/src/com/android/dialer/filterednumber/BlockedNumberAdapter.java b/src/com/android/dialer/filterednumber/BlockedNumberAdapter.java index 6cd99c6b8..7777aeb71 100644 --- a/src/com/android/dialer/filterednumber/BlockedNumberAdapter.java +++ b/src/com/android/dialer/filterednumber/BlockedNumberAdapter.java @@ -64,7 +64,7 @@ public class BlockedNumberAdapter extends NumberAdapter { normalizedNumber, number, countryIso, - null, + number, R.id.blocked_number_fragment, getFragmentManager(), null /* callback */); @@ -73,4 +73,10 @@ public class BlockedNumberAdapter extends NumberAdapter { updateView(view, number, countryIso); } + + @Override + public boolean isEmpty() { + // Always return false, so that the header with blocking-related options always shows. + return false; + } } diff --git a/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java b/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java index 2f7b2f169..c478b8301 100644 --- a/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java +++ b/src/com/android/dialer/filterednumber/BlockedNumbersFragment.java @@ -57,6 +57,10 @@ public class BlockedNumbersFragment extends ListFragment public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); + LayoutInflater inflater = + (LayoutInflater) getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE); + getListView().addHeaderView(inflater.inflate(R.layout.blocked_number_header, null)); + if (mAdapter == null) { mAdapter = BlockedNumberAdapter.newBlockedNumberAdapter( getContext(), getActivity().getFragmentManager()); |