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

Commit 1c6298b6 authored by Gary Mai's avatar Gary Mai
Browse files

Editor expander changes

Missed tinting the phonetic name expander in ag/1417505.
Went ahead and did some refactoring since
phonetic_name_edit_expansion_view was the same as the name_edit one
but with a different content description. Removed it since content
description should be dynamic with the state of the expander anyway.
Along that line also made accessibility improvements and fixed a bug
with the state of the icon after rotation.

Test:
Checked the color of the phonetic name expander.
Actioned the expanders with Talkback on and made sure the correct
announcements were made.
Checked state of icon after rotation was consistent.

Bug: 30160325
Bug: 31033553
Change-Id: Ia62ed1a03b4edda81815387e3bcf4f48449699e2
parent 552e5828
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -22,7 +22,6 @@
    android:layout_width="wrap_content"
    android:layout_height="@dimen/editor_min_line_item_height"
    android:layout_gravity="top"
    android:contentDescription="@string/expand_collapse_name_fields_description"
    android:importantForAccessibility="yes"
    android:focusable="true"
    android:clickable="true">
+0 −40
Original line number Diff line number Diff line
<?xml version="1.0" encoding="utf-8"?>
<!--
  Copyright (C) 2015 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.
  -->

<FrameLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="@dimen/editor_min_line_item_height"
    android:layout_gravity="top"
    android:contentDescription="@string/expand_collapse_phonetic_name_fields_description"
    android:importantForAccessibility="yes"
    android:focusable="true"
    android:clickable="true">
    <ImageView
        android:id="@+id/expansion_view"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center"
        android:duplicateParentState="true"
        android:background="?android:attr/selectableItemBackground"
        android:paddingLeft="@dimen/editor_round_button_padding_left"
        android:paddingRight="@dimen/editor_round_button_padding_right"
        android:paddingStart="@dimen/editor_round_button_padding_left"
        android:paddingEnd="@dimen/editor_round_button_padding_right"
        android:paddingTop="@dimen/editor_round_button_padding_top"
        android:paddingBottom="@dimen/editor_round_button_padding_bottom" />
</FrameLayout>
+1 −1
Original line number Diff line number Diff line
@@ -35,7 +35,7 @@

    <include
        android:id="@+id/expansion_view_container"
        layout="@layout/phonetic_name_edit_expansion_view"
        layout="@layout/name_edit_expansion_view"
        android:visibility="visible" />

    <!-- This isn't used in PhoneticNameEditorView. It is only included so that
+21 −4
Original line number Diff line number Diff line
@@ -1278,11 +1278,28 @@
         fields corresponding to each part of the name (Name Prefix, First Name,
         Middle Name, Last Name, Name Suffix).
         [CHAR LIMIT=NONE] -->
    <string name="expand_collapse_name_fields_description">Expand or collapse name fields</string>
    <string name="expand_name_fields_description">Expand name fields</string>

    <!-- Content description for the expand or collapse phonetic name fields button. [CHAR LIMIT=100] -->
    <string name="expand_collapse_phonetic_name_fields_description">Expand or collapse phonetic
        name fields</string>
    <!-- Content description for the collapse name fields button. [CHAR LIMIT=NONE] -->
    <string name="collapse_name_fields_description">Collapse name fields</string>

    <!-- Content description for the expand phonetic name fields button. [CHAR LIMIT=NONE] -->
    <string name="expand_phonetic_name_fields_description">Expand phonetic name fields</string>

    <!-- Content description for the collapse phonetic name fields button. [CHAR LIMIT=NONE] -->
    <string name="collapse_phonetic_name_fields_description">Collapse phonetic name fields</string>

    <!-- Content description for a generic expand fields button. [CHAR LIMIT=NONE] -->
    <string name="expand_fields_description">Expand</string>

    <!-- Content description for a generic collapse fields button. [CHAR LIMIT=NONE] -->
    <string name="collapse_fields_description">Collapse</string>

    <!-- A11y announcement text for when a expand fields button is actioned. [CHAR LIMIT=NONE] -->
    <string name="announce_expanded_fields">Expanded</string>

    <!-- A11y announcement text for when a collapse fields button is actioned. [CHAR LIMIT=NONE] -->
    <string name="announce_collapsed_fields">Collapsed</string>

    <!-- Contact list filter label indicating that the list is showing all available accounts [CHAR LIMIT=64] -->
    <string name="list_filter_all_accounts">All contacts</string>
+12 −0
Original line number Diff line number Diff line
@@ -17,9 +17,11 @@
package com.android.contacts.editor;

import android.content.Context;
import android.content.res.Resources;
import android.text.TextUtils;
import android.util.AttributeSet;

import com.android.contacts.R;
import com.android.contacts.common.model.RawContactDelta;
import com.android.contacts.common.model.ValuesDelta;
import com.android.contacts.common.model.dataitem.DataKind;
@@ -101,6 +103,16 @@ public class PhoneticNameEditorView extends TextFieldsEditorView {
        super(context, attrs, defStyle);
    }

    @Override
    protected void onFinishInflate() {
        super.onFinishInflate();
        final Resources res = getResources();
        mCollapseButtonDescription = res
                .getString(R.string.collapse_phonetic_name_fields_description);
        mExpandButtonDescription = res
                .getString(R.string.expand_phonetic_name_fields_description);
    }

    @Override
    public void setValues(DataKind kind, ValuesDelta entry, RawContactDelta state, boolean readOnly,
            ViewIdGenerator vig) {
Loading