180 lines
9.9 KiB
Java
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.i5;
|
|
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(2131559187, adapter);
|
|
m.checkNotNullParameter(adapter, "adapter");
|
|
View view = this.itemView;
|
|
int i = 2131363669;
|
|
RelativeLayout relativeLayout = (RelativeLayout) view.findViewById(2131363669);
|
|
if (relativeLayout != null) {
|
|
i = 2131363670;
|
|
View findViewById = view.findViewById(2131363670);
|
|
if (findViewById != null) {
|
|
i = 2131363671;
|
|
ImageView imageView = (ImageView) view.findViewById(2131363671);
|
|
if (imageView != null) {
|
|
i = 2131363672;
|
|
TextView textView = (TextView) view.findViewById(2131363672);
|
|
if (textView != null) {
|
|
i = 2131363673;
|
|
LinearLayout linearLayout = (LinearLayout) view.findViewById(2131363673);
|
|
if (linearLayout != null) {
|
|
i = 2131363674;
|
|
TextView textView2 = (TextView) view.findViewById(2131363674);
|
|
if (textView2 != null) {
|
|
i = 2131363675;
|
|
ImageView imageView2 = (ImageView) view.findViewById(2131363675);
|
|
if (imageView2 != null) {
|
|
i = 2131363676;
|
|
CheckedSetting checkedSetting = (CheckedSetting) view.findViewById(2131363676);
|
|
if (checkedSetting != null) {
|
|
i = 2131363677;
|
|
ProgressBar progressBar = (ProgressBar) view.findViewById(2131363677);
|
|
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(2131559173, (ViewGroup) null, false);
|
|
int i = 2131364718;
|
|
TextView textView = (TextView) inflate.findViewById(2131364718);
|
|
if (textView != null) {
|
|
i = 2131364719;
|
|
MaterialButton materialButton = (MaterialButton) inflate.findViewById(2131364719);
|
|
if (materialButton != null) {
|
|
i = 2131364720;
|
|
MaterialButton materialButton2 = (MaterialButton) inflate.findViewById(2131364720);
|
|
if (materialButton2 != null) {
|
|
i = 2131364721;
|
|
TextView textView2 = (TextView) inflate.findViewById(2131364721);
|
|
if (textView2 != null) {
|
|
LinearLayout linearLayout = (LinearLayout) inflate;
|
|
m.checkNotNullExpressionValue(new i5(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 ? 2131888128 : 2131888129);
|
|
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.f1902c;
|
|
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 ? 2131230882 : 2131230883);
|
|
View view = this.binding.f1902c;
|
|
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);
|
|
}
|
|
}
|
|
}
|