mirror of https://github.com/M66B/FairEmail.git
Refactoring
This commit is contained in:
parent
204c2418a2
commit
f0f1e0f3f6
|
@ -41,6 +41,7 @@ import java.util.Collections;
|
|||
import java.util.Comparator;
|
||||
import java.util.List;
|
||||
import java.util.Locale;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.ViewHolder> {
|
||||
private Context context;
|
||||
|
@ -200,7 +201,13 @@ public class AdapterNavFolder extends RecyclerView.Adapter<AdapterNavFolder.View
|
|||
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
|
||||
TupleFolderNav f1 = prev.get(oldItemPosition);
|
||||
TupleFolderNav f2 = next.get(newItemPosition);
|
||||
return f1.equals(f2);
|
||||
return (f1.name.equals(f2.name) &&
|
||||
f1.type.equals(f2.type) &&
|
||||
Objects.equals(f1.display, f2.display) &&
|
||||
Objects.equals(f1.color, f2.color) &&
|
||||
Objects.equals(f1.state, f2.state) &&
|
||||
f1.unseen == f2.unseen &&
|
||||
f1.operations == f2.operations);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -35,6 +35,7 @@ import androidx.recyclerview.widget.RecyclerView;
|
|||
import java.text.NumberFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHolder> {
|
||||
private Context context;
|
||||
|
@ -174,7 +175,9 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
|
|||
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
|
||||
NavMenuItem m1 = prev.get(oldItemPosition);
|
||||
NavMenuItem m2 = next.get(newItemPosition);
|
||||
return m1.equals(m2);
|
||||
return m1.getIcon() == m2.getIcon() &&
|
||||
m1.getTitle() == m2.getTitle() &&
|
||||
Objects.equals(m1.getCount(), m2.getCount());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -1,9 +1,5 @@
|
|||
package eu.faircode.email;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class NavMenuItem {
|
||||
private int icon;
|
||||
private int title;
|
||||
|
@ -61,15 +57,4 @@ public class NavMenuItem {
|
|||
longClick.run();
|
||||
return (longClick != null);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(@Nullable Object obj) {
|
||||
if (obj instanceof NavMenuItem) {
|
||||
NavMenuItem other = (NavMenuItem) obj;
|
||||
return (this.icon == other.icon &&
|
||||
this.title == other.title &&
|
||||
Objects.equals(this.count, other.count));
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -26,16 +26,4 @@ public class TupleFolderNav extends EntityFolder implements Serializable {
|
|||
public Integer color; // account
|
||||
public int unseen;
|
||||
public int operations;
|
||||
|
||||
@Override
|
||||
public boolean equals(Object obj) {
|
||||
if (obj instanceof TupleFolderNav) {
|
||||
TupleFolderNav other = (TupleFolderNav) obj;
|
||||
return (super.equals(obj) &&
|
||||
Objects.equals(this.color, other.color) &&
|
||||
this.unseen == other.unseen &&
|
||||
this.operations == other.operations);
|
||||
} else
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue