2021-08-09 22:50:52 +00:00
|
|
|
package com.discord.widgets.home;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.res.Resources;
|
|
|
|
import android.view.ViewGroup;
|
|
|
|
import android.widget.FrameLayout;
|
|
|
|
import android.widget.ImageView;
|
2021-08-18 07:29:27 +00:00
|
|
|
import c.a.i.d5;
|
|
|
|
import c.a.i.h5;
|
2021-08-09 22:50:52 +00:00
|
|
|
import com.discord.app.AppFragment;
|
|
|
|
import com.discord.databinding.WidgetHomeBinding;
|
|
|
|
import com.discord.stores.StoreStream;
|
|
|
|
import com.discord.utilities.display.DisplayUtils;
|
|
|
|
import com.discord.utilities.rx.ObservableExtensionsKt;
|
|
|
|
import com.discord.utilities.view.extensions.ViewExtensions;
|
2021-08-18 07:29:27 +00:00
|
|
|
import com.discord.utilities.view.rounded.RoundedRelativeLayout;
|
2021-08-09 22:50:52 +00:00
|
|
|
import d0.a0.a;
|
|
|
|
import d0.z.d.m;
|
|
|
|
import java.util.Objects;
|
|
|
|
import kotlin.jvm.functions.Function0;
|
|
|
|
import kotlin.jvm.functions.Function1;
|
|
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
|
|
/* compiled from: WidgetHomePanelLoading.kt */
|
|
|
|
public final class WidgetHomePanelLoading {
|
|
|
|
public static final Companion Companion = new Companion(null);
|
|
|
|
private static boolean panelInitialized;
|
|
|
|
private final WidgetHomeBinding binding;
|
|
|
|
|
|
|
|
/* compiled from: WidgetHomePanelLoading.kt */
|
|
|
|
public static final class Companion {
|
|
|
|
private Companion() {
|
|
|
|
}
|
|
|
|
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
|
|
this();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public WidgetHomePanelLoading(WidgetHomeBinding widgetHomeBinding) {
|
|
|
|
m.checkNotNullParameter(widgetHomeBinding, "binding");
|
|
|
|
this.binding = widgetHomeBinding;
|
|
|
|
centerLogoRelativeToLoadingScreen();
|
|
|
|
}
|
|
|
|
|
|
|
|
public static final /* synthetic */ void access$setLoadingPanelVisibility(WidgetHomePanelLoading widgetHomePanelLoading, boolean z2, boolean z3) {
|
|
|
|
widgetHomePanelLoading.setLoadingPanelVisibility(z2, z3);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void centerLogoRelativeToLoadingScreen() {
|
|
|
|
ImageView imageView = this.binding.b.b;
|
|
|
|
m.checkNotNullExpressionValue(imageView, "binding.loading.logo");
|
|
|
|
ViewGroup.LayoutParams layoutParams = imageView.getLayoutParams();
|
|
|
|
Objects.requireNonNull(layoutParams, "null cannot be cast to non-null type android.widget.FrameLayout.LayoutParams");
|
|
|
|
FrameLayout.LayoutParams layoutParams2 = (FrameLayout.LayoutParams) layoutParams;
|
|
|
|
ImageView imageView2 = this.binding.b.b;
|
|
|
|
m.checkNotNullExpressionValue(imageView2, "binding.loading.logo");
|
|
|
|
Resources resources = imageView2.getResources();
|
|
|
|
m.checkNotNullExpressionValue(resources, "binding.loading.logo.resources");
|
|
|
|
layoutParams2.setMargins(((ViewGroup.MarginLayoutParams) layoutParams2).leftMargin, a.roundToInt(((float) DisplayUtils.getStatusBarHeight(resources)) / -2.0f), ((ViewGroup.MarginLayoutParams) layoutParams2).rightMargin, ((ViewGroup.MarginLayoutParams) layoutParams2).bottomMargin);
|
|
|
|
ImageView imageView3 = this.binding.b.b;
|
|
|
|
m.checkNotNullExpressionValue(imageView3, "binding.loading.logo");
|
|
|
|
imageView3.setLayoutParams(layoutParams2);
|
|
|
|
}
|
|
|
|
|
|
|
|
private final void setLoadingPanelVisibility(boolean z2, boolean z3) {
|
2021-08-18 07:29:27 +00:00
|
|
|
h5 h5Var = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(h5Var, "binding.loading");
|
|
|
|
FrameLayout frameLayout = h5Var.a;
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullExpressionValue(frameLayout, "binding.loading.root");
|
|
|
|
if ((frameLayout.getVisibility() == 0) || !z2) {
|
|
|
|
panelInitialized = z2;
|
|
|
|
if (z2) {
|
|
|
|
if (z3) {
|
2021-08-18 07:29:27 +00:00
|
|
|
h5 h5Var2 = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(h5Var2, "binding.loading");
|
|
|
|
ViewExtensions.fadeOut$default(h5Var2.a, 0, null, null, 7, null);
|
|
|
|
d5 d5Var = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(d5Var, "binding.panelCenter");
|
|
|
|
ViewExtensions.fadeIn$default(d5Var.a, 0, null, null, null, 15, null);
|
2021-08-09 22:50:52 +00:00
|
|
|
} else {
|
2021-08-18 07:29:27 +00:00
|
|
|
h5 h5Var3 = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(h5Var3, "binding.loading");
|
|
|
|
FrameLayout frameLayout2 = h5Var3.a;
|
2021-08-09 22:50:52 +00:00
|
|
|
m.checkNotNullExpressionValue(frameLayout2, "binding.loading.root");
|
|
|
|
frameLayout2.setVisibility(8);
|
2021-08-18 07:29:27 +00:00
|
|
|
d5 d5Var2 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(d5Var2, "binding.panelCenter");
|
|
|
|
RoundedRelativeLayout roundedRelativeLayout = d5Var2.a;
|
|
|
|
m.checkNotNullExpressionValue(roundedRelativeLayout, "binding.panelCenter.root");
|
|
|
|
roundedRelativeLayout.setVisibility(0);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
StoreStream.Companion.getAnalytics().appUiViewed(WidgetHome.class);
|
|
|
|
return;
|
|
|
|
}
|
2021-08-18 07:29:27 +00:00
|
|
|
d5 d5Var3 = this.binding.d;
|
|
|
|
m.checkNotNullExpressionValue(d5Var3, "binding.panelCenter");
|
|
|
|
RoundedRelativeLayout roundedRelativeLayout2 = d5Var3.a;
|
|
|
|
m.checkNotNullExpressionValue(roundedRelativeLayout2, "binding.panelCenter.root");
|
|
|
|
roundedRelativeLayout2.setVisibility(8);
|
|
|
|
h5 h5Var4 = this.binding.b;
|
|
|
|
m.checkNotNullExpressionValue(h5Var4, "binding.loading");
|
|
|
|
FrameLayout frameLayout3 = h5Var4.a;
|
|
|
|
m.checkNotNullExpressionValue(frameLayout3, "binding.loading.root");
|
|
|
|
frameLayout3.setVisibility(0);
|
2021-08-09 22:50:52 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public final void configure(AppFragment appFragment) {
|
|
|
|
m.checkNotNullParameter(appFragment, "fragment");
|
|
|
|
ObservableExtensionsKt.appSubscribe$default(ObservableExtensionsKt.ui$default(WidgetHomeModel.Companion.getInitialized(), appFragment, null, 2, null), WidgetHomePanelLoading.class, (Context) null, (Function1) null, (Function1) null, (Function0) null, (Function0) null, new WidgetHomePanelLoading$configure$1(this), 62, (Object) null);
|
|
|
|
setLoadingPanelVisibility(panelInitialized, false);
|
|
|
|
}
|
|
|
|
}
|