Merge "Stop using framework internal layout for timezone header."
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
|
@Override
|
||||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||||
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
LayoutInflater inflater = LayoutInflater.from(parent.getContext());
|
||||||
switch(viewType) {
|
switch (viewType) {
|
||||||
case TYPE_HEADER: {
|
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);
|
parent, false);
|
||||||
return new HeaderViewHolder(view);
|
return new HeaderViewHolder(view);
|
||||||
}
|
}
|
||||||
@@ -136,7 +137,8 @@ public class BaseTimeZoneAdapter<T extends BaseTimeZoneAdapter.AdapterItem>
|
|||||||
return mShowHeader && position == 0;
|
return mShowHeader && position == 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public @NonNull ArrayFilter getFilter() {
|
@NonNull
|
||||||
|
public ArrayFilter getFilter() {
|
||||||
if (mFilter == null) {
|
if (mFilter == null) {
|
||||||
mFilter = new ArrayFilter();
|
mFilter = new ArrayFilter();
|
||||||
}
|
}
|
||||||
@@ -153,14 +155,18 @@ public class BaseTimeZoneAdapter<T extends BaseTimeZoneAdapter.AdapterItem>
|
|||||||
|
|
||||||
public interface AdapterItem {
|
public interface AdapterItem {
|
||||||
CharSequence getTitle();
|
CharSequence getTitle();
|
||||||
|
|
||||||
CharSequence getSummary();
|
CharSequence getSummary();
|
||||||
|
|
||||||
String getIconText();
|
String getIconText();
|
||||||
|
|
||||||
String getCurrentTime();
|
String getCurrentTime();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return unique non-negative number
|
* @return unique non-negative number
|
||||||
*/
|
*/
|
||||||
long getItemId();
|
long getItemId();
|
||||||
|
|
||||||
String[] getSearchKeys();
|
String[] getSearchKeys();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user