/*
* Copyright (C) 2012 Andrew Neal
* Copyright (C) 2014 The CyanogenMod Project
- * Licensed under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with the
- * License. You may obtain a copy of the License at
- * http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law
- * or agreed to in writing, software distributed under the License is
- * distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the specific language
- * governing permissions and limitations under the License.
+ * Copyright (C) 2019 The LineageOS Project
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
*/
package org.lineageos.eleven.model;
+import android.support.annotation.NonNull;
import android.text.TextUtils;
+import java.util.Comparator;
+
/**
* A class that represents a playlist.
*
mSongCount = songCount;
}
- /**
- * {@inheritDoc}
- */
@Override
public int hashCode() {
final int prime = 31;
return result;
}
- /**
- * {@inheritDoc}
- */
@Override
public boolean equals(final Object obj) {
if (this == obj) {
return TextUtils.equals(mPlaylistName, other.mPlaylistName);
}
- /**
- * {@inheritDoc}
- */
+ @NonNull
@Override
public String toString() {
- return mPlaylistName;
+ return "Playlist[playlistId=" + mPlaylistId
+ + ", playlistName=" + mPlaylistName
+ + ", songCount=" + mSongCount
+ + "]";
}
/**
public boolean isSmartPlaylist() {
return mPlaylistId < 0;
}
+
+ public static class IgnoreCaseComparator implements Comparator<Playlist> {
+ @Override
+ public int compare(Playlist p1, Playlist p2) {
+ return p1.mPlaylistName.compareToIgnoreCase(p2.mPlaylistName);
+ }
+ }
}