|
|
|
|
@ -15,6 +15,8 @@ import com.fongmi.android.tv.utils.UrlUtil; |
|
|
|
|
import com.fongmi.android.tv.utils.Util; |
|
|
|
|
import com.google.gson.annotations.SerializedName; |
|
|
|
|
|
|
|
|
|
import java.util.Collections; |
|
|
|
|
import java.util.Comparator; |
|
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
|
|
@Entity(indices = @Index(value = {"uuid", "name"}, unique = true)) |
|
|
|
|
@ -139,4 +141,17 @@ public class Device { |
|
|
|
|
public String toString() { |
|
|
|
|
return App.gson().toJson(this); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static class Sorter implements Comparator<Device> { |
|
|
|
|
|
|
|
|
|
public static void sort(List<Device> items) { |
|
|
|
|
if (items.size() > 1) Collections.sort(items, new Sorter()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public int compare(Device o1, Device o2) { |
|
|
|
|
int comp = Integer.compare(o1.getType(), o2.getType()); |
|
|
|
|
return comp != 0 ? comp : o1.getName().compareTo(o2.getName()); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|