Initial commit
This commit is contained in:
@@ -0,0 +1,84 @@
|
||||
package com.chad.library.adapter.base.entity;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class AbstractExpandableItem<T> implements IExpandable<T> {
|
||||
protected boolean mExpandable = false;
|
||||
protected List<T> mSubItems;
|
||||
|
||||
public void addSubItem(T t) {
|
||||
if (this.mSubItems == null) {
|
||||
this.mSubItems = new ArrayList();
|
||||
}
|
||||
this.mSubItems.add(t);
|
||||
}
|
||||
|
||||
public boolean contains(T t) {
|
||||
List<T> list = this.mSubItems;
|
||||
return list != null && list.contains(t);
|
||||
}
|
||||
|
||||
public T getSubItem(int i) {
|
||||
if (!hasSubItem() || i >= this.mSubItems.size()) {
|
||||
return null;
|
||||
}
|
||||
return this.mSubItems.get(i);
|
||||
}
|
||||
|
||||
public int getSubItemPosition(T t) {
|
||||
List<T> list = this.mSubItems;
|
||||
if (list != null) {
|
||||
return list.indexOf(t);
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
@Override // com.chad.library.adapter.base.entity.IExpandable
|
||||
public List<T> getSubItems() {
|
||||
return this.mSubItems;
|
||||
}
|
||||
|
||||
public boolean hasSubItem() {
|
||||
List<T> list = this.mSubItems;
|
||||
return list != null && list.size() > 0;
|
||||
}
|
||||
|
||||
@Override // com.chad.library.adapter.base.entity.IExpandable
|
||||
public boolean isExpanded() {
|
||||
return this.mExpandable;
|
||||
}
|
||||
|
||||
public boolean removeSubItem(T t) {
|
||||
List<T> list = this.mSubItems;
|
||||
return list != null && list.remove(t);
|
||||
}
|
||||
|
||||
@Override // com.chad.library.adapter.base.entity.IExpandable
|
||||
public void setExpanded(boolean z) {
|
||||
this.mExpandable = z;
|
||||
}
|
||||
|
||||
public void setSubItems(List<T> list) {
|
||||
this.mSubItems = list;
|
||||
}
|
||||
|
||||
public boolean removeSubItem(int i) {
|
||||
List<T> list = this.mSubItems;
|
||||
if (list == null || i < 0 || i >= list.size()) {
|
||||
return false;
|
||||
}
|
||||
this.mSubItems.remove(i);
|
||||
return true;
|
||||
}
|
||||
|
||||
public void addSubItem(int i, T t) {
|
||||
List<T> list = this.mSubItems;
|
||||
if (list != null && i >= 0 && i < list.size()) {
|
||||
this.mSubItems.add(i, t);
|
||||
} else {
|
||||
addSubItem(t);
|
||||
}
|
||||
}
|
||||
}
|
@@ -0,0 +1,14 @@
|
||||
package com.chad.library.adapter.base.entity;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface IExpandable<T> {
|
||||
int getLevel();
|
||||
|
||||
List<T> getSubItems();
|
||||
|
||||
boolean isExpanded();
|
||||
|
||||
void setExpanded(boolean z);
|
||||
}
|
@@ -0,0 +1,6 @@
|
||||
package com.chad.library.adapter.base.entity;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public interface MultiItemEntity {
|
||||
int getItemType();
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.chad.library.adapter.base.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class SectionEntity<T> implements Serializable {
|
||||
public String header;
|
||||
public boolean isHeader;
|
||||
public T t;
|
||||
|
||||
public SectionEntity(boolean z, String str) {
|
||||
this.isHeader = z;
|
||||
this.header = str;
|
||||
this.t = null;
|
||||
}
|
||||
|
||||
public SectionEntity(T t) {
|
||||
this.isHeader = false;
|
||||
this.header = null;
|
||||
this.t = t;
|
||||
}
|
||||
}
|
@@ -0,0 +1,22 @@
|
||||
package com.chad.library.adapter.base.entity;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
/* loaded from: classes.dex */
|
||||
public abstract class SectionMultiEntity<T> implements Serializable, MultiItemEntity {
|
||||
public String header;
|
||||
public boolean isHeader;
|
||||
public T t;
|
||||
|
||||
public SectionMultiEntity(boolean z, String str) {
|
||||
this.isHeader = z;
|
||||
this.header = str;
|
||||
this.t = null;
|
||||
}
|
||||
|
||||
public SectionMultiEntity(T t) {
|
||||
this.isHeader = false;
|
||||
this.header = null;
|
||||
this.t = t;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user