Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/stefan-niedermann/nextcloud-deck.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--app/src/main/java/it/niedermann/nextcloud/deck/database/DataBaseAdapter.java4
-rw-r--r--reactive-livedata/build.gradle4
-rw-r--r--reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveData.java13
-rw-r--r--reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveDataBuilder.java7
-rw-r--r--reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/flatmap/FlatMapLiveData.java4
-rw-r--r--reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/map/MapLiveData.java8
6 files changed, 21 insertions, 19 deletions
diff --git a/app/src/main/java/it/niedermann/nextcloud/deck/database/DataBaseAdapter.java b/app/src/main/java/it/niedermann/nextcloud/deck/database/DataBaseAdapter.java
index e0b754866..5d3b28950 100644
--- a/app/src/main/java/it/niedermann/nextcloud/deck/database/DataBaseAdapter.java
+++ b/app/src/main/java/it/niedermann/nextcloud/deck/database/DataBaseAdapter.java
@@ -1622,7 +1622,7 @@ public class DataBaseAdapter {
executor.submit(() -> {
// Glide Module depends on correct account being set.
// TODO Use SingleSignOnURL where possible, allow passing ssoAccountName to MarkdownEditor
- SingleAccountHelper.setCurrentAccount(context, account.getName());
+ SingleAccountHelper.commitCurrentAccount(context, account.getName());
DeckLog.log("--- Write:", context.getString(R.string.shared_preference_last_account), "→", account.getId());
sharedPreferencesEditor.putLong(context.getString(R.string.shared_preference_last_account), account.getId());
@@ -1634,7 +1634,7 @@ public class DataBaseAdapter {
executor.submit(() -> {
// Glide Module depends on correct account being set.
// TODO Use SingleSignOnURL where possible, allow passing ssoAccountName to MarkdownEditor
- SingleAccountHelper.setCurrentAccount(context, null);
+ SingleAccountHelper.commitCurrentAccount(context, null);
DeckLog.log("--- Remove:", context.getString(R.string.shared_preference_last_account));
sharedPreferencesEditor.remove(context.getString(R.string.shared_preference_last_account));
diff --git a/reactive-livedata/build.gradle b/reactive-livedata/build.gradle
index 1d3c900ff..70d19dbf0 100644
--- a/reactive-livedata/build.gradle
+++ b/reactive-livedata/build.gradle
@@ -18,11 +18,11 @@ android {
dependencies {
coreLibraryDesugaring 'com.android.tools:desugar_jdk_libs:2.0.3'
- implementation "androidx.lifecycle:lifecycle-livedata:2.5.1"
+ implementation "androidx.lifecycle:lifecycle-livedata:2.6.1"
implementation 'androidx.core:core:1.10.1'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.10.3'
testImplementation 'androidx.test:core:1.5.0'
- testImplementation 'androidx.arch.core:core-testing:2.1.0'
+ testImplementation 'androidx.arch.core:core-testing:2.2.0'
}
diff --git a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveData.java b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveData.java
index 845e99e66..664004bba 100644
--- a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveData.java
+++ b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveData.java
@@ -27,6 +27,7 @@ import it.niedermann.android.reactivelivedata.merge.MergeLiveData;
import it.niedermann.android.reactivelivedata.take.TakeLiveData;
import it.niedermann.android.reactivelivedata.tap.TapLiveData;
import kotlin.Triple;
+import kotlin.jvm.functions.Function1;
/**
* @see ReactiveLiveDataBuilder
@@ -81,27 +82,27 @@ public class ReactiveLiveData<T> extends MediatorLiveData<T> implements Reactive
}
/**
- * @see Transformations#map(LiveData, Function)
+ * @see Transformations#map(LiveData, Function1)
*/
@NonNull
@Override
- public <Y> ReactiveLiveData<Y> map(@NonNull Function<T, Y> mapFunction) {
+ public <Y> ReactiveLiveData<Y> map(@NonNull Function1<T, Y> mapFunction) {
return new MapLiveData<>(this, mapFunction);
}
/**
- * @see #map(Function) but the mapFunction will be executed on the given executor
+ * @see #map(Function1) but the mapFunction will be executed on the given executor
*/
- public <Y> ReactiveLiveData<Y> map(@NonNull Function<T, Y> mapFunction, @NonNull ExecutorService executor) {
+ public <Y> ReactiveLiveData<Y> map(@NonNull Function1<T, Y> mapFunction, @NonNull ExecutorService executor) {
return new MapLiveData<>(this, mapFunction, executor);
}
/**
- * @see Transformations#switchMap(LiveData, Function)
+ * @see Transformations#switchMap(LiveData, Function1)
*/
@NonNull
@Override
- public <Y> ReactiveLiveData<Y> flatMap(@NonNull Function<T, LiveData<Y>> flatMapFunction) {
+ public <Y> ReactiveLiveData<Y> flatMap(@NonNull Function1<T, LiveData<Y>> flatMapFunction) {
return new FlatMapLiveData<>(this, flatMapFunction);
}
diff --git a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveDataBuilder.java b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveDataBuilder.java
index e5fcb319e..dc498a928 100644
--- a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveDataBuilder.java
+++ b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/ReactiveLiveDataBuilder.java
@@ -12,6 +12,7 @@ import java.time.temporal.ChronoUnit;
import java.util.concurrent.TimeUnit;
import kotlin.Triple;
+import kotlin.jvm.functions.Function1;
/**
* Partial implementation of <a href="https://reactivex.io/documentation/operators.html">ReactiveX</a> features
@@ -22,16 +23,16 @@ public interface ReactiveLiveDataBuilder<T> {
* @see <a href="https://reactivex.io/documentation/operators/map.html">ReactiveX#map</a>
*/
@NonNull
- <Y> ReactiveLiveDataBuilder<Y> map(@NonNull Function<T, Y> mapFunction);
+ <Y> ReactiveLiveDataBuilder<Y> map(@NonNull Function1<T, Y> mapFunction);
/**
* @see <a href="https://reactivex.io/documentation/operators/flatmap.html">ReactiveX#flatmap</a>
*/
@NonNull
- <Y> ReactiveLiveDataBuilder<Y> flatMap(@NonNull Function<T, LiveData<Y>> flatMapFunction);
+ <Y> ReactiveLiveDataBuilder<Y> flatMap(@NonNull Function1<T, LiveData<Y>> flatMapFunction);
/**
- * @see #flatMap(Function)
+ * @see #flatMap(Function1)
*/
@NonNull
<Y> ReactiveLiveDataBuilder<Y> flatMap(@NonNull Supplier<LiveData<Y>> flatMapSupplier);
diff --git a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/flatmap/FlatMapLiveData.java b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/flatmap/FlatMapLiveData.java
index 5212ea7fa..13593cb79 100644
--- a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/flatmap/FlatMapLiveData.java
+++ b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/flatmap/FlatMapLiveData.java
@@ -1,12 +1,12 @@
package it.niedermann.android.reactivelivedata.flatmap;
import androidx.annotation.NonNull;
-import androidx.arch.core.util.Function;
import androidx.core.util.Supplier;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Transformations;
import it.niedermann.android.reactivelivedata.ReactiveLiveData;
+import kotlin.jvm.functions.Function1;
public class FlatMapLiveData<T, Y> extends ReactiveLiveData<Y> {
@@ -14,7 +14,7 @@ public class FlatMapLiveData<T, Y> extends ReactiveLiveData<Y> {
this(source, val -> switchMapSupplier.get());
}
- public FlatMapLiveData(@NonNull LiveData<T> source, @NonNull Function<T, LiveData<Y>> flatMapFunction) {
+ public FlatMapLiveData(@NonNull LiveData<T> source, @NonNull Function1<T, LiveData<Y>> flatMapFunction) {
super(Transformations.switchMap(source, flatMapFunction));
}
}
diff --git a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/map/MapLiveData.java b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/map/MapLiveData.java
index eaeb2b435..a705b427b 100644
--- a/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/map/MapLiveData.java
+++ b/reactive-livedata/src/main/java/it/niedermann/android/reactivelivedata/map/MapLiveData.java
@@ -1,21 +1,21 @@
package it.niedermann.android.reactivelivedata.map;
import androidx.annotation.NonNull;
-import androidx.arch.core.util.Function;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Transformations;
import java.util.concurrent.ExecutorService;
import it.niedermann.android.reactivelivedata.ReactiveLiveData;
+import kotlin.jvm.functions.Function1;
public class MapLiveData<T, Y> extends ReactiveLiveData<Y> {
- public MapLiveData(@NonNull LiveData<T> source, @NonNull Function<T, Y> mapFunction) {
+ public MapLiveData(@NonNull LiveData<T> source, @NonNull Function1<T, Y> mapFunction) {
super(Transformations.map(source, mapFunction));
}
- public MapLiveData(@NonNull LiveData<T> source, @NonNull Function<T, Y> mapFunction, @NonNull ExecutorService executor) {
- addSource(source, val -> executor.submit(() -> postValue(mapFunction.apply(val))));
+ public MapLiveData(@NonNull LiveData<T> source, @NonNull Function1<T, Y> mapFunction, @NonNull ExecutorService executor) {
+ addSource(source, val -> executor.submit(() -> postValue(mapFunction.invoke(val))));
}
}