discord-jadx/app/src/main/java/com/discord/widgets/chat/input/WidgetChatInputEditText$set...

35 lines
1.5 KiB
Java

package com.discord.widgets.chat.input;
import android.view.KeyEvent;
import android.view.View;
import com.discord.stores.StoreStream;
import d0.z.d.m;
import kotlin.Unit;
import kotlin.jvm.functions.Function0;
/* compiled from: WidgetChatInputEditText.kt */
public final class WidgetChatInputEditText$setHardwareKeyboardSendBehavior$1 implements View.OnKeyListener {
public final /* synthetic */ WidgetChatInputEditText this$0;
public WidgetChatInputEditText$setHardwareKeyboardSendBehavior$1(WidgetChatInputEditText widgetChatInputEditText) {
this.this$0 = widgetChatInputEditText;
}
@Override // android.view.View.OnKeyListener
public final boolean onKey(View view, int i, KeyEvent keyEvent) {
Function0<Unit> onSendListener;
m.checkNotNullParameter(keyEvent, "event");
boolean z2 = (keyEvent.getFlags() & 2) == 2;
if ((i == 66) && !z2) {
boolean hasModifiers = keyEvent.hasModifiers(1);
boolean isShiftEnterToSendEnabled = StoreStream.Companion.getUserSettings().getIsShiftEnterToSendEnabled();
if ((isShiftEnterToSendEnabled && hasModifiers) || (!isShiftEnterToSendEnabled && !hasModifiers)) {
if (!(this.this$0.getOnSendListener() == null || keyEvent.getAction() != 1 || (onSendListener = this.this$0.getOnSendListener()) == null)) {
onSendListener.mo1invoke();
}
return true;
}
}
return false;
}
}