forked from Juby210/discord-jadx
590 lines
26 KiB
Java
590 lines
26 KiB
Java
package com.discord.widgets.guilds.list;
|
|
|
|
import android.graphics.Rect;
|
|
import android.view.View;
|
|
import android.view.ViewGroup;
|
|
import androidx.recyclerview.widget.DiffUtil;
|
|
import androidx.recyclerview.widget.LinearLayoutManager;
|
|
import androidx.recyclerview.widget.RecyclerView;
|
|
import b.d.b.a.a;
|
|
import com.discord.R;
|
|
import com.discord.utilities.color.ColorCompat;
|
|
import com.discord.widgets.guilds.list.GuildListItem;
|
|
import com.discord.widgets.guilds.list.GuildListViewHolder;
|
|
import com.discord.widgets.guilds.list.GuildsDragAndDropCallback;
|
|
import d0.t.n;
|
|
import d0.z.d.m;
|
|
import java.util.List;
|
|
import kotlin.NoWhenBranchMatchedException;
|
|
import kotlin.jvm.internal.DefaultConstructorMarker;
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public final class WidgetGuildListAdapter extends RecyclerView.Adapter<GuildListViewHolder> implements GuildsDragAndDropCallback.Controller {
|
|
public static final Companion Companion = new Companion(null);
|
|
private static final float NEAR_CENTER_PERCENTAGE = 0.2f;
|
|
private int bottomNavHeight;
|
|
private final Rect boundingBoxRect = new Rect();
|
|
private GuildListViewHolder draggingItem;
|
|
private final InteractionListener interactionListener;
|
|
private List<? extends GuildListItem> items = n.emptyList();
|
|
private final LinearLayoutManager layoutManager;
|
|
private int selectedCenterY;
|
|
private int targetCenterY;
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public static final class Companion {
|
|
private Companion() {
|
|
}
|
|
|
|
public /* synthetic */ Companion(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public interface InteractionListener {
|
|
boolean onDrop();
|
|
|
|
void onItemClicked(View view, GuildListItem guildListItem);
|
|
|
|
void onItemLongPressed(View view, GuildListItem guildListItem);
|
|
|
|
void onItemMoved();
|
|
|
|
void onOperation(Operation operation);
|
|
}
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public static abstract class Operation {
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public static final class MoveAbove extends Operation {
|
|
private final int fromPosition;
|
|
private final int targetPosition;
|
|
|
|
public MoveAbove(int i, int i2) {
|
|
super(null);
|
|
this.fromPosition = i;
|
|
this.targetPosition = i2;
|
|
}
|
|
|
|
public static /* synthetic */ MoveAbove copy$default(MoveAbove moveAbove, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = moveAbove.fromPosition;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = moveAbove.targetPosition;
|
|
}
|
|
return moveAbove.copy(i, i2);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.fromPosition;
|
|
}
|
|
|
|
public final int component2() {
|
|
return this.targetPosition;
|
|
}
|
|
|
|
public final MoveAbove copy(int i, int i2) {
|
|
return new MoveAbove(i, i2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof MoveAbove)) {
|
|
return false;
|
|
}
|
|
MoveAbove moveAbove = (MoveAbove) obj;
|
|
return this.fromPosition == moveAbove.fromPosition && this.targetPosition == moveAbove.targetPosition;
|
|
}
|
|
|
|
public final int getFromPosition() {
|
|
return this.fromPosition;
|
|
}
|
|
|
|
public final int getTargetPosition() {
|
|
return this.targetPosition;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return (this.fromPosition * 31) + this.targetPosition;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder R = a.R("MoveAbove(fromPosition=");
|
|
R.append(this.fromPosition);
|
|
R.append(", targetPosition=");
|
|
return a.A(R, this.targetPosition, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public static final class MoveBelow extends Operation {
|
|
private final int fromPosition;
|
|
private final int targetPosition;
|
|
|
|
public MoveBelow(int i, int i2) {
|
|
super(null);
|
|
this.fromPosition = i;
|
|
this.targetPosition = i2;
|
|
}
|
|
|
|
public static /* synthetic */ MoveBelow copy$default(MoveBelow moveBelow, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = moveBelow.fromPosition;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = moveBelow.targetPosition;
|
|
}
|
|
return moveBelow.copy(i, i2);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.fromPosition;
|
|
}
|
|
|
|
public final int component2() {
|
|
return this.targetPosition;
|
|
}
|
|
|
|
public final MoveBelow copy(int i, int i2) {
|
|
return new MoveBelow(i, i2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof MoveBelow)) {
|
|
return false;
|
|
}
|
|
MoveBelow moveBelow = (MoveBelow) obj;
|
|
return this.fromPosition == moveBelow.fromPosition && this.targetPosition == moveBelow.targetPosition;
|
|
}
|
|
|
|
public final int getFromPosition() {
|
|
return this.fromPosition;
|
|
}
|
|
|
|
public final int getTargetPosition() {
|
|
return this.targetPosition;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return (this.fromPosition * 31) + this.targetPosition;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder R = a.R("MoveBelow(fromPosition=");
|
|
R.append(this.fromPosition);
|
|
R.append(", targetPosition=");
|
|
return a.A(R, this.targetPosition, ")");
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public static final class TargetOperation extends Operation {
|
|
private final int fromPosition;
|
|
private final int targetPosition;
|
|
|
|
public TargetOperation(int i, int i2) {
|
|
super(null);
|
|
this.fromPosition = i;
|
|
this.targetPosition = i2;
|
|
}
|
|
|
|
public static /* synthetic */ TargetOperation copy$default(TargetOperation targetOperation, int i, int i2, int i3, Object obj) {
|
|
if ((i3 & 1) != 0) {
|
|
i = targetOperation.fromPosition;
|
|
}
|
|
if ((i3 & 2) != 0) {
|
|
i2 = targetOperation.targetPosition;
|
|
}
|
|
return targetOperation.copy(i, i2);
|
|
}
|
|
|
|
public final int component1() {
|
|
return this.fromPosition;
|
|
}
|
|
|
|
public final int component2() {
|
|
return this.targetPosition;
|
|
}
|
|
|
|
public final TargetOperation copy(int i, int i2) {
|
|
return new TargetOperation(i, i2);
|
|
}
|
|
|
|
public boolean equals(Object obj) {
|
|
if (this == obj) {
|
|
return true;
|
|
}
|
|
if (!(obj instanceof TargetOperation)) {
|
|
return false;
|
|
}
|
|
TargetOperation targetOperation = (TargetOperation) obj;
|
|
return this.fromPosition == targetOperation.fromPosition && this.targetPosition == targetOperation.targetPosition;
|
|
}
|
|
|
|
public final int getFromPosition() {
|
|
return this.fromPosition;
|
|
}
|
|
|
|
public final int getTargetPosition() {
|
|
return this.targetPosition;
|
|
}
|
|
|
|
public int hashCode() {
|
|
return (this.fromPosition * 31) + this.targetPosition;
|
|
}
|
|
|
|
public String toString() {
|
|
StringBuilder R = a.R("TargetOperation(fromPosition=");
|
|
R.append(this.fromPosition);
|
|
R.append(", targetPosition=");
|
|
return a.A(R, this.targetPosition, ")");
|
|
}
|
|
}
|
|
|
|
private Operation() {
|
|
}
|
|
|
|
public /* synthetic */ Operation(DefaultConstructorMarker defaultConstructorMarker) {
|
|
this();
|
|
}
|
|
}
|
|
|
|
/* compiled from: WidgetGuildListAdapter.kt */
|
|
public enum TargetPosition {
|
|
TOP,
|
|
CENTER,
|
|
BOTTOM
|
|
}
|
|
|
|
public final /* synthetic */ class WhenMappings {
|
|
public static final /* synthetic */ int[] $EnumSwitchMapping$0;
|
|
|
|
static {
|
|
TargetPosition.values();
|
|
int[] iArr = new int[3];
|
|
$EnumSwitchMapping$0 = iArr;
|
|
iArr[TargetPosition.TOP.ordinal()] = 1;
|
|
iArr[TargetPosition.CENTER.ordinal()] = 2;
|
|
iArr[TargetPosition.BOTTOM.ordinal()] = 3;
|
|
}
|
|
}
|
|
|
|
public WidgetGuildListAdapter(LinearLayoutManager linearLayoutManager, InteractionListener interactionListener) {
|
|
m.checkNotNullParameter(linearLayoutManager, "layoutManager");
|
|
m.checkNotNullParameter(interactionListener, "interactionListener");
|
|
this.layoutManager = linearLayoutManager;
|
|
this.interactionListener = interactionListener;
|
|
}
|
|
|
|
public static final /* synthetic */ InteractionListener access$getInteractionListener$p(WidgetGuildListAdapter widgetGuildListAdapter) {
|
|
return widgetGuildListAdapter.interactionListener;
|
|
}
|
|
|
|
private final WidgetGuildListAdapter$createDiffUtilCallback$1 createDiffUtilCallback(List<? extends GuildListItem> list, List<? extends GuildListItem> list2) {
|
|
return new WidgetGuildListAdapter$createDiffUtilCallback$1(list, list2);
|
|
}
|
|
|
|
private final boolean isPendingGuildOperation(GuildListItem guildListItem, GuildListItem guildListItem2) {
|
|
return ((guildListItem instanceof GuildListItem.GuildItem) && ((GuildListItem.GuildItem) guildListItem).isPendingGuild()) || ((guildListItem instanceof GuildListItem.FolderItem) && ((GuildListItem.FolderItem) guildListItem).isPendingGuildsFolder()) || (((guildListItem2 instanceof GuildListItem.GuildItem) && ((GuildListItem.GuildItem) guildListItem2).isPendingGuild()) || ((guildListItem2 instanceof GuildListItem.FolderItem) && ((GuildListItem.FolderItem) guildListItem2).isPendingGuildsFolder()));
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.GuildsDragAndDropCallback.Controller
|
|
public RecyclerView.ViewHolder chooseDropTarget(RecyclerView.ViewHolder viewHolder, List<RecyclerView.ViewHolder> list, int i, int i2) {
|
|
m.checkNotNullParameter(viewHolder, "selected");
|
|
m.checkNotNullParameter(list, "dropTargets");
|
|
this.layoutManager.getTransformedBoundingBox(viewHolder.itemView, false, this.boundingBoxRect);
|
|
this.selectedCenterY = this.boundingBoxRect.centerY();
|
|
int i3 = Integer.MAX_VALUE;
|
|
RecyclerView.ViewHolder viewHolder2 = null;
|
|
for (RecyclerView.ViewHolder viewHolder3 : list) {
|
|
this.layoutManager.getTransformedBoundingBox(viewHolder3.itemView, false, this.boundingBoxRect);
|
|
int centerY = this.boundingBoxRect.centerY();
|
|
int abs = Math.abs(this.selectedCenterY - centerY);
|
|
if (abs < i3) {
|
|
this.targetCenterY = centerY;
|
|
viewHolder2 = viewHolder3;
|
|
i3 = abs;
|
|
}
|
|
}
|
|
return viewHolder2;
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemCount() {
|
|
return this.items.size();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public long getItemId(int i) {
|
|
return ((GuildListItem) this.items.get(i)).getItemId();
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public int getItemViewType(int i) {
|
|
GuildListItem guildListItem = (GuildListItem) this.items.get(i);
|
|
if (guildListItem instanceof GuildListItem.GuildItem) {
|
|
return 3;
|
|
}
|
|
if (guildListItem instanceof GuildListItem.PrivateChannelItem) {
|
|
return 2;
|
|
}
|
|
if (guildListItem instanceof GuildListItem.UnavailableItem) {
|
|
return 4;
|
|
}
|
|
if (guildListItem instanceof GuildListItem.FriendsItem) {
|
|
return 0;
|
|
}
|
|
if (m.areEqual(guildListItem, GuildListItem.DividerItem.INSTANCE)) {
|
|
return 1;
|
|
}
|
|
if (m.areEqual(guildListItem, GuildListItem.CreateItem.INSTANCE)) {
|
|
return 5;
|
|
}
|
|
if (guildListItem instanceof GuildListItem.HubItem) {
|
|
return 9;
|
|
}
|
|
if (m.areEqual(guildListItem, GuildListItem.HelpItem.INSTANCE)) {
|
|
return 7;
|
|
}
|
|
if (guildListItem instanceof GuildListItem.FolderItem) {
|
|
return 6;
|
|
}
|
|
if (m.areEqual(guildListItem, GuildListItem.SpaceItem.INSTANCE)) {
|
|
return 8;
|
|
}
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
|
|
public final void handleBottomNavHeight(int i) {
|
|
this.bottomNavHeight = i;
|
|
notifyItemChanged(this.items.lastIndexOf(GuildListItem.SpaceItem.INSTANCE));
|
|
}
|
|
|
|
public void onBindViewHolder(GuildListViewHolder guildListViewHolder, int i) {
|
|
m.checkNotNullParameter(guildListViewHolder, "holder");
|
|
GuildListItem guildListItem = (GuildListItem) this.items.get(i);
|
|
if (guildListItem instanceof GuildListItem.GuildItem) {
|
|
((GuildListViewHolder.GuildViewHolder) guildListViewHolder).configure((GuildListItem.GuildItem) guildListItem);
|
|
} else if (guildListItem instanceof GuildListItem.FriendsItem) {
|
|
((GuildListViewHolder.FriendsViewHolder) guildListViewHolder).configure((GuildListItem.FriendsItem) guildListItem);
|
|
} else if (guildListItem instanceof GuildListItem.PrivateChannelItem) {
|
|
((GuildListViewHolder.PrivateChannelViewHolder) guildListViewHolder).configure((GuildListItem.PrivateChannelItem) guildListItem);
|
|
} else if (guildListItem instanceof GuildListItem.FolderItem) {
|
|
((GuildListViewHolder.FolderViewHolder) guildListViewHolder).configure((GuildListItem.FolderItem) guildListItem);
|
|
} else if ((guildListItem instanceof GuildListItem.UnavailableItem) || (guildListItem instanceof GuildListItem.CreateItem) || (guildListItem instanceof GuildListItem.HelpItem)) {
|
|
guildListViewHolder.itemView.setOnClickListener(new WidgetGuildListAdapter$onBindViewHolder$1(this, guildListViewHolder, guildListItem));
|
|
} else if (guildListItem instanceof GuildListItem.HubItem) {
|
|
guildListViewHolder.itemView.setOnClickListener(new WidgetGuildListAdapter$onBindViewHolder$2(this, guildListViewHolder, guildListItem));
|
|
((GuildListViewHolder.DiscordHubViewHolder) guildListViewHolder).configure((GuildListItem.HubItem) guildListItem);
|
|
} else if (guildListItem instanceof GuildListItem.SpaceItem) {
|
|
((GuildListViewHolder.SpaceViewHolder) guildListViewHolder).configure(this.bottomNavHeight);
|
|
}
|
|
}
|
|
|
|
@Override // androidx.recyclerview.widget.RecyclerView.Adapter
|
|
public GuildListViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
|
|
m.checkNotNullParameter(viewGroup, "parent");
|
|
WidgetGuildListAdapter$onCreateViewHolder$1 widgetGuildListAdapter$onCreateViewHolder$1 = new WidgetGuildListAdapter$onCreateViewHolder$1(viewGroup);
|
|
switch (i) {
|
|
case 0:
|
|
View invoke = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_profile);
|
|
m.checkNotNullExpressionValue(invoke, "itemView");
|
|
return new GuildListViewHolder.FriendsViewHolder(invoke, new WidgetGuildListAdapter$onCreateViewHolder$8(this, invoke));
|
|
case 1:
|
|
View invoke2 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_divider);
|
|
m.checkNotNullExpressionValue(invoke2, "itemView");
|
|
return new GuildListViewHolder.SimpleViewHolder(invoke2);
|
|
case 2:
|
|
View invoke3 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_dm_vertical);
|
|
m.checkNotNullExpressionValue(invoke3, "itemView");
|
|
return new GuildListViewHolder.PrivateChannelViewHolder(invoke3, new WidgetGuildListAdapter$onCreateViewHolder$6(this, invoke3), new WidgetGuildListAdapter$onCreateViewHolder$7(this, invoke3));
|
|
case 3:
|
|
View invoke4 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_guild_vertical);
|
|
int themedColor = ColorCompat.getThemedColor(viewGroup.getContext(), (int) R.attr.colorBackgroundTertiary);
|
|
int themedColor2 = ColorCompat.getThemedColor(viewGroup.getContext(), (int) R.attr.primary_600);
|
|
m.checkNotNullExpressionValue(invoke4, "itemView");
|
|
return new GuildListViewHolder.GuildViewHolder(invoke4, themedColor, themedColor2, new WidgetGuildListAdapter$onCreateViewHolder$2(this, invoke4), new WidgetGuildListAdapter$onCreateViewHolder$3(this, invoke4));
|
|
case 4:
|
|
View invoke5 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_guild_unavailable);
|
|
m.checkNotNullExpressionValue(invoke5, "itemView");
|
|
return new GuildListViewHolder.SimpleViewHolder(invoke5);
|
|
case 5:
|
|
View invoke6 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_guild_new);
|
|
m.checkNotNullExpressionValue(invoke6, "itemView");
|
|
return new GuildListViewHolder.SimpleViewHolder(invoke6);
|
|
case 6:
|
|
View invoke7 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_folder);
|
|
m.checkNotNullExpressionValue(invoke7, "itemView");
|
|
return new GuildListViewHolder.FolderViewHolder(invoke7, new WidgetGuildListAdapter$onCreateViewHolder$4(this, invoke7), new WidgetGuildListAdapter$onCreateViewHolder$5(this, invoke7));
|
|
case 7:
|
|
View invoke8 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_guild_nux);
|
|
m.checkNotNullExpressionValue(invoke8, "itemView");
|
|
return new GuildListViewHolder.SimpleViewHolder(invoke8);
|
|
case 8:
|
|
View invoke9 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.recycler_item_bottom_nav_space);
|
|
m.checkNotNullExpressionValue(invoke9, "itemView");
|
|
return new GuildListViewHolder.SpaceViewHolder(invoke9);
|
|
case 9:
|
|
View invoke10 = widgetGuildListAdapter$onCreateViewHolder$1.invoke(R.layout.widget_guilds_list_item_hub_verification);
|
|
m.checkNotNullExpressionValue(invoke10, "itemView");
|
|
return new GuildListViewHolder.DiscordHubViewHolder(invoke10);
|
|
default:
|
|
throw new IllegalStateException(a.p("invalid view type: ", i));
|
|
}
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.GuildsDragAndDropCallback.Controller
|
|
public void onDragStarted(RecyclerView.ViewHolder viewHolder) {
|
|
m.checkNotNullParameter(viewHolder, "viewHolder");
|
|
GuildListViewHolder guildListViewHolder = (GuildListViewHolder) viewHolder;
|
|
guildListViewHolder.onDragStarted();
|
|
this.draggingItem = guildListViewHolder;
|
|
}
|
|
|
|
@Override // com.discord.widgets.guilds.list.GuildsDragAndDropCallback.Controller
|
|
public void onDrop() {
|
|
boolean onDrop = this.interactionListener.onDrop();
|
|
GuildListViewHolder guildListViewHolder = this.draggingItem;
|
|
if (guildListViewHolder != null) {
|
|
guildListViewHolder.onDragEnded(onDrop);
|
|
}
|
|
this.draggingItem = null;
|
|
}
|
|
|
|
/* JADX WARNING: Code restructure failed: missing block: B:55:0x00ec, code lost:
|
|
if (r7 != false) goto L_0x012f;
|
|
*/
|
|
/* JADX WARNING: Code restructure failed: missing block: B:81:0x012d, code lost:
|
|
if (r6 != false) goto L_0x012f;
|
|
*/
|
|
/* JADX WARNING: Removed duplicated region for block: B:53:0x00e8 */
|
|
/* JADX WARNING: Removed duplicated region for block: B:80:0x012b */
|
|
/* JADX WARNING: Removed duplicated region for block: B:85:0x0134 A[RETURN] */
|
|
/* JADX WARNING: Removed duplicated region for block: B:86:0x0135 */
|
|
@Override // com.discord.widgets.guilds.list.GuildsDragAndDropCallback.Controller
|
|
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder viewHolder2) {
|
|
boolean z2;
|
|
Operation operation;
|
|
boolean z3;
|
|
boolean z4;
|
|
m.checkNotNullParameter(recyclerView, "recyclerView");
|
|
m.checkNotNullParameter(viewHolder, "source");
|
|
m.checkNotNullParameter(viewHolder2, "target");
|
|
this.interactionListener.onItemMoved();
|
|
long itemId = ((GuildListViewHolder) viewHolder).getItemId();
|
|
long itemId2 = ((GuildListViewHolder) viewHolder2).getItemId();
|
|
int i = -1;
|
|
int i2 = 0;
|
|
int i3 = -1;
|
|
for (Object obj : this.items) {
|
|
int i4 = i2 + 1;
|
|
if (i2 < 0) {
|
|
n.throwIndexOverflow();
|
|
}
|
|
GuildListItem guildListItem = (GuildListItem) obj;
|
|
if (guildListItem.getItemId() == itemId) {
|
|
i = i2;
|
|
} else if (guildListItem.getItemId() == itemId2) {
|
|
i3 = i2;
|
|
}
|
|
i2 = i4;
|
|
}
|
|
if (i == -1 || i3 == -1) {
|
|
return false;
|
|
}
|
|
View view = viewHolder.itemView;
|
|
m.checkNotNullExpressionValue(view, "source.itemView");
|
|
TargetPosition targetPosition = (((float) Math.abs(this.selectedCenterY - this.targetCenterY)) > (((float) view.getHeight()) * 0.2f) ? 1 : (((float) Math.abs(this.selectedCenterY - this.targetCenterY)) == (((float) view.getHeight()) * 0.2f) ? 0 : -1)) < 0 ? TargetPosition.CENTER : this.selectedCenterY < this.targetCenterY ? TargetPosition.TOP : TargetPosition.BOTTOM;
|
|
GuildListItem guildListItem2 = (GuildListItem) this.items.get(i);
|
|
GuildListItem guildListItem3 = (GuildListItem) this.items.get(i3);
|
|
if (guildListItem2 instanceof GuildListItem.GuildItem) {
|
|
boolean z5 = (guildListItem3 instanceof GuildListItem.FolderItem) && (!((GuildListItem.FolderItem) guildListItem3).isOpen() || targetPosition != TargetPosition.CENTER);
|
|
if (guildListItem3 instanceof GuildListItem.GuildItem) {
|
|
GuildListItem.GuildItem guildItem = (GuildListItem.GuildItem) guildListItem3;
|
|
if (!guildItem.isLurkingGuild() && (guildItem.getFolderId() == null || targetPosition != TargetPosition.CENTER)) {
|
|
z4 = true;
|
|
boolean z6 = !(guildListItem3 instanceof GuildListItem.CreateItem) && targetPosition == TargetPosition.TOP;
|
|
if (!isPendingGuildOperation(guildListItem2, guildListItem3)) {
|
|
if (z5) {
|
|
if (z4) {
|
|
}
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
return false;
|
|
}
|
|
int ordinal = targetPosition.ordinal();
|
|
if (ordinal == 0) {
|
|
operation = new Operation.MoveAbove(i, i3);
|
|
} else if (ordinal == 1) {
|
|
operation = new Operation.TargetOperation(i, i3);
|
|
} else if (ordinal == 2) {
|
|
operation = new Operation.MoveBelow(i, i3);
|
|
} else {
|
|
throw new NoWhenBranchMatchedException();
|
|
}
|
|
this.interactionListener.onOperation(operation);
|
|
return true;
|
|
}
|
|
}
|
|
z4 = false;
|
|
if (!(guildListItem3 instanceof GuildListItem.CreateItem)) {
|
|
}
|
|
if (!isPendingGuildOperation(guildListItem2, guildListItem3)) {
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
} else if (guildListItem2 instanceof GuildListItem.FolderItem) {
|
|
if (guildListItem3 instanceof GuildListItem.GuildItem) {
|
|
GuildListItem.GuildItem guildItem2 = (GuildListItem.GuildItem) guildListItem3;
|
|
if (!guildItem2.isLurkingGuild() && guildItem2.getFolderId() == null && targetPosition != TargetPosition.CENTER) {
|
|
z3 = true;
|
|
boolean z7 = !(guildListItem3 instanceof GuildListItem.FolderItem) && (targetPosition == TargetPosition.TOP || (!((GuildListItem.FolderItem) guildListItem3).isOpen() && targetPosition == TargetPosition.BOTTOM));
|
|
if (!isPendingGuildOperation(guildListItem2, guildListItem3)) {
|
|
if (z3) {
|
|
}
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
}
|
|
}
|
|
z3 = false;
|
|
if (!(guildListItem3 instanceof GuildListItem.FolderItem)) {
|
|
}
|
|
if (!isPendingGuildOperation(guildListItem2, guildListItem3)) {
|
|
}
|
|
z2 = false;
|
|
if (!z2) {
|
|
}
|
|
} else {
|
|
throw new IllegalStateException("trying to drag invalid source");
|
|
}
|
|
z2 = true;
|
|
if (!z2) {
|
|
}
|
|
}
|
|
|
|
public final void setItems(List<? extends GuildListItem> list, boolean z2) {
|
|
m.checkNotNullParameter(list, "newItems");
|
|
if (z2) {
|
|
DiffUtil.DiffResult calculateDiff = DiffUtil.calculateDiff(createDiffUtilCallback(this.items, list), true);
|
|
m.checkNotNullExpressionValue(calculateDiff, "DiffUtil.calculateDiff(callback, true)");
|
|
this.items = list;
|
|
calculateDiff.dispatchUpdatesTo(this);
|
|
return;
|
|
}
|
|
this.items = list;
|
|
notifyDataSetChanged();
|
|
}
|
|
}
|