155 lines
6.3 KiB
Java
155 lines
6.3 KiB
Java
package c.a.y;
|
|
|
|
import android.content.Context;
|
|
import android.content.res.Configuration;
|
|
import android.view.LayoutInflater;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import c.a.i.s0;
|
|
import com.discord.R;
|
|
import com.discord.app.AppComponent;
|
|
import com.discord.overlay.views.OverlayBubbleWrap;
|
|
import com.discord.stores.StoreStream;
|
|
import com.discord.stores.StoreVoiceParticipants;
|
|
import com.discord.utilities.icon.IconUtils;
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
import com.facebook.drawee.view.SimpleDraweeView;
|
|
import d0.z.d.m;
|
|
import d0.z.d.o;
|
|
import j0.l.e.j;
|
|
import java.util.Objects;
|
|
import kotlin.Unit;
|
|
import kotlin.jvm.functions.Function0;
|
|
import kotlin.jvm.functions.Function1;
|
|
import rx.Observable;
|
|
import rx.subjects.PublishSubject;
|
|
import rx.subjects.Subject;
|
|
/* compiled from: OverlayVoiceBubble.kt */
|
|
public final class w extends OverlayBubbleWrap implements AppComponent {
|
|
public static final /* synthetic */ int w = 0;
|
|
|
|
/* renamed from: x reason: collision with root package name */
|
|
public final s0 f245x;
|
|
|
|
/* renamed from: y reason: collision with root package name */
|
|
public final Subject<Void, Void> f246y;
|
|
|
|
/* compiled from: OverlayVoiceBubble.kt */
|
|
public static final class a<T, R> implements j0.k.b<Long, Observable<? extends StoreVoiceParticipants.VoiceUser>> {
|
|
public static final a i = new a();
|
|
|
|
/* 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 // j0.k.b
|
|
public Observable<? extends StoreVoiceParticipants.VoiceUser> call(Long l) {
|
|
Long l2 = l;
|
|
if (l2 != null && l2.longValue() == 0) {
|
|
return new j(null);
|
|
}
|
|
StoreVoiceParticipants voiceParticipants = StoreStream.Companion.getVoiceParticipants();
|
|
m.checkNotNullExpressionValue(l2, "channelId");
|
|
return voiceParticipants.get(l2.longValue()).F(v.i).r();
|
|
}
|
|
}
|
|
|
|
/* compiled from: OverlayVoiceBubble.kt */
|
|
public static final class b extends o implements Function1<StoreVoiceParticipants.VoiceUser, Unit> {
|
|
public final /* synthetic */ w this$0;
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public b(w wVar) {
|
|
super(1);
|
|
this.this$0 = wVar;
|
|
}
|
|
|
|
/* 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 Unit invoke(StoreVoiceParticipants.VoiceUser voiceUser) {
|
|
StoreVoiceParticipants.VoiceUser voiceUser2 = voiceUser;
|
|
w wVar = this.this$0;
|
|
int i = w.w;
|
|
if (voiceUser2 == null) {
|
|
wVar.h();
|
|
} else {
|
|
IconUtils.setIcon$default(wVar.getImageView$app_productionBetaRelease(), voiceUser2.getUser(), 0, null, null, voiceUser2.getGuildMember(), 28, null);
|
|
wVar.g();
|
|
}
|
|
return Unit.a;
|
|
}
|
|
}
|
|
|
|
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
|
|
public w(Context context) {
|
|
super(context);
|
|
m.checkNotNullParameter(context, "context");
|
|
View inflate = LayoutInflater.from(getContext()).inflate(R.layout.overlay_voice_bubble, (ViewGroup) this, false);
|
|
addView(inflate);
|
|
Objects.requireNonNull(inflate, "rootView");
|
|
SimpleDraweeView simpleDraweeView = (SimpleDraweeView) inflate;
|
|
s0 s0Var = new s0(simpleDraweeView, simpleDraweeView);
|
|
m.checkNotNullExpressionValue(s0Var, "OverlayVoiceBubbleBindin…rom(context), this, true)");
|
|
this.f245x = s0Var;
|
|
PublishSubject j02 = PublishSubject.j0();
|
|
m.checkNotNullExpressionValue(j02, "PublishSubject.create()");
|
|
this.f246y = j02;
|
|
}
|
|
|
|
@Override // com.discord.overlay.views.OverlayBubbleWrap
|
|
public void a(boolean z2) {
|
|
h();
|
|
super.a(z2);
|
|
}
|
|
|
|
@Override // com.discord.overlay.views.OverlayBubbleWrap
|
|
public void b(View view) {
|
|
m.checkNotNullParameter(view, "targetView");
|
|
super.b(view);
|
|
g();
|
|
}
|
|
|
|
public final void g() {
|
|
getImageView$app_productionBetaRelease().animate().setDuration(100).alpha(1.0f).start();
|
|
}
|
|
|
|
public final SimpleDraweeView getImageView$app_productionBetaRelease() {
|
|
SimpleDraweeView simpleDraweeView = this.f245x.b;
|
|
m.checkNotNullExpressionValue(simpleDraweeView, "binding.overlayBubbleIv");
|
|
return simpleDraweeView;
|
|
}
|
|
|
|
@Override // com.discord.app.AppComponent
|
|
public Subject<Void, Void> getUnsubscribeSignal() {
|
|
return this.f246y;
|
|
}
|
|
|
|
public final void h() {
|
|
getImageView$app_productionBetaRelease().animate().setDuration(200).alpha(0.5f).start();
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewGroup
|
|
public void onAttachedToWindow() {
|
|
super.onAttachedToWindow();
|
|
Observable<R> X = StoreStream.Companion.getVoiceChannelSelected().observeSelectedVoiceChannelId().X(a.i);
|
|
m.checkNotNullExpressionValue(X, "StoreStream\n .get…d()\n }\n }");
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(ObservableExtensionsKt.computationLatest(X), this, null, 2, null), w.class, getContext(), (Function1) null, (Function1) null, (Function0) null, (Function0) null, new b(this), 60, (Object) null);
|
|
}
|
|
|
|
@Override // com.discord.overlay.views.OverlayBubbleWrap, android.view.View
|
|
public void onConfigurationChanged(Configuration configuration) {
|
|
int i = getWindowLayoutParams().x;
|
|
Context context = getContext();
|
|
m.checkNotNullExpressionValue(context, "context");
|
|
int i2 = i > e(context).centerX() ? Integer.MAX_VALUE : Integer.MIN_VALUE;
|
|
super.onConfigurationChanged(configuration);
|
|
OverlayBubbleWrap.c(this, i2, getWindowLayoutParams().y, null, 4, null);
|
|
getSpringAnimationX().skipToEnd();
|
|
getSpringAnimationY().skipToEnd();
|
|
}
|
|
|
|
@Override // android.view.View, android.view.ViewGroup
|
|
public void onDetachedFromWindow() {
|
|
getUnsubscribeSignal().onNext(null);
|
|
super.onDetachedFromWindow();
|
|
}
|
|
}
|