mirror of https://github.com/tasks/tasks
Convert FilterListItem to interface
parent
a32d35720a
commit
ee3d3fa4f5
@ -1,110 +0,0 @@
|
||||
/*
|
||||
* Copyright (c) 2012 Todoroo Inc
|
||||
*
|
||||
* See the file "LICENSE" for the full license governing this code.
|
||||
*/
|
||||
|
||||
package com.todoroo.astrid.api;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.LayoutRes;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import org.tasks.R;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* Represents an item displayed by Astrid's FilterListActivity
|
||||
*
|
||||
* @author Tim Su <tim@todoroo.com>
|
||||
*/
|
||||
public abstract class FilterListItem implements Parcelable {
|
||||
|
||||
public static final int NO_ORDER = -1;
|
||||
|
||||
/** Title of this item displayed on the Filters page */
|
||||
public String listingTitle = null;
|
||||
|
||||
public long id = 0;
|
||||
public int icon = -1;
|
||||
public int tint = 0;
|
||||
public int count = -1;
|
||||
public int principals = 0;
|
||||
public int order = NO_ORDER;
|
||||
|
||||
public abstract Type getItemType();
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(listingTitle);
|
||||
dest.writeInt(icon);
|
||||
dest.writeInt(tint);
|
||||
dest.writeInt(count);
|
||||
dest.writeInt(order);
|
||||
dest.writeLong(id);
|
||||
}
|
||||
|
||||
// --- parcelable helpers
|
||||
|
||||
/** Utility method to read FilterListItem properties from a parcel. */
|
||||
protected void readFromParcel(Parcel source) {
|
||||
listingTitle = source.readString();
|
||||
icon = source.readInt();
|
||||
tint = source.readInt();
|
||||
count = source.readInt();
|
||||
order = source.readInt();
|
||||
id = source.readLong();
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean areItemsTheSame(@NonNull FilterListItem other) {
|
||||
return getClass().equals(other.getClass()) && id == other.id;
|
||||
}
|
||||
|
||||
public boolean areContentsTheSame(@NonNull FilterListItem other) {
|
||||
return Objects.equals(listingTitle, other.listingTitle)
|
||||
&& icon == other.icon
|
||||
&& tint == other.tint
|
||||
&& count == other.count
|
||||
&& order == other.order
|
||||
&& principals == other.principals;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "FilterListItem{" +
|
||||
"listingTitle='" + listingTitle + '\'' +
|
||||
", id=" + id +
|
||||
", icon=" + icon +
|
||||
", tint=" + tint +
|
||||
", count=" + count +
|
||||
", principals=" + principals +
|
||||
", order=" + order +
|
||||
'}';
|
||||
}
|
||||
|
||||
public enum Type {
|
||||
ITEM(R.layout.filter_adapter_row),
|
||||
ACTION(R.layout.filter_adapter_action),
|
||||
SUBHEADER(R.layout.filter_adapter_subheader),
|
||||
SEPARATOR(R.layout.filter_adapter_separator);
|
||||
|
||||
public final int layout;
|
||||
|
||||
Type(@LayoutRes int layout) {
|
||||
this.layout = layout;
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package com.todoroo.astrid.api
|
||||
|
||||
import android.os.Parcelable
|
||||
import androidx.annotation.LayoutRes
|
||||
import org.tasks.R
|
||||
|
||||
interface FilterListItem : Parcelable {
|
||||
val itemType: Type
|
||||
|
||||
fun areItemsTheSame(other: FilterListItem): Boolean
|
||||
fun areContentsTheSame(other: FilterListItem): Boolean
|
||||
|
||||
enum class Type(@param:LayoutRes val layout: Int) {
|
||||
ITEM(R.layout.filter_adapter_row),
|
||||
ACTION(R.layout.filter_adapter_action),
|
||||
SUBHEADER(R.layout.filter_adapter_subheader),
|
||||
SEPARATOR(R.layout.filter_adapter_separator)
|
||||
}
|
||||
}
|
@ -1,44 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import androidx.room.Embedded;
|
||||
|
||||
import com.todoroo.astrid.api.CaldavFilter;
|
||||
|
||||
import org.tasks.data.CaldavCalendar;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class CaldavFilters {
|
||||
@Embedded public CaldavCalendar caldavCalendar;
|
||||
public int count;
|
||||
public int principals;
|
||||
|
||||
CaldavFilter toCaldavFilter() {
|
||||
CaldavFilter filter = new CaldavFilter(caldavCalendar);
|
||||
filter.count = count;
|
||||
filter.principals = principals;
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof CaldavFilters)) {
|
||||
return false;
|
||||
}
|
||||
CaldavFilters that = (CaldavFilters) o;
|
||||
return count == that.count && Objects.equals(caldavCalendar, that.caldavCalendar);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(caldavCalendar, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "CaldavFilters{" + "caldavCalendar=" + caldavCalendar + ", count=" + count + '}';
|
||||
}
|
||||
}
|
@ -0,0 +1,20 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import androidx.room.Embedded
|
||||
import com.todoroo.astrid.api.CaldavFilter
|
||||
import org.tasks.data.CaldavCalendar
|
||||
|
||||
data class CaldavFilters(
|
||||
@JvmField @Embedded val caldavCalendar: CaldavCalendar,
|
||||
@JvmField val count: Int,
|
||||
@JvmField val principals: Int,
|
||||
) {
|
||||
fun toCaldavFilter(): CaldavFilter {
|
||||
val filter = CaldavFilter(
|
||||
calendar = caldavCalendar,
|
||||
principals = principals,
|
||||
)
|
||||
filter.count = count
|
||||
return filter
|
||||
}
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import androidx.room.Embedded;
|
||||
|
||||
import com.todoroo.astrid.api.GtasksFilter;
|
||||
|
||||
import org.tasks.data.CaldavCalendar;
|
||||
|
||||
import java.util.Objects;
|
||||
|
||||
public class GoogleTaskFilters {
|
||||
@Embedded public CaldavCalendar googleTaskList;
|
||||
public int count;
|
||||
|
||||
GtasksFilter toGtasksFilter() {
|
||||
GtasksFilter filter = new GtasksFilter(googleTaskList);
|
||||
filter.count = count;
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof GoogleTaskFilters)) {
|
||||
return false;
|
||||
}
|
||||
GoogleTaskFilters that = (GoogleTaskFilters) o;
|
||||
return count == that.count && Objects.equals(googleTaskList, that.googleTaskList);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(googleTaskList, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "GoogleTaskFilters{" + "googleTaskList=" + googleTaskList + ", count=" + count + '}';
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import androidx.room.Embedded
|
||||
import com.todoroo.astrid.api.GtasksFilter
|
||||
import org.tasks.data.CaldavCalendar
|
||||
|
||||
data class GoogleTaskFilters(
|
||||
@JvmField @Embedded val googleTaskList: CaldavCalendar,
|
||||
@JvmField val count: Int,
|
||||
) {
|
||||
fun toGtasksFilter(): GtasksFilter {
|
||||
val filter = GtasksFilter(googleTaskList)
|
||||
filter.count = count
|
||||
return filter
|
||||
}
|
||||
}
|
@ -1,38 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import androidx.room.Embedded;
|
||||
import java.util.Objects;
|
||||
import org.tasks.data.Place;
|
||||
|
||||
public class LocationFilters {
|
||||
@Embedded public Place place;
|
||||
public int count;
|
||||
|
||||
PlaceFilter toLocationFilter() {
|
||||
PlaceFilter filter = new PlaceFilter(place);
|
||||
filter.count = count;
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof LocationFilters)) {
|
||||
return false;
|
||||
}
|
||||
LocationFilters that = (LocationFilters) o;
|
||||
return count == that.count && Objects.equals(place, that.place);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(place, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "LocationFilters{" + "place=" + place + ", count=" + count + '}';
|
||||
}
|
||||
}
|
@ -0,0 +1,15 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import androidx.room.Embedded
|
||||
import org.tasks.data.Place
|
||||
|
||||
data class LocationFilters(
|
||||
@JvmField @Embedded var place: Place,
|
||||
@JvmField var count: Int
|
||||
) {
|
||||
fun toLocationFilter(): PlaceFilter {
|
||||
val filter = PlaceFilter(place)
|
||||
filter.count = count
|
||||
return filter
|
||||
}
|
||||
}
|
@ -1,71 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.todoroo.astrid.api.FilterListItem;
|
||||
|
||||
public class NavigationDrawerAction extends FilterListItem {
|
||||
|
||||
/** Parcelable Creator Object */
|
||||
public static final Parcelable.Creator<NavigationDrawerAction> CREATOR =
|
||||
new Parcelable.Creator<>() {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public NavigationDrawerAction createFromParcel(Parcel source) {
|
||||
NavigationDrawerAction item = new NavigationDrawerAction();
|
||||
item.readFromParcel(source);
|
||||
return item;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public NavigationDrawerAction[] newArray(int size) {
|
||||
return new NavigationDrawerAction[size];
|
||||
}
|
||||
};
|
||||
|
||||
public Intent intent;
|
||||
public int requestCode;
|
||||
|
||||
private NavigationDrawerAction() {}
|
||||
|
||||
public NavigationDrawerAction(String listingTitle, int icon, int requestCode) {
|
||||
this(listingTitle, icon, null, requestCode);
|
||||
}
|
||||
|
||||
public NavigationDrawerAction(String listingTitle, int icon, Intent intent, int requestCode) {
|
||||
this.listingTitle = listingTitle;
|
||||
this.icon = icon;
|
||||
this.intent = intent;
|
||||
this.requestCode = requestCode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getItemType() {
|
||||
return Type.ACTION;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
dest.writeParcelable(intent, 0);
|
||||
dest.writeInt(requestCode);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readFromParcel(Parcel source) {
|
||||
super.readFromParcel(source);
|
||||
intent = source.readParcelable(Intent.class.getClassLoader());
|
||||
requestCode = source.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull FilterListItem other) {
|
||||
return other instanceof NavigationDrawerAction
|
||||
&& requestCode == ((NavigationDrawerAction) other).requestCode;
|
||||
}
|
||||
}
|
@ -0,0 +1,21 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import android.content.Intent
|
||||
import com.todoroo.astrid.api.FilterListItem
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class NavigationDrawerAction(
|
||||
val listingTitle: String,
|
||||
val icon: Int,
|
||||
val requestCode: Int,
|
||||
val intent: Intent? = null,
|
||||
) : FilterListItem {
|
||||
@IgnoredOnParcel
|
||||
override val itemType = FilterListItem.Type.ACTION
|
||||
|
||||
override fun areItemsTheSame(other: FilterListItem) = this == other
|
||||
|
||||
override fun areContentsTheSame(other: FilterListItem) = true
|
||||
}
|
@ -1,42 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import androidx.annotation.NonNull;
|
||||
import com.todoroo.astrid.api.FilterListItem;
|
||||
|
||||
public class NavigationDrawerSeparator extends FilterListItem {
|
||||
|
||||
public static final Parcelable.Creator<NavigationDrawerSeparator> CREATOR =
|
||||
new Parcelable.Creator<>() {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public NavigationDrawerSeparator createFromParcel(Parcel source) {
|
||||
NavigationDrawerSeparator navigationDrawerSeparator = new NavigationDrawerSeparator();
|
||||
navigationDrawerSeparator.readFromParcel(source);
|
||||
return navigationDrawerSeparator;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public NavigationDrawerSeparator[] newArray(int size) {
|
||||
return new NavigationDrawerSeparator[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public Type getItemType() {
|
||||
return Type.SEPARATOR;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull FilterListItem other) {
|
||||
return other instanceof NavigationDrawerSeparator;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull FilterListItem other) {
|
||||
return true;
|
||||
}
|
||||
}
|
@ -0,0 +1,19 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import com.todoroo.astrid.api.FilterListItem
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
class NavigationDrawerSeparator : FilterListItem {
|
||||
@IgnoredOnParcel
|
||||
override val itemType = FilterListItem.Type.SEPARATOR
|
||||
|
||||
override fun areItemsTheSame(other: FilterListItem): Boolean {
|
||||
return other is NavigationDrawerSeparator
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(other: FilterListItem): Boolean {
|
||||
return true
|
||||
}
|
||||
}
|
@ -1,157 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.core.os.ParcelCompat;
|
||||
import com.todoroo.astrid.api.FilterListItem;
|
||||
|
||||
public class NavigationDrawerSubheader extends FilterListItem {
|
||||
|
||||
public static final Parcelable.Creator<NavigationDrawerSubheader> CREATOR =
|
||||
new Parcelable.Creator<>() {
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public NavigationDrawerSubheader createFromParcel(Parcel source) {
|
||||
NavigationDrawerSubheader navigationDrawerSubheader = new NavigationDrawerSubheader();
|
||||
navigationDrawerSubheader.readFromParcel(source);
|
||||
return navigationDrawerSubheader;
|
||||
}
|
||||
|
||||
/** {@inheritDoc} */
|
||||
@Override
|
||||
public NavigationDrawerSubheader[] newArray(int size) {
|
||||
return new NavigationDrawerSubheader[size];
|
||||
}
|
||||
};
|
||||
public boolean error;
|
||||
private boolean collapsed;
|
||||
private SubheaderType subheaderType;
|
||||
private long id;
|
||||
@Nullable
|
||||
private Intent addIntent;
|
||||
private int addIntentRc;
|
||||
|
||||
private NavigationDrawerSubheader() {}
|
||||
|
||||
public NavigationDrawerSubheader(
|
||||
String listingTitle,
|
||||
boolean error,
|
||||
boolean collapsed,
|
||||
SubheaderType subheaderType,
|
||||
long id,
|
||||
int addIntentRc,
|
||||
@Nullable Intent addIntent
|
||||
) {
|
||||
this.error = error;
|
||||
this.collapsed = collapsed;
|
||||
this.subheaderType = subheaderType;
|
||||
this.id = id;
|
||||
this.addIntent = addIntent;
|
||||
this.addIntentRc = addIntentRc;
|
||||
this.listingTitle = listingTitle;
|
||||
}
|
||||
|
||||
public long getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
public boolean isCollapsed() {
|
||||
return collapsed;
|
||||
}
|
||||
|
||||
@Nullable
|
||||
public Intent getAddIntent() {
|
||||
return addIntent;
|
||||
}
|
||||
|
||||
public int getAddIntentRc() {
|
||||
return addIntentRc;
|
||||
}
|
||||
|
||||
public SubheaderType getSubheaderType() {
|
||||
return subheaderType;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void readFromParcel(Parcel source) {
|
||||
super.readFromParcel(source);
|
||||
error = ParcelCompat.readBoolean(source);
|
||||
collapsed = ParcelCompat.readBoolean(source);
|
||||
subheaderType = (SubheaderType) source.readSerializable();
|
||||
id = source.readLong();
|
||||
addIntent = source.readParcelable(getClass().getClassLoader());
|
||||
addIntentRc = source.readInt();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areItemsTheSame(@NonNull FilterListItem other) {
|
||||
return other instanceof NavigationDrawerSubheader
|
||||
&& subheaderType == ((NavigationDrawerSubheader) other).getSubheaderType()
|
||||
&& id == other.getId();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean areContentsTheSame(@NonNull FilterListItem other) {
|
||||
return this.equals(other);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof NavigationDrawerSubheader)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
NavigationDrawerSubheader that = (NavigationDrawerSubheader) o;
|
||||
|
||||
if (error != that.error) {
|
||||
return false;
|
||||
}
|
||||
if (collapsed != that.collapsed) {
|
||||
return false;
|
||||
}
|
||||
if (id != that.id) {
|
||||
return false;
|
||||
}
|
||||
return subheaderType == that.subheaderType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
int result = (error ? 1 : 0);
|
||||
result = 31 * result + (collapsed ? 1 : 0);
|
||||
result = 31 * result + (subheaderType != null ? subheaderType.hashCode() : 0);
|
||||
result = 31 * result + (int) (id ^ (id >>> 32));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
super.writeToParcel(dest, flags);
|
||||
ParcelCompat.writeBoolean(dest, error);
|
||||
ParcelCompat.writeBoolean(dest, collapsed);
|
||||
dest.writeSerializable(subheaderType);
|
||||
dest.writeLong(id);
|
||||
dest.writeParcelable(addIntent, 0);
|
||||
dest.writeInt(addIntentRc);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Type getItemType() {
|
||||
return Type.SUBHEADER;
|
||||
}
|
||||
|
||||
public enum SubheaderType {
|
||||
PREFERENCE,
|
||||
GOOGLE_TASKS,
|
||||
CALDAV,
|
||||
TASKS,
|
||||
@Deprecated ETESYNC
|
||||
}
|
||||
}
|
@ -0,0 +1,37 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import android.content.Intent
|
||||
import com.todoroo.astrid.api.FilterListItem
|
||||
import kotlinx.parcelize.IgnoredOnParcel
|
||||
import kotlinx.parcelize.Parcelize
|
||||
|
||||
@Parcelize
|
||||
data class NavigationDrawerSubheader(
|
||||
val listingTitle: String?,
|
||||
val error: Boolean,
|
||||
val isCollapsed: Boolean,
|
||||
val subheaderType: SubheaderType,
|
||||
val id: Long,
|
||||
val addIntentRc: Int,
|
||||
val addIntent: Intent?,
|
||||
) : FilterListItem {
|
||||
override fun areItemsTheSame(other: FilterListItem): Boolean {
|
||||
return other is NavigationDrawerSubheader && subheaderType == other.subheaderType && id == other.id
|
||||
}
|
||||
|
||||
override fun areContentsTheSame(other: FilterListItem): Boolean {
|
||||
return this == other
|
||||
}
|
||||
|
||||
@IgnoredOnParcel
|
||||
override val itemType = FilterListItem.Type.SUBHEADER
|
||||
|
||||
enum class SubheaderType {
|
||||
PREFERENCE,
|
||||
GOOGLE_TASKS,
|
||||
CALDAV,
|
||||
TASKS,
|
||||
@Deprecated("")
|
||||
ETESYNC
|
||||
}
|
||||
}
|
@ -1,39 +0,0 @@
|
||||
package org.tasks.filters;
|
||||
|
||||
import androidx.room.Embedded;
|
||||
import com.todoroo.astrid.api.TagFilter;
|
||||
import java.util.Objects;
|
||||
import org.tasks.data.TagData;
|
||||
|
||||
public class TagFilters {
|
||||
@Embedded public TagData tagData;
|
||||
public int count;
|
||||
|
||||
TagFilter toTagFilter() {
|
||||
TagFilter filter = new TagFilter(tagData);
|
||||
filter.count = count;
|
||||
return filter;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) {
|
||||
return true;
|
||||
}
|
||||
if (!(o instanceof TagFilters)) {
|
||||
return false;
|
||||
}
|
||||
TagFilters that = (TagFilters) o;
|
||||
return count == that.count && Objects.equals(tagData, that.tagData);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int hashCode() {
|
||||
return Objects.hash(tagData, count);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "TagFilters{" + "tagData=" + tagData + ", count=" + count + '}';
|
||||
}
|
||||
}
|
@ -0,0 +1,16 @@
|
||||
package org.tasks.filters
|
||||
|
||||
import androidx.room.Embedded
|
||||
import com.todoroo.astrid.api.TagFilter
|
||||
import org.tasks.data.TagData
|
||||
|
||||
data class TagFilters(
|
||||
@JvmField @Embedded var tagData: TagData,
|
||||
@JvmField var count: Int,
|
||||
) {
|
||||
fun toTagFilter(): TagFilter {
|
||||
val filter = TagFilter(tagData)
|
||||
filter.count = count
|
||||
return filter
|
||||
}
|
||||
}
|
Loading…
Reference in New Issue