Support phone number talkback in about phone UI pages. Bug: 182923869 Test: local, junit Change-Id: I159827070a954dee13230ff7cf6de81dbbaa7545
58 lines
1.7 KiB
Java
58 lines
1.7 KiB
Java
/*
|
|
* Copyright (C) 2021 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.
|
|
*/
|
|
package com.android.settings.deviceinfo;
|
|
|
|
import android.content.Context;
|
|
import android.util.AttributeSet;
|
|
import android.widget.TextView;
|
|
|
|
import androidx.preference.Preference;
|
|
import androidx.preference.PreferenceViewHolder;
|
|
|
|
/**
|
|
* Preference which support phone number talkback in summary part.
|
|
*/
|
|
public class PhoneNumberSummaryPreference extends Preference {
|
|
|
|
/**
|
|
* Constructor
|
|
* @param context
|
|
*/
|
|
public PhoneNumberSummaryPreference(Context context) {
|
|
this(context, null);
|
|
}
|
|
|
|
/**
|
|
* Constructor
|
|
* @param context
|
|
* @param attrs
|
|
*/
|
|
public PhoneNumberSummaryPreference(Context context, AttributeSet attrs) {
|
|
super(context, attrs);
|
|
}
|
|
|
|
@Override
|
|
public void onBindViewHolder(PreferenceViewHolder holder) {
|
|
super.onBindViewHolder(holder);
|
|
|
|
// Expand text to support phone number talkback.
|
|
TextView summaryView = (TextView) holder.findViewById(android.R.id.summary);
|
|
if (summaryView != null) {
|
|
summaryView.setText(PhoneNumberUtil.expandByTts(summaryView.getText()));
|
|
}
|
|
}
|
|
}
|