refresh on any key change by default
This commit is contained in:
@@ -43,6 +43,10 @@ public class DatabaseNotifyManager {
|
|||||||
contentResolver.notifyChange(uri, null);
|
contentResolver.notifyChange(uri, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static Uri getNotifyUriAllKeys() {
|
||||||
|
return BASE_URI;
|
||||||
|
}
|
||||||
|
|
||||||
public static Uri getNotifyUriMasterKeyId(long masterKeyId) {
|
public static Uri getNotifyUriMasterKeyId(long masterKeyId) {
|
||||||
return BASE_URI.buildUpon().appendPath(Long.toString(masterKeyId)).build();
|
return BASE_URI.buildUpon().appendPath(Long.toString(masterKeyId)).build();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,9 +4,11 @@ package org.sufficientlysecure.keychain.ui.keyview;
|
|||||||
import android.arch.lifecycle.LiveData;
|
import android.arch.lifecycle.LiveData;
|
||||||
import android.arch.lifecycle.ViewModel;
|
import android.arch.lifecycle.ViewModel;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.net.Uri;
|
||||||
|
|
||||||
import org.sufficientlysecure.keychain.livedata.GenericLiveData;
|
import org.sufficientlysecure.keychain.livedata.GenericLiveData;
|
||||||
import org.sufficientlysecure.keychain.livedata.GenericLiveData.GenericDataLoader;
|
import org.sufficientlysecure.keychain.livedata.GenericLiveData.GenericDataLoader;
|
||||||
|
import org.sufficientlysecure.keychain.provider.DatabaseNotifyManager;
|
||||||
|
|
||||||
|
|
||||||
/** A simple generic ViewModel that can be used if exactly one field of data needs to be stored. */
|
/** A simple generic ViewModel that can be used if exactly one field of data needs to be stored. */
|
||||||
@@ -15,7 +17,7 @@ public class GenericViewModel extends ViewModel {
|
|||||||
|
|
||||||
public <T> LiveData<T> getGenericLiveData(Context context, GenericDataLoader<T> func) {
|
public <T> LiveData<T> getGenericLiveData(Context context, GenericDataLoader<T> func) {
|
||||||
if (genericLiveData == null) {
|
if (genericLiveData == null) {
|
||||||
genericLiveData = new GenericLiveData<>(context, null, func);
|
genericLiveData = new GenericLiveData<>(context, DatabaseNotifyManager.getNotifyUriAllKeys(), func);
|
||||||
}
|
}
|
||||||
// noinspection unchecked
|
// noinspection unchecked
|
||||||
return genericLiveData;
|
return genericLiveData;
|
||||||
|
|||||||
Reference in New Issue
Block a user