Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Unverified Commit cce6120a authored by Marten Gajda's avatar Marten Gajda Committed by GitHub
Browse files

Update dependencies, implements #797 (#799)

* update jems to 1.22
* update contentpal to 0.5
* update lib-recur to 0.11.2
* update color-picker to 1.3
* update bolts to 0.1
* fix dependency scopes
* update `Diff` usage to account for correct Comparator logic
* replace some classes with their upstream counterparts
parent e0c25471
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
def jems_version = '1.18'
def contentpal_version = 'a7fbc62eef' //  a7fbc62eef -> 2018-08-19
def jems_version = '1.22'
def contentpal_version = '0.5'
def androidx_test_runner_version = '1.1.1'

ext.deps = [
@@ -12,19 +12,20 @@ ext.deps = [
        // dmfs
        jems               : "org.dmfs:jems:$jems_version",
        datetime           : 'org.dmfs:rfc5545-datetime:0.2.4',
        lib_recur          : 'org.dmfs:lib-recur:0.10.1',
        lib_recur          : 'org.dmfs:lib-recur:0.11.2',
        xml_magic          : 'org.dmfs:android-xml-magic:0.1.1',
        color_picker       : 'com.github.dmfs.color-picker:colorpicker:1.1',
        color_picker       : 'com.github.dmfs:color-picker:1.3',
        android_carrot     : 'com.github.dmfs.androidcarrot:androidcarrot:13edc04',
        bolts_color        : 'com.github.dmfs.bolts:color-bolts:2b1b95d', // 2b1b95d -> 2017-12-12
        bolts_color        : 'com.github.dmfs.Bolts:color-bolts:0.1',
        contentpal         : "com.github.dmfs.contentpal:contentpal:$contentpal_version",
        retention_magic    : 'com.github.dmfs:retention-magic:1.3',

        // 3rd party
        codeka_carrot      : 'au.com.codeka:carrot:2.4.0',

        // Testing
        junit              : 'junit:junit:4.12',
        hamcrest           : 'org.hamcrest:hamcrest-all:1.3',
        hamcrest           : 'org.hamcrest:hamcrest-library:1.3',
        mockito            : 'org.mockito:mockito-core:2.27.0',
        robolectric        : 'org.robolectric:robolectric:3.5.1',
        support_test_runner: "androidx.test:runner:$androidx_test_runner_version",
+1 −2
Original line number Diff line number Diff line
@@ -27,8 +27,7 @@ android {
}

dependencies {
    api project(':opentasks-contract')

    implementation project(':opentasks-contract')
    implementation deps.datetime
    implementation deps.lib_recur
    implementation deps.jems
+1 −1
Original line number Diff line number Diff line
@@ -21,10 +21,10 @@ import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.text.TextUtils;

import org.dmfs.jems.iterable.decorators.Chunked;
import org.dmfs.ngrams.NGramGenerator;
import org.dmfs.provider.tasks.TaskDatabaseHelper.Tables;
import org.dmfs.provider.tasks.model.TaskAdapter;
import org.dmfs.provider.tasks.utils.Chunked;
import org.dmfs.tasks.contract.TaskContract;
import org.dmfs.tasks.contract.TaskContract.Properties;
import org.dmfs.tasks.contract.TaskContract.TaskColumns;
+3 −5
Original line number Diff line number Diff line
@@ -22,11 +22,11 @@ import android.database.sqlite.SQLiteDatabase;

import org.dmfs.jems.iterable.composite.Diff;
import org.dmfs.jems.iterable.decorators.Mapped;
import org.dmfs.jems.optional.Optional;
import org.dmfs.jems.optional.elementary.NullSafe;
import org.dmfs.jems.pair.Pair;
import org.dmfs.jems.single.Single;
import org.dmfs.jems.single.combined.Backed;
import org.dmfs.optional.Optional;
import org.dmfs.provider.tasks.TaskDatabaseHelper;
import org.dmfs.provider.tasks.model.TaskAdapter;
import org.dmfs.provider.tasks.model.adapters.BooleanFieldAdapter;
@@ -187,10 +187,8 @@ public final class Instantiating implements EntityProcessor<TaskAdapter>
                    (newInstanceValues, cursorRow) ->
                    {
                        existingInstances.moveToPosition(cursorRow);
                        return (int) (existingInstances.getLong(startIdx) -
                                new Backed<>(
                                        new NullSafe<>(newInstanceValues.getAsLong(TaskContract.Instances.INSTANCE_ORIGINAL_TIME)),
                                        0L).value());
                        return (int) (new Backed<>(new NullSafe<>(newInstanceValues.getAsLong(TaskContract.Instances.INSTANCE_ORIGINAL_TIME)), 0L).value()
                                - existingInstances.getLong(startIdx));
                    });

            // sync the instances table with the new instances
+0 −51
Original line number Diff line number Diff line
/*
 * Copyright 2019 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.utils;

import java.util.Iterator;
import java.util.Locale;


/**
 * An {@link Iterable} decorator which returns the elements of the decorated {@link Iterable} in chunks of a specific size.
 *
 * @author Marten Gajda
 * @deprecated TODO: move to jems
 */
public final class Chunked<T> implements Iterable<Iterable<T>>
{
    private final int mChunkSize;
    private final Iterable<T> mDelegate;


    public Chunked(int chunkSize, Iterable<T> delegate)
    {
        if (chunkSize <= 0)
        {
            throw new IllegalArgumentException(String.format(Locale.ENGLISH, "Chunk size must be >0 but was %s", chunkSize));
        }
        mChunkSize = chunkSize;
        mDelegate = delegate;
    }


    @Override
    public Iterator<Iterable<T>> iterator()
    {
        return new ChunkedIterator<>(mChunkSize, mDelegate.iterator());
    }
}
Loading