mirror of
https://invent.kde.org/network/kdeconnect-android.git
synced 2025-12-12 20:35:58 +01:00
Migrate SinkItemCallback to Kotlin
This commit is contained in:
committed by
Albert Vaca Cintora
parent
47e7a35f49
commit
1376bf4ad1
@@ -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?
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -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?
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user