discord-jadx/app/src/main/java/com/discord/widgets/servers/WidgetServerSettingsIntegra...

180 lines
9.9 KiB
Java

package com.discord.widgets.servers;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.appcompat.app.AlertDialog;
import c.a.i.m5;
import com.discord.api.user.User;
import com.discord.databinding.WidgetServerSettingsIntegrationListItemBinding;
import com.discord.utilities.mg_recycler.MGRecyclerViewHolder;
import com.discord.views.CheckedSetting;
import com.discord.widgets.servers.WidgetServerSettingsIntegrations;
import com.google.android.material.button.MaterialButton;
import d0.z.d.m;
/* compiled from: WidgetServerSettingsIntegrationsListItem.kt */
public final class WidgetServerSettingsIntegrationsListItem extends MGRecyclerViewHolder<WidgetServerSettingsIntegrations.Adapter, WidgetServerSettingsIntegrations.Model.IntegrationItem> {
private final WidgetServerSettingsIntegrationListItemBinding binding;
/* JADX INFO: super call moved to the top of the method (can break code semantics) */
public WidgetServerSettingsIntegrationsListItem(WidgetServerSettingsIntegrations.Adapter adapter) {
super(2131559193, adapter);
m.checkNotNullParameter(adapter, "adapter");
View view = this.itemView;
int i = 2131363675;
RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(2131363675);
if (relativeLayout != null) {
i = 2131363676;
View findViewById = view.findViewById(2131363676);
if (findViewById != null) {
i = 2131363677;
ImageView imageView = (ImageView) view.findViewById(2131363677);
if (imageView != null) {
i = 2131363678;
TextView textView = (TextView) view.findViewById(2131363678);
if (textView != null) {
i = 2131363679;
LinearLayout linearLayout = (LinearLayout) view.findViewById(2131363679);
if (linearLayout != null) {
i = 2131363680;
TextView textView2 = (TextView) view.findViewById(2131363680);
if (textView2 != null) {
i = 2131363681;
ImageView imageView2 = (ImageView) view.findViewById(2131363681);
if (imageView2 != null) {
i = 2131363682;
CheckedSetting checkedSetting = (CheckedSetting) view.findViewById(2131363682);
if (checkedSetting != null) {
i = 2131363683;
ProgressBar progressBar = (ProgressBar) view.findViewById(2131363683);
if (progressBar != null) {
WidgetServerSettingsIntegrationListItemBinding widgetServerSettingsIntegrationListItemBinding = new WidgetServerSettingsIntegrationListItemBinding((FrameLayout) view, relativeLayout, findViewById, imageView, textView, linearLayout, textView2, imageView2, checkedSetting, progressBar);
m.checkNotNullExpressionValue(widgetServerSettingsIntegrationListItemBinding, "WidgetServerSettingsInte…temBinding.bind(itemView)");
this.binding = widgetServerSettingsIntegrationListItemBinding;
return;
}
}
}
}
}
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(view.getResources().getResourceName(i)));
}
public static final /* synthetic */ WidgetServerSettingsIntegrations.Adapter access$getAdapter$p(WidgetServerSettingsIntegrationsListItem widgetServerSettingsIntegrationsListItem) {
return (WidgetServerSettingsIntegrations.Adapter) widgetServerSettingsIntegrationsListItem.adapter;
}
public static final /* synthetic */ WidgetServerSettingsIntegrationListItemBinding access$getBinding$p(WidgetServerSettingsIntegrationsListItem widgetServerSettingsIntegrationsListItem) {
return widgetServerSettingsIntegrationsListItem.binding;
}
public static final /* synthetic */ void access$showDisableSyncDialog(WidgetServerSettingsIntegrationsListItem widgetServerSettingsIntegrationsListItem, long j, long j2, boolean z2, Context context) {
widgetServerSettingsIntegrationsListItem.showDisableSyncDialog(j, j2, z2, context);
}
public static final /* synthetic */ void access$showSyncingUI(WidgetServerSettingsIntegrationsListItem widgetServerSettingsIntegrationsListItem, boolean z2) {
widgetServerSettingsIntegrationsListItem.showSyncingUI(z2);
}
private final void showDisableSyncDialog(long j, long j2, boolean z2, Context context) {
View inflate = LayoutInflater.from(context).inflate(2131559179, (ViewGroup) null, false);
int i = 2131364730;
TextView textView = (TextView) inflate.findViewById(2131364730);
if (textView != null) {
i = 2131364731;
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131364731);
if (materialButton != null) {
i = 2131364732;
MaterialButton materialButton2 = (MaterialButton) inflate.findViewById(2131364732);
if (materialButton2 != null) {
i = 2131364733;
TextView textView2 = (TextView) inflate.findViewById(2131364733);
if (textView2 != null) {
LinearLayout linearLayout = (LinearLayout) inflate;
m.checkNotNullExpressionValue(new m5(linearLayout, textView, materialButton, materialButton2, textView2), "WidgetServerSettingsConf…om(context), null, false)");
AlertDialog create = new AlertDialog.Builder(context).setView(linearLayout).create();
m.checkNotNullExpressionValue(create, "AlertDialog.Builder(cont…ew(binding.root).create()");
materialButton.setOnClickListener(new WidgetServerSettingsIntegrationsListItem$showDisableSyncDialog$1(create));
materialButton2.setOnClickListener(new WidgetServerSettingsIntegrationsListItem$showDisableSyncDialog$2(j, j2, create, context));
textView.setText(z2 ? 2131888133 : 2131888134);
create.show();
return;
}
}
}
}
throw new NullPointerException("Missing required view with ID: ".concat(inflate.getResources().getResourceName(i)));
}
private final void showSyncingUI(boolean z2) {
ImageView imageView = this.binding.g;
m.checkNotNullExpressionValue(imageView, "binding.integrationSettingsIcon");
int i = 0;
imageView.setVisibility(z2 ^ true ? 0 : 8);
ProgressBar progressBar = this.binding.i;
m.checkNotNullExpressionValue(progressBar, "binding.integrationSyncingProgressBar");
progressBar.setVisibility(z2 ? 0 : 8);
View view = this.binding.f1907c;
m.checkNotNullExpressionValue(view, "binding.integrationHeaderDisabledOverlay");
if (!z2) {
i = 8;
}
view.setVisibility(i);
if (z2) {
this.binding.b.setOnClickListener(null);
}
}
public void onConfigure(int i, WidgetServerSettingsIntegrations.Model.IntegrationItem integrationItem) {
m.checkNotNullParameter(integrationItem, "data");
super.onConfigure(i, (int) integrationItem);
boolean areEqual = m.areEqual(integrationItem.getIntegration().getType(), "twitch");
boolean isSyncing = integrationItem.getIntegration().isSyncing();
boolean isEnabled = integrationItem.getIntegration().isEnabled();
long id2 = integrationItem.getIntegration().getId();
if (!isSyncing) {
this.binding.b.setOnClickListener(new WidgetServerSettingsIntegrationsListItem$onConfigure$1(this, id2));
} else {
this.binding.b.setOnClickListener(null);
}
TextView textView = this.binding.e;
m.checkNotNullExpressionValue(textView, "binding.integrationName");
textView.setText(integrationItem.getIntegration().getDisplayName());
TextView textView2 = this.binding.f;
m.checkNotNullExpressionValue(textView2, "binding.integrationOwnerName");
User user = integrationItem.getIntegration().getUser();
textView2.setText(user != null ? user.r() : null);
this.binding.d.setImageResource(areEqual ? 2131230885 : 2131230886);
View view = this.binding.f1907c;
m.checkNotNullExpressionValue(view, "binding.integrationHeaderDisabledOverlay");
int i2 = 0;
if (!(isSyncing || !isEnabled)) {
i2 = 8;
}
view.setVisibility(i2);
showSyncingUI(isSyncing);
CheckedSetting checkedSetting = this.binding.h;
m.checkNotNullExpressionValue(checkedSetting, "binding.integrationSyncSwitch");
checkedSetting.setChecked(isEnabled);
CheckedSetting checkedSetting2 = this.binding.h;
m.checkNotNullExpressionValue(checkedSetting2, "binding.integrationSyncSwitch");
checkedSetting2.setEnabled(!isSyncing);
if (!isSyncing) {
this.binding.h.setOnCheckedListener(new WidgetServerSettingsIntegrationsListItem$onConfigure$2(this, integrationItem, id2, areEqual));
} else {
this.binding.h.setOnCheckedListener(null);
}
}
}