590 lines
27 KiB
Java
590 lines
27 KiB
Java
package com.discord.chips_view;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Resources;
|
|
import android.content.res.TypedArray;
|
|
import android.graphics.Color;
|
|
import android.graphics.PorterDuff;
|
|
import android.graphics.Rect;
|
|
import android.graphics.drawable.Drawable;
|
|
import android.net.Uri;
|
|
import android.text.Editable;
|
|
import android.text.TextWatcher;
|
|
import android.text.style.LeadingMarginSpan;
|
|
import android.util.AttributeSet;
|
|
import android.util.Log;
|
|
import android.view.KeyEvent;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import android.view.inputmethod.InputConnection;
|
|
import android.view.inputmethod.InputConnectionWrapper;
|
|
import android.widget.LinearLayout;
|
|
import android.widget.RelativeLayout;
|
|
import android.widget.ScrollView;
|
|
import android.widget.TextView;
|
|
import androidx.core.content.ContextCompat;
|
|
import c.a.f.a;
|
|
import c.a.f.d;
|
|
import c.a.f.e;
|
|
import c.a.f.f;
|
|
import c.a.f.g;
|
|
import c.a.f.h;
|
|
import com.discord.chips_view.ChipsView.a;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import com.facebook.imagepipeline.request.ImageRequest;
|
|
import com.facebook.imagepipeline.request.ImageRequestBuilder;
|
|
import d0.g0.w;
|
|
import d0.t.u;
|
|
import d0.z.d.m;
|
|
import java.util.Collection;
|
|
import java.util.Iterator;
|
|
import java.util.LinkedHashMap;
|
|
import java.util.Map;
|
|
import java.util.Objects;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function1;
|
|
/* compiled from: ChipsView.kt */
|
|
public final class ChipsView<K, V extends a> extends ScrollView implements d.a {
|
|
public static final /* synthetic */ int i = 0;
|
|
public final c.a.f.d A;
|
|
public e B;
|
|
public final LinkedHashMap<K, c.a.f.a<K, V>> C = new LinkedHashMap<>();
|
|
public Object D;
|
|
public Function1<? super V, Unit> E;
|
|
public Function1<? super V, Unit> F;
|
|
public Function1<? super CharSequence, Unit> G;
|
|
public int j;
|
|
public int k;
|
|
public int l;
|
|
public int m;
|
|
public int n;
|
|
public int o;
|
|
public int p;
|
|
public int q;
|
|
public int r;
|
|
|
|
/* renamed from: s reason: collision with root package name */
|
|
public int f1592s;
|
|
public int t;
|
|
public int u;
|
|
public float v;
|
|
public int w;
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
|
public int f1593x;
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
|
public float f1594y;
|
|
|
|
/* renamed from: z reason: collision with root package name */
|
|
public final RelativeLayout f1595z;
|
|
|
|
/* compiled from: ChipsView.kt */
|
|
public interface a {
|
|
String getDisplayString();
|
|
}
|
|
|
|
/* compiled from: ChipsView.kt */
|
|
public final class b implements TextWatcher {
|
|
public b() {
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void afterTextChanged(Editable editable) {
|
|
m.checkNotNullParameter(editable, "s");
|
|
Function1<CharSequence, Unit> textChangedListener = ChipsView.this.getTextChangedListener();
|
|
if (textChangedListener != null) {
|
|
textChangedListener.invoke(editable);
|
|
}
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void beforeTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
m.checkNotNullParameter(charSequence, "s");
|
|
}
|
|
|
|
@Override // android.text.TextWatcher
|
|
public void onTextChanged(CharSequence charSequence, int i, int i2, int i3) {
|
|
m.checkNotNullParameter(charSequence, "s");
|
|
}
|
|
}
|
|
|
|
/* compiled from: ChipsView.kt */
|
|
public final class c extends InputConnectionWrapper {
|
|
public c(InputConnection inputConnection) {
|
|
super(inputConnection, true);
|
|
}
|
|
|
|
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
|
|
public boolean commitText(CharSequence charSequence, int i) {
|
|
m.checkNotNullParameter(charSequence, "text");
|
|
return super.commitText(charSequence, i);
|
|
}
|
|
|
|
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
|
|
public boolean deleteSurroundingText(int i, int i2) {
|
|
return (ChipsView.this.A.length() == 0 && i == 1 && i2 == 0) ? sendKeyEvent(new KeyEvent(0, 67)) && sendKeyEvent(new KeyEvent(1, 67)) : super.deleteSurroundingText(i, i2);
|
|
}
|
|
|
|
@Override // android.view.inputmethod.InputConnectionWrapper, android.view.inputmethod.InputConnection
|
|
public boolean sendKeyEvent(KeyEvent keyEvent) {
|
|
m.checkNotNullParameter(keyEvent, "event");
|
|
if (!(ChipsView.this.A.length() == 0 && keyEvent.getAction() == 0 && keyEvent.getKeyCode() == 67)) {
|
|
return super.sendKeyEvent(keyEvent);
|
|
}
|
|
ChipsView chipsView = ChipsView.this;
|
|
if (chipsView.C.size() <= 0) {
|
|
return true;
|
|
}
|
|
try {
|
|
c.a.f.a<K, V> aVar = null;
|
|
for (Map.Entry<K, c.a.f.a<K, V>> entry : chipsView.C.entrySet()) {
|
|
aVar = entry.getValue();
|
|
}
|
|
if (aVar == null) {
|
|
return true;
|
|
}
|
|
chipsView.c(aVar);
|
|
return true;
|
|
} catch (IndexOutOfBoundsException e) {
|
|
Log.e("ChipsView", "Out of bounds", e);
|
|
return true;
|
|
}
|
|
}
|
|
}
|
|
|
|
/* compiled from: ChipsView.kt */
|
|
public static final class d implements Runnable {
|
|
public final /* synthetic */ ChipsView i;
|
|
public final /* synthetic */ boolean j;
|
|
|
|
public d(ChipsView chipsView, boolean z2) {
|
|
this.i = chipsView;
|
|
this.j = z2;
|
|
}
|
|
|
|
@Override // java.lang.Runnable
|
|
public final void run() {
|
|
ChipsView chipsView = this.i;
|
|
boolean z2 = this.j;
|
|
int i = ChipsView.i;
|
|
chipsView.d(z2);
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: finally extract failed */
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public ChipsView(Context context, AttributeSet attributeSet) {
|
|
super(context, attributeSet);
|
|
m.checkNotNullParameter(context, "context");
|
|
m.checkNotNullParameter(attributeSet, "attrs");
|
|
Resources resources = getResources();
|
|
m.checkNotNullExpressionValue(resources, "resources");
|
|
this.f1594y = resources.getDisplayMetrics().density;
|
|
RelativeLayout relativeLayout = new RelativeLayout(getContext());
|
|
this.f1595z = relativeLayout;
|
|
addView(relativeLayout);
|
|
LinearLayout linearLayout = new LinearLayout(getContext());
|
|
linearLayout.setLayoutParams(new ViewGroup.LayoutParams(0, 0));
|
|
linearLayout.setFocusable(true);
|
|
linearLayout.setFocusableInTouchMode(true);
|
|
relativeLayout.addView(linearLayout);
|
|
Context context2 = getContext();
|
|
m.checkNotNullExpressionValue(context2, "context");
|
|
c.a.f.d dVar = new c.a.f.d(context2, this);
|
|
this.A = dVar;
|
|
TypedArray obtainStyledAttributes = context.getTheme().obtainStyledAttributes(attributeSet, R.e.ChipsView, 0, 0);
|
|
m.checkNotNullExpressionValue(obtainStyledAttributes, "context.theme.obtainStyl…tyleable.ChipsView, 0, 0)");
|
|
try {
|
|
this.k = obtainStyledAttributes.getDimensionPixelSize(R.e.ChipsView_cv_max_height, -1);
|
|
this.l = obtainStyledAttributes.getDimensionPixelSize(R.e.ChipsView_cv_vertical_spacing, (int) (((float) 1) * this.f1594y));
|
|
this.m = obtainStyledAttributes.getDimensionPixelSize(R.e.ChipsView_cv_height, (int) (((float) 24) * this.f1594y));
|
|
this.n = obtainStyledAttributes.getColor(R.e.ChipsView_cv_color, ContextCompat.getColor(context, 17170432));
|
|
this.o = obtainStyledAttributes.getColor(R.e.ChipsView_cv_color_clicked, ContextCompat.getColor(context, 17170443));
|
|
this.p = obtainStyledAttributes.getColor(R.e.ChipsView_cv_bg_color, ContextCompat.getColor(context, 17170443));
|
|
this.j = obtainStyledAttributes.getResourceId(R.e.ChipsView_cv_chip_bg_res, 0);
|
|
this.q = obtainStyledAttributes.getColor(R.e.ChipsView_cv_bg_color_clicked, ContextCompat.getColor(context, 17170451));
|
|
this.r = obtainStyledAttributes.getColor(R.e.ChipsView_cv_text_color, -16777216);
|
|
this.f1592s = obtainStyledAttributes.getColor(R.e.ChipsView_cv_text_color_clicked, -1);
|
|
this.w = obtainStyledAttributes.getResourceId(R.e.ChipsView_cv_hint, 0);
|
|
obtainStyledAttributes.getResourceId(R.e.ChipsView_cv_icon_placeholder, 0);
|
|
this.t = obtainStyledAttributes.getResourceId(R.e.ChipsView_cv_icon_delete, 0);
|
|
this.u = obtainStyledAttributes.getColor(R.e.ChipsView_cv_search_text_color, -16777216);
|
|
this.v = (float) obtainStyledAttributes.getDimensionPixelSize(R.e.ChipsView_cv_search_text_size, 49);
|
|
this.f1593x = obtainStyledAttributes.getResourceId(R.e.ChipsView_cv_chip_layout, R.d.view_chip_default);
|
|
obtainStyledAttributes.recycle();
|
|
int i2 = this.m + this.l;
|
|
RelativeLayout.LayoutParams layoutParams = new RelativeLayout.LayoutParams(-1, i2);
|
|
float f = (float) 4;
|
|
layoutParams.leftMargin = (int) (this.f1594y * f);
|
|
layoutParams.addRule(12, -1);
|
|
dVar.setLayoutParams(layoutParams);
|
|
dVar.setPadding(0, 0, 0, this.l);
|
|
dVar.setBackgroundColor(Color.argb(0, 0, 0, 0));
|
|
dVar.setImeOptions(268435456);
|
|
dVar.setInputType(1);
|
|
dVar.setTextColor(this.u);
|
|
dVar.setTextSize(0, this.v);
|
|
relativeLayout.addView(dVar);
|
|
Context context3 = getContext();
|
|
m.checkNotNullExpressionValue(context3, "context");
|
|
e eVar = new e(context3, i2);
|
|
eVar.setOrientation(1);
|
|
eVar.setLayoutParams(new ViewGroup.LayoutParams(-1, -2));
|
|
eVar.setPadding(0, (int) (f * this.f1594y), 0, 0);
|
|
this.B = eVar;
|
|
relativeLayout.addView(eVar);
|
|
relativeLayout.setOnClickListener(new h(this));
|
|
dVar.addTextChangedListener(new b());
|
|
dVar.setOnFocusChangeListener(new g(this));
|
|
d(false);
|
|
} catch (Throwable th) {
|
|
obtainStyledAttributes.recycle();
|
|
throw th;
|
|
}
|
|
}
|
|
|
|
@Override // c.a.f.d.a
|
|
public InputConnection a(InputConnection inputConnection) {
|
|
return new c(inputConnection);
|
|
}
|
|
|
|
public final void b(String str, Uri uri, K k, V v) {
|
|
if (!this.C.containsKey(k)) {
|
|
this.A.setText("");
|
|
c.a.f.a<K, V> aVar = new c.a.f.a<>(str, uri, k, v, false, new a.C0023a(this.q, this.f1594y, this.j, this.p, this.r, this.t, this.f1592s, this.o, this.n, this.m, this.f1593x), this);
|
|
this.C.put(k, aVar);
|
|
Function1<? super V, Unit> function1 = this.E;
|
|
if (function1 != null) {
|
|
function1.invoke(aVar.n);
|
|
}
|
|
d(true);
|
|
post(new f(this));
|
|
Editable text = this.A.getText();
|
|
if (text != null) {
|
|
Object obj = this.D;
|
|
if (obj != null) {
|
|
text.removeSpan(obj);
|
|
}
|
|
text.setSpan(this.D, 0, 0, 17);
|
|
}
|
|
this.A.setText(text);
|
|
}
|
|
}
|
|
|
|
public final void c(c.a.f.a<K, V> aVar) {
|
|
m.checkNotNullParameter(aVar, "chip");
|
|
f(aVar);
|
|
if (aVar.j) {
|
|
this.C.remove(aVar.m);
|
|
Function1<? super V, Unit> function1 = this.F;
|
|
if (function1 != null) {
|
|
function1.invoke(aVar.n);
|
|
}
|
|
d(true);
|
|
return;
|
|
}
|
|
if (!aVar.o) {
|
|
aVar.j = true;
|
|
}
|
|
d(false);
|
|
}
|
|
|
|
/* JADX DEBUG: Multi-variable search result rejected for r11v18, resolved type: android.view.LayoutInflater */
|
|
/* JADX WARN: Multi-variable type inference failed */
|
|
/* JADX WARNING: Removed duplicated region for block: B:112:0x0226 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:113:0x0229 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:116:0x023f */
|
|
/* JADX WARNING: Removed duplicated region for block: B:117:0x0247 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:72:0x019b */
|
|
/* JADX WARNING: Removed duplicated region for block: B:91:0x01e5 */
|
|
/* JADX WARNING: Unknown variable types count: 2 */
|
|
public final void d(boolean z2) {
|
|
LinearLayout linearLayout;
|
|
Iterator<c.a.f.a<K, V>> it;
|
|
RelativeLayout relativeLayout;
|
|
RelativeLayout relativeLayout2;
|
|
LinearLayout linearLayout2;
|
|
SimpleDraweeView simpleDraweeView;
|
|
Drawable background;
|
|
TextView textView;
|
|
RelativeLayout relativeLayout3;
|
|
Drawable background2;
|
|
SimpleDraweeView simpleDraweeView2;
|
|
TextView textView2;
|
|
RelativeLayout relativeLayout4;
|
|
Drawable background3;
|
|
TextView textView3;
|
|
TextView textView4;
|
|
SimpleDraweeView simpleDraweeView3;
|
|
RelativeLayout relativeLayout5;
|
|
RelativeLayout relativeLayout6;
|
|
e eVar = this.B;
|
|
e.a aVar = null;
|
|
?? r3 = 0;
|
|
aVar = null;
|
|
if (eVar != null) {
|
|
Collection<c.a.f.a<K, V>> values = this.C.values();
|
|
m.checkNotNullExpressionValue(values, "mChipList.values");
|
|
m.checkNotNullParameter(values, "chips");
|
|
for (LinearLayout linearLayout3 : eVar.i) {
|
|
linearLayout3.removeAllViews();
|
|
}
|
|
eVar.i.clear();
|
|
eVar.removeAllViews();
|
|
int width = eVar.getWidth();
|
|
if (width != 0) {
|
|
LinearLayout a2 = eVar.a();
|
|
int i2 = 0;
|
|
int i3 = 0;
|
|
for (Iterator<c.a.f.a<K, V>> it2 = values.iterator(); it2.hasNext(); it2 = it) {
|
|
c.a.f.a<K, V> next = it2.next();
|
|
if (next.i == null) {
|
|
View inflate = LayoutInflater.from(next.q.getContext()).inflate(R.d.view_chip_default, (ViewGroup) r3, false);
|
|
int i4 = R.c.chip_image;
|
|
SimpleDraweeView simpleDraweeView4 = (SimpleDraweeView) inflate.findViewById(i4);
|
|
if (simpleDraweeView4 != null) {
|
|
i4 = R.c.chip_text;
|
|
TextView textView5 = (TextView) inflate.findViewById(i4);
|
|
if (textView5 != null) {
|
|
next.i = new c.a.f.i.a((RelativeLayout) inflate, simpleDraweeView4, textView5);
|
|
LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(-2, next.p.j);
|
|
layoutParams.setMargins(layoutParams.leftMargin, layoutParams.topMargin, (int) (((float) 4) * next.p.b), layoutParams.bottomMargin);
|
|
c.a.f.i.a aVar2 = next.i;
|
|
if (!(aVar2 == null || (relativeLayout6 = aVar2.a) == null)) {
|
|
relativeLayout6.setLayoutParams(layoutParams);
|
|
}
|
|
c.a.f.i.a aVar3 = next.i;
|
|
if (!(aVar3 == null || (relativeLayout5 = aVar3.a) == null)) {
|
|
relativeLayout5.setBackgroundResource(next.p.f52c);
|
|
relativeLayout5.post(new c.a.f.b(relativeLayout5, next));
|
|
relativeLayout5.setOnClickListener(next);
|
|
}
|
|
c.a.f.i.a aVar4 = next.i;
|
|
if (!(aVar4 == null || (simpleDraweeView3 = aVar4.b) == null)) {
|
|
simpleDraweeView3.setBackgroundResource(R.b.drawable_chip_circle);
|
|
simpleDraweeView3.setOnClickListener(next);
|
|
}
|
|
c.a.f.i.a aVar5 = next.i;
|
|
if (!(aVar5 == null || (textView4 = aVar5.f53c) == null)) {
|
|
textView4.setTextColor(next.p.e);
|
|
}
|
|
}
|
|
}
|
|
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i4)));
|
|
}
|
|
c.a.f.i.a aVar6 = next.i;
|
|
if (!(aVar6 == null || (textView3 = aVar6.f53c) == null)) {
|
|
textView3.setText(next.k);
|
|
}
|
|
c.a.f.i.a aVar7 = next.i;
|
|
SimpleDraweeView simpleDraweeView5 = aVar7 != null ? aVar7.b : r3;
|
|
Uri uri = next.l;
|
|
if (!(uri == null || simpleDraweeView5 == null)) {
|
|
String uri2 = uri.toString();
|
|
int i5 = R.a.chipsview_image_size;
|
|
m.checkNotNullParameter(simpleDraweeView5, "view");
|
|
m.checkNotNullParameter(simpleDraweeView5, "view");
|
|
if (uri2 == null) {
|
|
simpleDraweeView5.setController(r3);
|
|
} else {
|
|
Uri parse = Uri.parse(uri2);
|
|
c.f.g.a.a.d a3 = c.f.g.a.a.b.a();
|
|
a3.n = simpleDraweeView5.getController();
|
|
c.f.g.a.a.d f = a3.f(parse);
|
|
f.m = true;
|
|
m.checkNotNullParameter(uri2, "url");
|
|
ImageRequestBuilder b2 = ImageRequestBuilder.b(Uri.parse(uri2));
|
|
b2.b = ImageRequest.c.FULL_FETCH;
|
|
it = it2;
|
|
linearLayout = a2;
|
|
relativeLayout = null;
|
|
b2.f = !w.contains$default(uri2, "gif", false, 2, null) && i5 <= 200 && i5 <= 200 ? ImageRequest.b.SMALL : ImageRequest.b.DEFAULT;
|
|
if (i5 > 0 && i5 > 0) {
|
|
b2.f2184c = new c.f.j.d.e(i5, i5);
|
|
}
|
|
m.checkNotNullExpressionValue(b2, "request");
|
|
f.h = b2.a();
|
|
simpleDraweeView5.setController(f.a());
|
|
if (!next.j) {
|
|
c.a.f.i.a aVar8 = next.i;
|
|
if (!(aVar8 == null || (relativeLayout4 = aVar8.a) == null || (background3 = relativeLayout4.getBackground()) == null)) {
|
|
background3.setColorFilter(next.p.a, PorterDuff.Mode.SRC_ATOP);
|
|
}
|
|
c.a.f.i.a aVar9 = next.i;
|
|
if (!(aVar9 == null || (textView2 = aVar9.f53c) == null)) {
|
|
textView2.setTextColor(next.p.g);
|
|
}
|
|
c.a.f.i.a aVar10 = next.i;
|
|
if (!(aVar10 == null || (simpleDraweeView2 = aVar10.b) == null)) {
|
|
Drawable background4 = simpleDraweeView2.getBackground();
|
|
m.checkNotNullExpressionValue(background4, "background");
|
|
background4.setColorFilter(next.p.h, PorterDuff.Mode.SRC_ATOP);
|
|
int i6 = next.p.f;
|
|
if (i6 != 0) {
|
|
simpleDraweeView2.setImageResource(i6);
|
|
}
|
|
}
|
|
} else {
|
|
c.a.f.i.a aVar11 = next.i;
|
|
if (!(aVar11 == null || (relativeLayout3 = aVar11.a) == null || (background2 = relativeLayout3.getBackground()) == null)) {
|
|
background2.setColorFilter(next.p.d, PorterDuff.Mode.SRC_ATOP);
|
|
}
|
|
c.a.f.i.a aVar12 = next.i;
|
|
if (!(aVar12 == null || (textView = aVar12.f53c) == null)) {
|
|
textView.setTextColor(next.p.e);
|
|
}
|
|
c.a.f.i.a aVar13 = next.i;
|
|
if (!(aVar13 == null || (simpleDraweeView = aVar13.b) == null || (background = simpleDraweeView.getBackground()) == null)) {
|
|
background.setColorFilter(next.p.i, PorterDuff.Mode.SRC_ATOP);
|
|
}
|
|
}
|
|
c.a.f.i.a aVar14 = next.i;
|
|
relativeLayout2 = aVar14 == null ? aVar14.a : relativeLayout;
|
|
m.checkNotNull(relativeLayout2);
|
|
relativeLayout2.measure(View.MeasureSpec.makeMeasureSpec(0, 0), View.MeasureSpec.makeMeasureSpec(0, 0));
|
|
if (relativeLayout2.getMeasuredWidth() + i2 <= width) {
|
|
i3++;
|
|
linearLayout2 = eVar.a();
|
|
i2 = 0;
|
|
} else {
|
|
linearLayout2 = linearLayout;
|
|
}
|
|
int measuredWidth = relativeLayout2.getMeasuredWidth();
|
|
ViewGroup.LayoutParams layoutParams2 = relativeLayout2.getLayoutParams();
|
|
Objects.requireNonNull(layoutParams2, "null cannot be cast to non-null type android.widget.LinearLayout.LayoutParams");
|
|
i2 += measuredWidth + ((LinearLayout.LayoutParams) layoutParams2).rightMargin;
|
|
linearLayout2.addView(relativeLayout2);
|
|
r3 = relativeLayout;
|
|
a2 = linearLayout2;
|
|
}
|
|
}
|
|
it = it2;
|
|
linearLayout = a2;
|
|
relativeLayout = r3;
|
|
if (!next.j) {
|
|
}
|
|
c.a.f.i.a aVar14 = next.i;
|
|
if (aVar14 == null) {
|
|
}
|
|
m.checkNotNull(relativeLayout2);
|
|
relativeLayout2.measure(View.MeasureSpec.makeMeasureSpec(0, 0), View.MeasureSpec.makeMeasureSpec(0, 0));
|
|
if (relativeLayout2.getMeasuredWidth() + i2 <= width) {
|
|
}
|
|
int measuredWidth = relativeLayout2.getMeasuredWidth();
|
|
ViewGroup.LayoutParams layoutParams2 = relativeLayout2.getLayoutParams();
|
|
Objects.requireNonNull(layoutParams2, "null cannot be cast to non-null type android.widget.LinearLayout.LayoutParams");
|
|
i2 += measuredWidth + ((LinearLayout.LayoutParams) layoutParams2).rightMargin;
|
|
linearLayout2.addView(relativeLayout2);
|
|
r3 = relativeLayout;
|
|
a2 = linearLayout2;
|
|
}
|
|
if (((float) (width - i2)) < ((float) width) * 0.15f) {
|
|
i3++;
|
|
eVar.a();
|
|
i2 = 0;
|
|
}
|
|
aVar = new e.a(i3, i2);
|
|
}
|
|
}
|
|
if (this.C.isEmpty()) {
|
|
int i7 = this.w;
|
|
if (i7 != 0) {
|
|
this.A.setHint(i7);
|
|
}
|
|
} else {
|
|
this.A.setHint("");
|
|
}
|
|
if (aVar == null) {
|
|
post(new d(this, z2));
|
|
return;
|
|
}
|
|
int i8 = aVar.a;
|
|
Editable text = this.A.getText();
|
|
Object obj = this.D;
|
|
if (!(obj == null || text == null)) {
|
|
text.removeSpan(obj);
|
|
}
|
|
LeadingMarginSpan.Standard standard = new LeadingMarginSpan.Standard(i8, 0);
|
|
this.D = standard;
|
|
if (text != null) {
|
|
text.setSpan(standard, 0, 0, 17);
|
|
}
|
|
this.A.setText(text);
|
|
if (z2) {
|
|
c.a.f.d dVar = this.A;
|
|
dVar.setSelection(dVar.length());
|
|
}
|
|
}
|
|
|
|
public final void e(Collection<?> collection) {
|
|
m.checkNotNullParameter(collection, "pruneData");
|
|
Iterator<Map.Entry<K, c.a.f.a<K, V>>> it = this.C.entrySet().iterator();
|
|
boolean z2 = false;
|
|
while (it.hasNext()) {
|
|
if (!u.contains(collection, it.next().getKey())) {
|
|
it.remove();
|
|
z2 = true;
|
|
}
|
|
}
|
|
if (z2) {
|
|
d(true);
|
|
}
|
|
}
|
|
|
|
public final void f(c.a.f.a<?, ?> aVar) {
|
|
for (c.a.f.a<K, V> aVar2 : this.C.values()) {
|
|
if (aVar2 != aVar && !aVar2.o) {
|
|
aVar2.j = false;
|
|
}
|
|
}
|
|
d(false);
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super V extends com.discord.chips_view.ChipsView$a, kotlin.Unit>, kotlin.jvm.functions.Function1<V extends com.discord.chips_view.ChipsView$a, kotlin.Unit> */
|
|
public final Function1<V, Unit> getChipAddedListener() {
|
|
return (Function1<? super V, Unit>) this.E;
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super V extends com.discord.chips_view.ChipsView$a, kotlin.Unit>, kotlin.jvm.functions.Function1<V extends com.discord.chips_view.ChipsView$a, kotlin.Unit> */
|
|
public final Function1<V, Unit> getChipDeletedListener() {
|
|
return (Function1<? super V, Unit>) this.F;
|
|
}
|
|
|
|
public final String getText() {
|
|
return String.valueOf(this.A.getText());
|
|
}
|
|
|
|
/* JADX DEBUG: Type inference failed for r0v0. Raw type applied. Possible types: kotlin.jvm.functions.Function1<? super java.lang.CharSequence, kotlin.Unit>, kotlin.jvm.functions.Function1<java.lang.CharSequence, kotlin.Unit> */
|
|
public final Function1<CharSequence, Unit> getTextChangedListener() {
|
|
return this.G;
|
|
}
|
|
|
|
@Override // android.widget.ScrollView, android.widget.FrameLayout, android.view.View
|
|
public void onMeasure(int i2, int i3) {
|
|
super.onMeasure(i2, View.MeasureSpec.makeMeasureSpec(this.k, Integer.MIN_VALUE));
|
|
}
|
|
|
|
@Override // android.widget.ScrollView, android.view.ViewGroup
|
|
public boolean onRequestFocusInDescendants(int i2, Rect rect) {
|
|
return true;
|
|
}
|
|
|
|
public final void setChipAddedListener(Function1<? super V, Unit> function1) {
|
|
this.E = function1;
|
|
}
|
|
|
|
public final void setChipDeletedListener(Function1<? super V, Unit> function1) {
|
|
this.F = function1;
|
|
}
|
|
|
|
public final void setText(String str) {
|
|
m.checkNotNullParameter(str, "text");
|
|
this.A.setText(str);
|
|
}
|
|
|
|
public final void setTextChangedListener(Function1<? super CharSequence, Unit> function1) {
|
|
this.G = function1;
|
|
}
|
|
}
|