Migrate SinkItemCallback to Kotlin

This commit is contained in:
TPJ Schikhof
2025-12-12 14:42:28 +00:00
committed by Albert Vaca Cintora
parent 47e7a35f49
commit 1376bf4ad1
2 changed files with 20 additions and 27 deletions

View File

@@ -1,27 +0,0 @@
/*
* SPDX-FileCopyrightText: 2021 Art Pinch <leonardo906@mail.ru>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
package org.kde.kdeconnect.Plugins.SystemVolumePlugin;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.DiffUtil;
public class SinkItemCallback extends DiffUtil.ItemCallback<Sink> {
@Override
public boolean areItemsTheSame(@NonNull Sink oldItem, @NonNull Sink newItem) {
return oldItem.getName().equals(newItem.getName());
}
@Override
public boolean areContentsTheSame(@NonNull Sink oldItem, @NonNull Sink newItem) {
return oldItem.getVolume() == newItem.getVolume()
&& oldItem.isMute() == newItem.isMute()
&& oldItem.isDefault() == newItem.isDefault()
&& oldItem.getMaxVolume() == newItem.getMaxVolume() // should this be checked?
&& oldItem.getDescription().equals(newItem.getDescription()); // should this be checked?
}
}

View File

@@ -0,0 +1,20 @@
/*
* SPDX-FileCopyrightText: 2021 Art Pinch <leonardo906@mail.ru>
*
* SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL
*/
package org.kde.kdeconnect.Plugins.SystemVolumePlugin
import androidx.recyclerview.widget.DiffUtil
class SinkItemCallback : DiffUtil.ItemCallback<Sink?>() {
override fun areItemsTheSame(oldItem: Sink, newItem: Sink): Boolean
= oldItem.name == newItem.name
override fun areContentsTheSame(oldItem: Sink, newItem: Sink): Boolean
= oldItem.volume == newItem.volume
&& oldItem.mute == newItem.mute
&& oldItem.isDefault == newItem.isDefault
&& oldItem.maxVolume == newItem.maxVolume // should this be checked?
&& oldItem.description == newItem.description // should this be checked?
}