|
|
@ -5,12 +5,13 @@ import static com.todoroo.andlib.utility.AndroidUtilities.mapToSerializedString;
|
|
|
|
import android.os.Parcel;
|
|
|
|
import android.os.Parcel;
|
|
|
|
import android.os.Parcelable;
|
|
|
|
import android.os.Parcelable;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import androidx.annotation.NonNull;
|
|
|
|
import java.util.Map;
|
|
|
|
|
|
|
|
import org.tasks.Objects;
|
|
|
|
import org.tasks.Objects;
|
|
|
|
import org.tasks.R;
|
|
|
|
import org.tasks.R;
|
|
|
|
|
|
|
|
|
|
|
|
public class CustomFilter extends Filter {
|
|
|
|
public class CustomFilter extends Filter {
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private static final int FILTER = R.drawable.ic_outline_filter_list_24px;
|
|
|
|
|
|
|
|
|
|
|
|
/** Parcelable Creator Object */
|
|
|
|
/** Parcelable Creator Object */
|
|
|
|
public static final Parcelable.Creator<CustomFilter> CREATOR =
|
|
|
|
public static final Parcelable.Creator<CustomFilter> CREATOR =
|
|
|
|
new Parcelable.Creator<CustomFilter>() {
|
|
|
|
new Parcelable.Creator<CustomFilter>() {
|
|
|
@ -31,11 +32,13 @@ public class CustomFilter extends Filter {
|
|
|
|
private long id;
|
|
|
|
private long id;
|
|
|
|
private String criterion;
|
|
|
|
private String criterion;
|
|
|
|
|
|
|
|
|
|
|
|
public CustomFilter(
|
|
|
|
public CustomFilter(org.tasks.data.Filter filter) {
|
|
|
|
String listingTitle, String sql, Map<String, Object> values, long id, String criterion) {
|
|
|
|
// TODO: replace dirty hack for missing column
|
|
|
|
super(listingTitle, sql, values);
|
|
|
|
super(
|
|
|
|
this.id = id;
|
|
|
|
filter.getTitle(), filter.getSql().replace("tasks.userId=0", "1"), filter.getValuesAsMap());
|
|
|
|
this.criterion = criterion;
|
|
|
|
this.id = filter.getId();
|
|
|
|
|
|
|
|
this.criterion = filter.getCriterion();
|
|
|
|
|
|
|
|
this.icon = FILTER;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private CustomFilter(Parcel parcel) {
|
|
|
|
private CustomFilter(Parcel parcel) {
|
|
|
@ -85,6 +88,7 @@ public class CustomFilter extends Filter {
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
public boolean areContentsTheSame(@NonNull FilterListItem other) {
|
|
|
|
public boolean areContentsTheSame(@NonNull FilterListItem other) {
|
|
|
|
return super.areContentsTheSame(other) && Objects.equals(criterion, ((CustomFilter) other).criterion);
|
|
|
|
return super.areContentsTheSame(other)
|
|
|
|
|
|
|
|
&& Objects.equals(criterion, ((CustomFilter) other).criterion);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|