-
Notifications
You must be signed in to change notification settings - Fork 249
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
This commit adds an instance status column which indicates which instance of a task is the next one to complete. This allows to filter out the instances which come after the next one.
- Loading branch information
Showing
9 changed files
with
192 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
44 changes: 44 additions & 0 deletions
44
...-provider/src/main/java/org/dmfs/provider/tasks/processors/tasks/instancedata/Stated.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
/* | ||
* Copyright 2017 dmfs GmbH | ||
* | ||
* 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.dmfs.provider.tasks.processors.tasks.instancedata; | ||
|
||
import android.content.ContentValues; | ||
|
||
import org.dmfs.jems.single.Single; | ||
import org.dmfs.jems.single.decorators.DelegatingSingle; | ||
import org.dmfs.tasks.contract.TaskContract; | ||
|
||
|
||
/** | ||
* A {@link Single} of the instance status {@link ContentValues} of an instance. | ||
* | ||
* @author Marten Gajda | ||
*/ | ||
public final class Stated extends DelegatingSingle<ContentValues> | ||
{ | ||
|
||
public Stated(boolean closed, Single<ContentValues> delegate) | ||
{ | ||
super(() -> | ||
{ | ||
ContentValues values = delegate.value(); | ||
values.put(TaskContract.Instances.INSTANCE_STATUS, | ||
closed ? TaskContract.Instances.INSTANCE_STATUS_CLOSED : TaskContract.Instances.INSTANCE_STATUS_NEXT); | ||
return values; | ||
}); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 49 additions & 0 deletions
49
opentaskspal/src/main/java/org/dmfs/opentaskspal/tasks/StatusData.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
/* | ||
* Copyright 2017 dmfs GmbH | ||
* | ||
* 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.dmfs.opentaskspal.tasks; | ||
|
||
import android.content.ContentProviderOperation; | ||
import android.support.annotation.NonNull; | ||
|
||
import org.dmfs.android.contentpal.RowData; | ||
import org.dmfs.android.contentpal.TransactionContext; | ||
import org.dmfs.tasks.contract.TaskContract; | ||
|
||
|
||
/** | ||
* {@link RowData} for the status of a task. | ||
* | ||
* @author Marten Gajda | ||
*/ | ||
public final class StatusData implements RowData<TaskContract.Tasks> | ||
{ | ||
private final int mStatus; | ||
|
||
|
||
public StatusData(int status) | ||
{ | ||
mStatus = status; | ||
} | ||
|
||
|
||
@NonNull | ||
@Override | ||
public ContentProviderOperation.Builder updatedBuilder(@NonNull TransactionContext transactionContext, @NonNull ContentProviderOperation.Builder builder) | ||
{ | ||
return builder.withValue(TaskContract.Tasks.STATUS, mStatus); | ||
} | ||
} |