downgraded to previous state,because some code will works incorrect

This commit is contained in:
AlexandrKozlovskiy 2024-01-01 20:25:57 +03:00
parent b693689b11
commit d5ee96dd46
2 changed files with 10 additions and 11 deletions

View file

@ -21924,7 +21924,7 @@ CONTACT_VIEW = -1;
getLocationOnScreen(loc); getLocationOnScreen(loc);
r.offset(loc[0],loc[1]); r.offset(loc[0],loc[1]);
scrollBy(r.left, r.top); scrollBy(r.left, r.top);
//announceForAccessibility(getIterableTextForAccessibility()); //announceForAccessibility(accessibilityText);
} }
return getAccessibilityNodeProvider().performAction(currentFocusedVirtualView,action,arguments); return getAccessibilityNodeProvider().performAction(currentFocusedVirtualView,action,arguments);
}*/ }*/
@ -21991,8 +21991,8 @@ CONTACT_VIEW = -1;
event.setScrollX(getScrollX()); event.setScrollX(getScrollX());
event.setScrollY(getScrollY()); event.setScrollY(getScrollY());
if(seekBarAccessibilityDelegate!=null &&currentFocusedVirtualView==-1) seekBarAccessibilityDelegate.onInitializeAccessibilityEvent(ChatMessageCell.this,event); if(seekBarAccessibilityDelegate!=null &&currentFocusedVirtualView==-1) seekBarAccessibilityDelegate.onInitializeAccessibilityEvent(ChatMessageCell.this,event);
CharSequence accText =getIterableTextForAccessibility(); setAccessibilityTextIfNeeded();
if(event.getText().size() ==0) event.setContentDescription(accText); if(event.getText().size() ==0) event.setContentDescription(accessibilityText);
} }
@Override @Override
@ -22044,8 +22044,7 @@ CONTACT_VIEW = -1;
public int[] getCoords(Boolean back) { public int[] getCoords(Boolean back) {
return getCoords(back,false); return getCoords(back,false);
} }
//To support diferents granularities for talkback. See sources of View class in android sdk sources. public void setAccessibilityTextIfNeeded() {
public CharSequence getIterableTextForAccessibility() {
final boolean unread = currentMessageObject != null && currentMessageObject.isOut() && !currentMessageObject.scheduled && currentMessageObject.isUnread(); final boolean unread = currentMessageObject != null && currentMessageObject.isOut() && !currentMessageObject.scheduled && currentMessageObject.isUnread();
final boolean contentUnread = currentMessageObject != null && currentMessageObject.isContentUnread(); final boolean contentUnread = currentMessageObject != null && currentMessageObject.isContentUnread();
final long fileSize = currentMessageObject != null ? currentMessageObject.loadedFileSize : 0; final long fileSize = currentMessageObject != null ? currentMessageObject.loadedFileSize : 0;
@ -22168,13 +22167,13 @@ CONTACT_VIEW = -1;
sb.append("\n"); sb.append("\n");
sb.append(LocaleController.getString("AccDescrMsgSendingError", R.string.AccDescrMsgSendingError)); sb.append(LocaleController.getString("AccDescrMsgSendingError", R.string.AccDescrMsgSendingError));
} }
} else if(currentTimeString!=null) { } else if(currentTimeString.length()>0) {
sb.append("\n"); sb.append("\n");
sb.append(LocaleController.formatString("AccDescrReceivedDate", R.string.AccDescrReceivedDate, LocaleController.getString("TodayAt", R.string.TodayAt) + " " + currentTimeString)); sb.append(LocaleController.formatString("AccDescrReceivedDate", R.string.AccDescrReceivedDate, LocaleController.getString("TodayAt", R.string.TodayAt) + " " + currentTimeString));
} }
if(currentMessageObject.isSponsored()) { if(currentMessageObject.isSponsored()) {
sb.append("\n"); sb.append("\n");
sb.append(LocaleController.getString("Sponsored")); sb.append(LocaleController.getString("SponsoredMessage",R.string.SponsoredMessage));
} }
if (getRepliesCount() > 0 && !hasCommentLayout()) { if (getRepliesCount() > 0 && !hasCommentLayout()) {
sb.append("\n"); sb.append("\n");
@ -22248,14 +22247,11 @@ CONTACT_VIEW = -1;
}; };
sb.setSpan(underlineSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE); sb.setSpan(underlineSpan, start, end, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
} }
//if some info has changed,such as message become read or played,etc,update our variable.
//if(accessibilityText==null ||!sb.toString().equals(accessibilityText.toString())) accessibilityText = sb;
accessibilityText = sb; accessibilityText = sb;
accessibilityTextUnread = unread; accessibilityTextUnread = unread;
accessibilityTextContentUnread = contentUnread; accessibilityTextContentUnread = contentUnread;
accessibilityTextFileSize = fileSize; accessibilityTextFileSize = fileSize;
} }
return accessibilityText;
} }
@Override @Override
@ -22571,7 +22567,7 @@ CONTACT_VIEW = -1;
if (virtualViewId == HOST_VIEW_ID) { if (virtualViewId == HOST_VIEW_ID) {
AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(ChatMessageCell.this); AccessibilityNodeInfo info = AccessibilityNodeInfo.obtain(ChatMessageCell.this);
onInitializeAccessibilityNodeInfo(info); onInitializeAccessibilityNodeInfo(info);
if (accessibilityText == null) getIterableTextForAccessibility(); setAccessibilityTextIfNeeded();
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.N) {
info.setContentDescription(accessibilityText.toString()); info.setContentDescription(accessibilityText.toString());
} else { } else {

View file

@ -2974,6 +2974,8 @@ public class RecyclerListView extends RecyclerView {
} }
@Override @Override
public boolean performAccessibilityAction(int action, Bundle arguments) { public boolean performAccessibilityAction(int action, Bundle arguments) {
//This code works not always correct,because i dont know,how to get correct coordinate,to scroll to next/previous item,to scroll to it. item.
/*
if(action==AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD ||action==AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) { if(action==AccessibilityNodeInfo.ACTION_SCROLL_BACKWARD ||action==AccessibilityNodeInfo.ACTION_SCROLL_FORWARD) {
if(getLayoutManager() instanceof GridLayoutManagerFixed) { if(getLayoutManager() instanceof GridLayoutManagerFixed) {
GridLayoutManagerFixed g=(GridLayoutManagerFixed) getLayoutManager(); GridLayoutManagerFixed g=(GridLayoutManagerFixed) getLayoutManager();
@ -3009,6 +3011,7 @@ if(findViewHolderForLayoutPosition(pos)!=null &&findViewHolderForLayoutPosition(
} }
} }
} }
*/
return super.performAccessibilityAction(action,arguments); return super.performAccessibilityAction(action,arguments);
} }
} }