File indexing completed on 2024-12-22 04:41:41

0001 /*
0002  * SPDX-FileCopyrightText: 2021 Art Pinch <leonardo906@mail.ru>
0003  *
0004  * SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
0005 */
0006 
0007 package org.kde.kdeconnect.Plugins.SystemVolumePlugin;
0008 
0009 import androidx.annotation.NonNull;
0010 import androidx.recyclerview.widget.DiffUtil;
0011 
0012 public class SinkItemCallback extends DiffUtil.ItemCallback<Sink> {
0013 
0014     @Override
0015     public boolean areItemsTheSame(@NonNull Sink oldItem, @NonNull Sink newItem) {
0016         return oldItem.getName().equals(newItem.getName());
0017     }
0018 
0019     @Override
0020     public boolean areContentsTheSame(@NonNull Sink oldItem, @NonNull Sink newItem) {
0021         return oldItem.getVolume() == newItem.getVolume()
0022                 && oldItem.isMute() == newItem.isMute()
0023                 && oldItem.isDefault() == newItem.isDefault()
0024                 && oldItem.getMaxVolume() == newItem.getMaxVolume() // should this be checked?
0025                 && oldItem.getDescription().equals(newItem.getDescription()); // should this be checked?
0026     }
0027 }