Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5d2e0fc1 authored by Fan Zhang's avatar Fan Zhang
Browse files

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
parent 9f5e7b77
Loading
Loading
Loading
Loading
+28 −0
Original line number Diff line number Diff line
<?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"/>
+9 −3
Original line number Diff line number Diff line
@@ -79,7 +79,8 @@ public class BaseTimeZoneAdapter<T extends BaseTimeZoneAdapter.AdapterItem>
        LayoutInflater inflater = LayoutInflater.from(parent.getContext());
        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();
    }