From 5d2e0fc10f9b8dd03630683bc788cfce7131ae95 Mon Sep 17 00:00:00 2001 From: Fan Zhang Date: Mon, 18 Mar 2019 16:37:28 -0700 Subject: [PATCH] Stop using framework internal layout for timezone header. The framework version header has deviated from supportlib version long ago, and we shouldn't hack our theme to make this layout work. Instead we now have a custom layout compatible to settings theme. Fixes: 128833223 Test: visual Change-Id: I83087352240de183b0639daf844bd7f90e02056a --- res/layout/time_zone_search_header.xml | 28 +++++++++++++++++++ .../timezone/BaseTimeZoneAdapter.java | 12 ++++++-- 2 files changed, 37 insertions(+), 3 deletions(-) create mode 100644 res/layout/time_zone_search_header.xml diff --git a/res/layout/time_zone_search_header.xml b/res/layout/time_zone_search_header.xml new file mode 100644 index 00000000000..5c4e0ee6b71 --- /dev/null +++ b/res/layout/time_zone_search_header.xml @@ -0,0 +1,28 @@ + + + + + diff --git a/src/com/android/settings/datetime/timezone/BaseTimeZoneAdapter.java b/src/com/android/settings/datetime/timezone/BaseTimeZoneAdapter.java index ff980b2ceca..66735c8a5e1 100644 --- a/src/com/android/settings/datetime/timezone/BaseTimeZoneAdapter.java +++ b/src/com/android/settings/datetime/timezone/BaseTimeZoneAdapter.java @@ -77,9 +77,10 @@ public class BaseTimeZoneAdapter @Override public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) { LayoutInflater inflater = LayoutInflater.from(parent.getContext()); - switch(viewType) { + switch (viewType) { case TYPE_HEADER: { - final View view = inflater.inflate(R.layout.preference_category_material, + final View view = inflater.inflate( + R.layout.time_zone_search_header, parent, false); return new HeaderViewHolder(view); } @@ -136,7 +137,8 @@ public class BaseTimeZoneAdapter return mShowHeader && position == 0; } - public @NonNull ArrayFilter getFilter() { + @NonNull + public ArrayFilter getFilter() { if (mFilter == null) { mFilter = new ArrayFilter(); } @@ -153,14 +155,18 @@ public class BaseTimeZoneAdapter public interface AdapterItem { CharSequence getTitle(); + CharSequence getSummary(); + String getIconText(); + String getCurrentTime(); /** * @return unique non-negative number */ long getItemId(); + String[] getSearchKeys(); }