Search in sources :

Example 1 with HistoryItem

use of com.android.gallery3d.filtershow.history.HistoryItem in project android_packages_apps_Gallery2 by LineageOS.

the class MasterImage method setPreset.

public synchronized void setPreset(ImagePreset preset, FilterRepresentation change, boolean addToHistory, boolean updateCategory) {
    if (DEBUG) {
        preset.showFilters();
    }
    mPreset = preset;
    mPreset.fillImageStateAdapter(mState);
    if (addToHistory) {
        HistoryItem historyItem = new HistoryItem(mPreset, change);
        mHistory.addHistoryItem(historyItem);
    }
    updatePresets(true);
    resetGeometryImages(false);
    if (updateCategory) {
        mActivity.updateCategories();
    }
}
Also used : HistoryItem(com.android.gallery3d.filtershow.history.HistoryItem)

Example 2 with HistoryItem

use of com.android.gallery3d.filtershow.history.HistoryItem in project android_packages_apps_Gallery2 by LineageOS.

the class FilterShowActivity method resetHistory.

void resetHistory() {
    if (mMasterImage == null) {
        return;
    }
    HistoryManager adapter = mMasterImage.getHistory();
    adapter.reset();
    HistoryItem historyItem = adapter.getItem(0);
    ImagePreset original = null;
    original = new ImagePreset();
    FilterRepresentation rep = null;
    if (historyItem != null) {
        rep = historyItem.getFilterRepresentation();
    }
    mMasterImage.setPreset(original, rep, true);
    mMasterImage.setFusionUnderlay(null);
    mMasterImage.resetTranslation();
    mMasterImage.setScaleFactor(1);
    mMasterImage.setCurrentFilterRepresentation(null);
    ArrayList<FilterRepresentation> frList = FiltersManager.getManager().getTools();
    for (FilterRepresentation fr : frList) {
        if (fr instanceof FilterRotateRepresentation) {
            ((FilterRotateRepresentation) fr).resetRotation();
        }
    }
    showDefaultImageView();
    showSaveButtonIfNeed();
    invalidateViews();
}
Also used : HistoryManager(com.android.gallery3d.filtershow.history.HistoryManager) HistoryItem(com.android.gallery3d.filtershow.history.HistoryItem) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset) FilterRepresentation(com.android.gallery3d.filtershow.filters.FilterRepresentation) FilterRotateRepresentation(com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)

Example 3 with HistoryItem

use of com.android.gallery3d.filtershow.history.HistoryItem in project android_packages_apps_Gallery2 by LineageOS.

the class MasterImage method onHistoryItemClick.

public void onHistoryItemClick(int position, boolean updateCategory) {
    HistoryItem historyItem = mHistory.getItem(position);
    // We need a copy from the history
    if (historyItem == null) {
        return;
    }
    ImagePreset newPreset = new ImagePreset(historyItem.getImagePreset());
    // don't need to add it to the history
    setPreset(newPreset, historyItem.getFilterRepresentation(), false, updateCategory);
    mHistory.setCurrentPreset(position);
}
Also used : HistoryItem(com.android.gallery3d.filtershow.history.HistoryItem) ImagePreset(com.android.gallery3d.filtershow.pipeline.ImagePreset)

Aggregations

HistoryItem (com.android.gallery3d.filtershow.history.HistoryItem)3 ImagePreset (com.android.gallery3d.filtershow.pipeline.ImagePreset)2 FilterRepresentation (com.android.gallery3d.filtershow.filters.FilterRepresentation)1 FilterRotateRepresentation (com.android.gallery3d.filtershow.filters.FilterRotateRepresentation)1 HistoryManager (com.android.gallery3d.filtershow.history.HistoryManager)1