what-the-bank/sources/io/flutter/embedding/engine/systemchannels/AccessibilityChannel.java

138 lines
5.3 KiB
Java

package io.flutter.embedding.engine.systemchannels;
import io.flutter.Log;
import io.flutter.embedding.engine.FlutterJNI;
import io.flutter.embedding.engine.dart.DartExecutor;
import io.flutter.plugin.common.BasicMessageChannel;
import io.flutter.plugin.common.StandardMessageCodec;
import io.flutter.view.AccessibilityBridge;
import java.util.HashMap;
/* loaded from: classes.dex */
public class AccessibilityChannel {
private static final String TAG = "AccessibilityChannel";
public final BasicMessageChannel<Object> channel;
public final FlutterJNI flutterJNI;
private AccessibilityMessageHandler handler;
final BasicMessageChannel.MessageHandler<Object> parsingMessageHandler;
/* loaded from: classes.dex */
public interface AccessibilityMessageHandler extends FlutterJNI.AccessibilityDelegate {
void announce(String str);
void onLongPress(int i);
void onTap(int i);
void onTooltip(String str);
}
public AccessibilityChannel(DartExecutor dartExecutor, FlutterJNI flutterJNI) {
BasicMessageChannel.MessageHandler<Object> messageHandler = new BasicMessageChannel.MessageHandler<Object>(this) { // from class: io.flutter.embedding.engine.systemchannels.AccessibilityChannel.1
final AccessibilityChannel this$0;
{
this.this$0 = this;
}
/* JADX WARN: Can't fix incorrect switch cases order, some code will duplicate */
@Override // io.flutter.plugin.common.BasicMessageChannel.MessageHandler
public void onMessage(Object obj, BasicMessageChannel.Reply<Object> reply) {
char c;
Integer num;
if (this.this$0.handler == null) {
reply.reply(null);
return;
}
HashMap hashMap = (HashMap) obj;
String str = (String) hashMap.get("type");
HashMap hashMap2 = (HashMap) hashMap.get("data");
Log.v(AccessibilityChannel.TAG, "Received " + str + " message.");
str.hashCode();
switch (str.hashCode()) {
case -1140076541:
if (str.equals("tooltip")) {
c = 0;
break;
}
c = 65535;
break;
case -649620375:
if (str.equals("announce")) {
c = 1;
break;
}
c = 65535;
break;
case 114595:
if (str.equals("tap")) {
c = 2;
break;
}
c = 65535;
break;
case 114203431:
if (str.equals("longPress")) {
c = 3;
break;
}
c = 65535;
break;
default:
c = 65535;
break;
}
if (c == 0) {
String str2 = (String) hashMap2.get("message");
if (str2 != null) {
this.this$0.handler.onTooltip(str2);
}
} else if (c == 1) {
String str3 = (String) hashMap2.get("message");
if (str3 != null) {
this.this$0.handler.announce(str3);
}
} else if (c == 2) {
Integer num2 = (Integer) hashMap.get("nodeId");
if (num2 != null) {
this.this$0.handler.onTap(num2.intValue());
}
} else if (c == 3 && (num = (Integer) hashMap.get("nodeId")) != null) {
this.this$0.handler.onLongPress(num.intValue());
}
reply.reply(null);
}
};
this.parsingMessageHandler = messageHandler;
BasicMessageChannel<Object> basicMessageChannel = new BasicMessageChannel<>(dartExecutor, "flutter/accessibility", StandardMessageCodec.INSTANCE);
this.channel = basicMessageChannel;
basicMessageChannel.setMessageHandler(messageHandler);
this.flutterJNI = flutterJNI;
}
public void onAndroidAccessibilityEnabled() {
this.flutterJNI.setSemanticsEnabled(true);
}
public void onAndroidAccessibilityDisabled() {
this.flutterJNI.setSemanticsEnabled(false);
}
public void setAccessibilityFeatures(int i) {
this.flutterJNI.setAccessibilityFeatures(i);
}
public void dispatchSemanticsAction(int i, AccessibilityBridge.Action action) {
this.flutterJNI.dispatchSemanticsAction(i, action);
}
public void dispatchSemanticsAction(int i, AccessibilityBridge.Action action, Object obj) {
this.flutterJNI.dispatchSemanticsAction(i, action, obj);
}
public void setAccessibilityMessageHandler(AccessibilityMessageHandler accessibilityMessageHandler) {
this.handler = accessibilityMessageHandler;
this.flutterJNI.setAccessibilityDelegate(accessibilityMessageHandler);
}
}