use of me.himanshusoni.quantumflux.model.generate.TableDetails in project QuantumFlux by himanshu-soni.
the class QuantumFluxSyncHelper method delete.
public static <T> void delete(Context context, ContentProviderClient provider, T dataModelObject) throws RemoteException {
TableDetails tableDetails = QuantumFlux.findTableDetails(dataModelObject.getClass());
Object columnValue = ModelInflater.deflateColumn(tableDetails, tableDetails.findPrimaryKeyColumn(), dataModelObject);
Uri itemUri = UriMatcherHelper.generateItemUriBuilder(tableDetails, String.valueOf(columnValue)).appendQueryParameter(QuantumFluxContentProvider.PARAMETER_SYNC, "false").build();
provider.delete(itemUri, null, null);
}
use of me.himanshusoni.quantumflux.model.generate.TableDetails in project QuantumFlux by himanshu-soni.
the class QuantumFluxContentProvider method notifyChanges.
private void notifyChanges(Uri uri, TableDetails tableDetails) {
Boolean sync = uri.getBooleanQueryParameter(PARAMETER_SYNC, true);
getContext().getContentResolver().notifyChange(uri, null, sync);
List<Class<?>> changeListeners = tableDetails.getChangeListeners();
if (!changeListeners.isEmpty()) {
for (int i = 0; i < changeListeners.size(); i++) {
Class<?> changeListener = changeListeners.get(i);
TableDetails changeListenerDetails = mDatabase.getTableDetailsCache().findTableDetails(getContext(), changeListener);
if (changeListenerDetails == null) {
continue;
}
//Change listeners are registered on views, so the entire view needs to be updated if changes to its data occurs
Uri changeUri = mUriMatcherHelper.generateItemUri(changeListenerDetails);
getContext().getContentResolver().notifyChange(changeUri, null, sync);
}
}
}
Aggregations