diff options
author | nicolasroard <nicolasroard@google.com> | 2013-07-15 11:24:36 -0700 |
---|---|---|
committer | nicolasroard <nicolasroard@google.com> | 2013-07-30 11:28:59 -0700 |
commit | 13ae2608e04998f0d13bc3f58cda5237bdde0b7d (patch) | |
tree | a1bbb351775e1dfe26e8feb60aae123e3b84e51a /src/com/android/gallery3d/filtershow/category | |
parent | 7d1433ac9191fa7b7c79a0187d4d0f30c16f84d9 (diff) | |
download | android_packages_apps_Snap-13ae2608e04998f0d13bc3f58cda5237bdde0b7d.tar.gz android_packages_apps_Snap-13ae2608e04998f0d13bc3f58cda5237bdde0b7d.tar.bz2 android_packages_apps_Snap-13ae2608e04998f0d13bc3f58cda5237bdde0b7d.zip |
Add user presets saving/loading
Change-Id: I85c5dd0df1e9264a01c8d7a6d44602e87799890c
Diffstat (limited to 'src/com/android/gallery3d/filtershow/category')
3 files changed, 15 insertions, 4 deletions
diff --git a/src/com/android/gallery3d/filtershow/category/Action.java b/src/com/android/gallery3d/filtershow/category/Action.java index de282cc28..332ca18b0 100644 --- a/src/com/android/gallery3d/filtershow/category/Action.java +++ b/src/com/android/gallery3d/filtershow/category/Action.java @@ -24,6 +24,9 @@ import android.graphics.Matrix; import android.graphics.Paint; import android.graphics.Rect; import android.graphics.RectF; +import android.widget.ArrayAdapter; +import android.widget.ListAdapter; +import com.android.gallery3d.filtershow.filters.FilterUserPresetRepresentation; import com.android.gallery3d.filtershow.pipeline.RenderingRequest; import com.android.gallery3d.filtershow.pipeline.RenderingRequestCaller; import com.android.gallery3d.filtershow.filters.FilterRepresentation; @@ -37,7 +40,7 @@ public class Action implements RenderingRequestCaller { private String mName; private Rect mImageFrame; private Bitmap mImage; - private CategoryAdapter mAdapter; + private ArrayAdapter mAdapter; public static final int FULL_VIEW = 0; public static final int CROP_VIEW = 1; private int mType = CROP_VIEW; @@ -100,7 +103,7 @@ public class Action implements RenderingRequestCaller { mImage = image; } - public void setAdapter(CategoryAdapter adapter) { + public void setAdapter(ArrayAdapter adapter) { mAdapter = adapter; } diff --git a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java index 445ef5f6a..6451c39df 100644 --- a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java +++ b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java @@ -149,6 +149,9 @@ public class CategoryAdapter extends ArrayAdapter<Action> { } public void reflectImagePreset(ImagePreset preset) { + if (preset == null) { + return; + } int selected = 0; // if nothing found, select "none" (first element) FilterRepresentation rep = null; if (mCategory == MainPanel.LOOKS) { diff --git a/src/com/android/gallery3d/filtershow/category/CategoryTrack.java b/src/com/android/gallery3d/filtershow/category/CategoryTrack.java index f55431293..ac8245a3b 100644 --- a/src/com/android/gallery3d/filtershow/category/CategoryTrack.java +++ b/src/com/android/gallery3d/filtershow/category/CategoryTrack.java @@ -35,6 +35,11 @@ public class CategoryTrack extends LinearLayout { super.onChanged(); invalidate(); } + @Override + public void onInvalidated() { + super.onInvalidated(); + fillContent(); + } }; public CategoryTrack(Context context, AttributeSet attrs) { @@ -45,14 +50,14 @@ public class CategoryTrack extends LinearLayout { public void setAdapter(CategoryAdapter adapter) { mAdapter = adapter; - mAdapter.setItemWidth(mElemSize); - mAdapter.setItemHeight(LayoutParams.MATCH_PARENT); mAdapter.registerDataSetObserver(mDataSetObserver); fillContent(); } public void fillContent() { removeAllViews(); + mAdapter.setItemWidth(mElemSize); + mAdapter.setItemHeight(LayoutParams.MATCH_PARENT); int n = mAdapter.getCount(); for (int i = 0; i < n; i++) { View view = mAdapter.getView(i, null, this); |