adjust areContentsTheSame criteria

This commit is contained in:
m2049r 2021-03-12 18:48:58 +01:00 committed by m2049r
parent 77e9bf7c43
commit 3329636d32
2 changed files with 9 additions and 4 deletions

View File

@ -227,8 +227,7 @@ public class NodeInfo extends Node {
if (response.isSuccessful()) {
ResponseBody respBody = response.body(); // closed through Response object
if ((respBody != null) && (respBody.contentLength() < 2000)) { // sanity check
final JSONObject json = new JSONObject(
respBody.string());
final JSONObject json = new JSONObject(respBody.string());
String rpcVersion = json.getString("jsonrpc");
if (!RPC_VERSION.equals(rpcVersion))
return false;

View File

@ -77,8 +77,14 @@ public class NodeInfoAdapter extends RecyclerView.Adapter<NodeInfoAdapter.ViewHo
@Override
public boolean areContentsTheSame(int oldItemPosition, int newItemPosition) {
return mOldList.get(oldItemPosition).toNodeString().equals(mNewList.get(newItemPosition).toNodeString())
&& (mOldList.get(oldItemPosition).isSelected() == mNewList.get(newItemPosition).isSelected());
final NodeInfo oldItem = mOldList.get(oldItemPosition);
final NodeInfo newItem = mNewList.get(newItemPosition);
return (oldItem.getTimestamp() == newItem.getTimestamp())
&& (oldItem.isTested() == newItem.isTested())
&& (oldItem.isValid() == newItem.isValid())
&& (oldItem.getResponseTime() == newItem.getResponseTime())
&& (oldItem.isSelected() == newItem.isSelected())
&& (oldItem.getName().equals(newItem.getName()));
}
}