99 lines
4 KiB
Java
99 lines
4 KiB
Java
package com.discord.widgets.chat.input;
|
|
|
|
import android.text.TextUtils;
|
|
import com.discord.app.AppFragment;
|
|
import com.discord.utilities.view.text.TextWatcherKt;
|
|
import com.lytefast.flexinput.widget.FlexEditText;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: WidgetChatInputTruncatedHint.kt */
|
|
public final class WidgetChatInputTruncatedHint {
|
|
private final FlexEditText editText;
|
|
private CharSequence hint;
|
|
private boolean hintIsTruncated;
|
|
private int previousMaxLines;
|
|
|
|
/* compiled from: WidgetChatInputTruncatedHint.kt */
|
|
/* renamed from: com.discord.widgets.chat.input.WidgetChatInputTruncatedHint$1 reason: invalid class name */
|
|
public static final class AnonymousClass1 extends o implements Function1<Integer, Unit> {
|
|
public final /* synthetic */ WidgetChatInputTruncatedHint this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public AnonymousClass1(WidgetChatInputTruncatedHint widgetChatInputTruncatedHint) {
|
|
super(1);
|
|
this.this$0 = widgetChatInputTruncatedHint;
|
|
}
|
|
|
|
/* Return type fixed from 'java.lang.Object' to match base method */
|
|
/* JADX DEBUG: Method arguments types fixed to match base method, original types: [java.lang.Object] */
|
|
@Override // kotlin.jvm.functions.Function1
|
|
public /* bridge */ /* synthetic */ Unit invoke(Integer num) {
|
|
invoke(num.intValue());
|
|
return Unit.a;
|
|
}
|
|
|
|
public final void invoke(int i) {
|
|
if (!WidgetChatInputTruncatedHint.access$getHintIsTruncated$p(this.this$0)) {
|
|
WidgetChatInputTruncatedHint.access$setPreviousMaxLines$p(this.this$0, i);
|
|
}
|
|
}
|
|
}
|
|
|
|
public WidgetChatInputTruncatedHint(FlexEditText flexEditText) {
|
|
m.checkNotNullParameter(flexEditText, "editText");
|
|
this.editText = flexEditText;
|
|
this.previousMaxLines = flexEditText.getMaxLines();
|
|
flexEditText.setOnMaxLinesChangedListener(new AnonymousClass1(this));
|
|
}
|
|
|
|
public static final /* synthetic */ boolean access$getHintIsTruncated$p(WidgetChatInputTruncatedHint widgetChatInputTruncatedHint) {
|
|
return widgetChatInputTruncatedHint.hintIsTruncated;
|
|
}
|
|
|
|
public static final /* synthetic */ int access$getPreviousMaxLines$p(WidgetChatInputTruncatedHint widgetChatInputTruncatedHint) {
|
|
return widgetChatInputTruncatedHint.previousMaxLines;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setHintIsTruncated$p(WidgetChatInputTruncatedHint widgetChatInputTruncatedHint, boolean z2) {
|
|
widgetChatInputTruncatedHint.hintIsTruncated = z2;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$setPreviousMaxLines$p(WidgetChatInputTruncatedHint widgetChatInputTruncatedHint, int i) {
|
|
widgetChatInputTruncatedHint.previousMaxLines = i;
|
|
}
|
|
|
|
public static final /* synthetic */ void access$syncHint(WidgetChatInputTruncatedHint widgetChatInputTruncatedHint) {
|
|
widgetChatInputTruncatedHint.syncHint();
|
|
}
|
|
|
|
private final void syncHint() {
|
|
boolean z2 = this.editText.length() == 0;
|
|
this.hintIsTruncated = z2;
|
|
if (z2) {
|
|
this.editText.setMaxLines(1);
|
|
this.editText.setEllipsize(TextUtils.TruncateAt.END);
|
|
this.editText.setHint(this.hint);
|
|
return;
|
|
}
|
|
this.editText.setMaxLines(this.previousMaxLines);
|
|
this.editText.setEllipsize(null);
|
|
this.editText.setHint((CharSequence) null);
|
|
}
|
|
|
|
public final void addBindedTextWatcher(AppFragment appFragment) {
|
|
m.checkNotNullParameter(appFragment, "fragment");
|
|
TextWatcherKt.addBindedTextWatcher(this.editText, appFragment, new WidgetChatInputTruncatedHint$addBindedTextWatcher$1(this));
|
|
}
|
|
|
|
public final FlexEditText getEditText() {
|
|
return this.editText;
|
|
}
|
|
|
|
public final void setHint(CharSequence charSequence) {
|
|
m.checkNotNullParameter(charSequence, "hint");
|
|
this.hint = charSequence;
|
|
syncHint();
|
|
}
|
|
}
|