Merge "[Regional Preference] Add description for checked/not checked" into udc-qpr-dev am: 9635d1cf45
Original change: https://googleplex-android-review.googlesource.com/c/platform/packages/apps/Settings/+/24257533 Change-Id: I7f82cb95528fe96829f896ee5cb762ab401dd0a2 Signed-off-by: Automerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
This commit is contained in:
@@ -31,6 +31,7 @@ import android.view.ViewGroup;
|
||||
import android.widget.CheckBox;
|
||||
import android.widget.CompoundButton;
|
||||
|
||||
import androidx.annotation.VisibleForTesting;
|
||||
import androidx.core.view.MotionEventCompat;
|
||||
import androidx.recyclerview.widget.ItemTouchHelper;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
@@ -178,17 +179,33 @@ class LocaleDragAndDropAdapter
|
||||
// clear listener before setChecked() in case another item already bind to
|
||||
// current ViewHolder and checked event is triggered on stale listener mistakenly.
|
||||
checkbox.setOnCheckedChangeListener(null);
|
||||
checkbox.setChecked(mRemoveMode ? feedItem.getChecked() : false);
|
||||
boolean isChecked = mRemoveMode ? feedItem.getChecked() : false;
|
||||
checkbox.setChecked(isChecked);
|
||||
setCheckBoxDescription(dragCell, checkbox, isChecked);
|
||||
|
||||
checkbox.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
LocaleStore.LocaleInfo feedItem =
|
||||
(LocaleStore.LocaleInfo) dragCell.getTag();
|
||||
feedItem.setChecked(isChecked);
|
||||
setCheckBoxDescription(dragCell, checkbox, isChecked);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@VisibleForTesting
|
||||
protected void setCheckBoxDescription(LocaleDragCell dragCell, CheckBox checkbox,
|
||||
boolean isChecked) {
|
||||
CharSequence checkedStatus = mContext.getText(
|
||||
isChecked ? com.android.internal.R.string.checked
|
||||
: com.android.internal.R.string.not_checked);
|
||||
// Talkback
|
||||
dragCell.setStateDescription(checkedStatus);
|
||||
// Select to Speak
|
||||
checkbox.setContentDescription(checkedStatus);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
int itemCount = (null != mFeedItemList ? mFeedItemList.size() : 0);
|
||||
|
Reference in New Issue
Block a user