Java Code Examples for com.raizlabs.android.dbflow.structure.BaseModel#Action

The following examples show how to use com.raizlabs.android.dbflow.structure.BaseModel#Action . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: NotifyDistributor.java    From Meteorite with Apache License 2.0 5 votes vote down vote up
@Override
public <TModel> void notifyModelChanged(@NonNull TModel model,
                                        @NonNull ModelAdapter<TModel> adapter,
                                        @NonNull BaseModel.Action action) {
    FlowManager.getModelNotifierForTable(adapter.getModelClass())
        .notifyModelChanged(model, adapter, action);
}
 
Example 2
Source File: DirectModelNotifier.java    From Meteorite with Apache License 2.0 5 votes vote down vote up
@Override
public <T> void notifyModelChanged(@NonNull T model, @NonNull ModelAdapter<T> adapter,
                                   @NonNull BaseModel.Action action) {
    final Set<OnModelStateChangedListener> listeners = modelChangedListenerMap.get(adapter.getModelClass());
    if (listeners != null) {
        for (OnModelStateChangedListener listener : listeners) {
            if (listener != null) {
                listener.onModelChanged(model, action);
            }
        }
    }
}
 
Example 3
Source File: DirectModelNotifier.java    From Meteorite with Apache License 2.0 5 votes vote down vote up
@Override
public <T> void notifyTableChanged(@NonNull Class<T> table, @NonNull BaseModel.Action action) {
    final Set<OnTableChangedListener> listeners = tableChangedListenerMap.get(table);
    if (listeners != null) {
        for (OnTableChangedListener listener : listeners) {
            if (listener != null) {
                listener.onTableChanged(table, action);
            }
        }
    }
}
 
Example 4
Source File: ContentResolverNotifier.java    From Meteorite with Apache License 2.0 5 votes vote down vote up
@Override
public <T> void notifyModelChanged(@NonNull T model, @NonNull ModelAdapter<T> adapter,
                                   @NonNull BaseModel.Action action) {
    if (FlowContentObserver.shouldNotify()) {
        FlowManager.getContext().getContentResolver()
            .notifyChange(SqlUtils.getNotificationUri(adapter.getModelClass(), action,
                adapter.getPrimaryConditionClause(model).getConditions()), null, true);
    }
}
 
Example 5
Source File: ModelChangeObserver.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public void onModelStateChanged(Class<? extends Model> aClass, BaseModel.Action action) {
    Log.d(TAG, "onModelStateChanged() " + aClass.getSimpleName() + ": " + action);

    if (notifyLoader(action)) {
        mLoader.onContentChanged();
    }
}
 
Example 6
Source File: ModelChangeObserver.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private boolean notifyLoader(BaseModel.Action action) {
    if (mTrackedTable.getActions().isEmpty()) {
        return true;
    }

    for (BaseModel.Action modelAction : mTrackedTable.getActions()) {
        if (modelAction.equals(action)) {
            return true;
        }
    }

    return false;
}
 
Example 7
Source File: Set.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public BaseModel.Action getPrimaryAction() {
    return BaseModel.Action.UPDATE;
}
 
Example 8
Source File: ModelNotifier.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
<T> void notifyModelChanged(@NonNull T model, @NonNull ModelAdapter<T> adapter,
@NonNull BaseModel.Action action);
 
Example 9
Source File: DbOperation.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public BaseModel.Action getAction() {
    return mAction;
}
 
Example 10
Source File: BaseQueriable.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@NonNull
public abstract BaseModel.Action getPrimaryAction();
 
Example 11
Source File: Where.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public BaseModel.Action getPrimaryAction() {
    return whereBase.getPrimaryAction();
}
 
Example 12
Source File: IndexedBy.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public BaseModel.Action getPrimaryAction() {
    return whereBase.getPrimaryAction();
}
 
Example 13
Source File: DbLoader.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public TrackedTable(Class<? extends Model> trackedModel,
                    BaseModel.Action action) {
    this(trackedModel, Arrays.asList(action));
}
 
Example 14
Source File: StringQuery.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@NonNull
@Override
public BaseModel.Action getPrimaryAction() {
    return BaseModel.Action.CHANGE; // we don't explicitly know the change, but something changed.
}
 
Example 15
Source File: Queriable.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@NonNull
BaseModel.Action getPrimaryAction();
 
Example 16
Source File: DirectModelNotifier.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
@Override
public void onTableChanged(@Nullable Class<?> table, @NonNull BaseModel.Action action) {
    if (modelChangedListener != null) {
        modelChangedListener.onTableChanged(table, action);
    }
}
 
Example 17
Source File: NotifyDistributor.java    From Meteorite with Apache License 2.0 4 votes vote down vote up
/**
 * Notifies listeners of table-level changes from the SQLite-wrapper language.
 */
@Override
public <TModel> void notifyTableChanged(@NonNull Class<TModel> table,
                                        @NonNull BaseModel.Action action) {
    FlowManager.getModelNotifierForTable(table).notifyTableChanged(table, action);
}
 
Example 18
Source File: DbLoader.java    From dhis2-android-dashboard with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
public List<BaseModel.Action> getActions() {
    return mActions;
}
 
Example 19
Source File: OnTableChangedListener.java    From Meteorite with Apache License 2.0 2 votes vote down vote up
/**
 * Called when table changes.
 *
 * @param tableChanged The table that has changed. NULL unless version of app is {@link Build.VERSION_CODES#JELLY_BEAN}
 *                     or higher.
 * @param action       The action that occurred.
 */
void onTableChanged(@Nullable Class<?> tableChanged, @NonNull BaseModel.Action action);
 
Example 20
Source File: DirectModelNotifier.java    From Meteorite with Apache License 2.0 votes vote down vote up
void onModelChanged(@NonNull T model, @NonNull BaseModel.Action action);