Merge "Fix talkback issue with drop down menu" into udc-dev am: 25d7ad11ad

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/23638629

Change-Id: If752d40fba190ae97e1723bca631bff71e79c2a0
Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
TreeHugger Robot
2023-06-13 15:18:30 +00:00
committed by Automerger Merge Worker

View File

@@ -16,10 +16,6 @@
package com.android.systemui.screenrecord; package com.android.systemui.screenrecord;
import static com.android.systemui.screenrecord.ScreenRecordingAudioSource.INTERNAL;
import static com.android.systemui.screenrecord.ScreenRecordingAudioSource.MIC;
import static com.android.systemui.screenrecord.ScreenRecordingAudioSource.MIC_AND_INTERNAL;
import android.content.Context; import android.content.Context;
import android.content.res.Resources; import android.content.res.Resources;
import android.view.LayoutInflater; import android.view.LayoutInflater;
@@ -40,9 +36,6 @@ public class ScreenRecordingAdapter extends ArrayAdapter<ScreenRecordingAudioSou
private LinearLayout mSelectedMic; private LinearLayout mSelectedMic;
private LinearLayout mSelectedInternal; private LinearLayout mSelectedInternal;
private LinearLayout mSelectedMicAndInternal; private LinearLayout mSelectedMicAndInternal;
private LinearLayout mMicOption;
private LinearLayout mMicAndInternalOption;
private LinearLayout mInternalOption;
public ScreenRecordingAdapter(Context context, int resource, public ScreenRecordingAdapter(Context context, int resource,
List<ScreenRecordingAudioSource> objects) { List<ScreenRecordingAudioSource> objects) {
@@ -54,28 +47,21 @@ public class ScreenRecordingAdapter extends ArrayAdapter<ScreenRecordingAudioSou
mSelectedInternal = getSelected(R.string.screenrecord_device_audio_label); mSelectedInternal = getSelected(R.string.screenrecord_device_audio_label);
mSelectedMic = getSelected(R.string.screenrecord_mic_label); mSelectedMic = getSelected(R.string.screenrecord_mic_label);
mSelectedMicAndInternal = getSelected(R.string.screenrecord_device_audio_and_mic_label); mSelectedMicAndInternal = getSelected(R.string.screenrecord_device_audio_and_mic_label);
mMicOption = getOption(R.string.screenrecord_mic_label, Resources.ID_NULL);
mMicOption.removeViewAt(1);
mMicAndInternalOption = getOption(
R.string.screenrecord_device_audio_and_mic_label, Resources.ID_NULL);
mMicAndInternalOption.removeViewAt(1);
mInternalOption = getOption(R.string.screenrecord_device_audio_label,
R.string.screenrecord_device_audio_description);
} }
private LinearLayout getOption(int label, int description) { private LinearLayout getOption(int label, int description) {
LayoutInflater inflater = (LayoutInflater) getContext() LayoutInflater inflater = LayoutInflater.from(getContext());
.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
LinearLayout layout = (LinearLayout) inflater LinearLayout layout = (LinearLayout) inflater
.inflate(R.layout.screen_record_dialog_audio_source, null, false); .inflate(R.layout.screen_record_dialog_audio_source, null, false);
((TextView) layout.findViewById(R.id.screen_recording_dialog_source_text)) ((TextView) layout.findViewById(R.id.screen_recording_dialog_source_text))
.setText(label); .setText(label);
if (description != Resources.ID_NULL) TextView descriptionView = layout.findViewById(
((TextView) layout.findViewById(R.id.screen_recording_dialog_source_description)) R.id.screen_recording_dialog_source_description);
.setText(description); if (description != Resources.ID_NULL) {
descriptionView.setText(description);
} else {
descriptionView.setVisibility(View.GONE);
}
return layout; return layout;
} }
@@ -92,11 +78,13 @@ public class ScreenRecordingAdapter extends ArrayAdapter<ScreenRecordingAudioSou
public View getDropDownView(int position, View convertView, ViewGroup parent) { public View getDropDownView(int position, View convertView, ViewGroup parent) {
switch (getItem(position)) { switch (getItem(position)) {
case INTERNAL: case INTERNAL:
return mInternalOption; return getOption(R.string.screenrecord_device_audio_label,
R.string.screenrecord_device_audio_description);
case MIC_AND_INTERNAL: case MIC_AND_INTERNAL:
return mMicAndInternalOption; return getOption(
R.string.screenrecord_device_audio_and_mic_label, Resources.ID_NULL);
case MIC: case MIC:
return mMicOption; return getOption(R.string.screenrecord_mic_label, Resources.ID_NULL);
default: default:
return super.getDropDownView(position, convertView, parent); return super.getDropDownView(position, convertView, parent);
} }