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
This commit is contained in:
28
res/layout/time_zone_search_header.xml
Normal file
28
res/layout/time_zone_search_header.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!--
|
||||
Copyright (C) 2019 The Android Open Source Project
|
||||
|
||||
Licensed under the Apache License, Version 2.0 (the "License");
|
||||
you may not use this file except in compliance with the License.
|
||||
You may obtain a copy of the License at
|
||||
|
||||
http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
Unless required by applicable law or agreed to in writing, software
|
||||
distributed under the License is distributed on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
-->
|
||||
<!-- similar to preference_material.xml but textview for emoji country flag
|
||||
instead of an ImageView -->
|
||||
|
||||
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+android:id/title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:textAppearance="@style/TextAppearance.CategoryTitle"
|
||||
android:textColor="?android:attr/colorAccent"
|
||||
android:paddingStart="@dimen/preference_no_icon_padding_start"/>
|
@@ -77,9 +77,10 @@ public class BaseTimeZoneAdapter<T extends BaseTimeZoneAdapter.AdapterItem>
|
||||
@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<T extends BaseTimeZoneAdapter.AdapterItem>
|
||||
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<T extends BaseTimeZoneAdapter.AdapterItem>
|
||||
|
||||
public interface AdapterItem {
|
||||
CharSequence getTitle();
|
||||
|
||||
CharSequence getSummary();
|
||||
|
||||
String getIconText();
|
||||
|
||||
String getCurrentTime();
|
||||
|
||||
/**
|
||||
* @return unique non-negative number
|
||||
*/
|
||||
long getItemId();
|
||||
|
||||
String[] getSearchKeys();
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user