summaryrefslogtreecommitdiffstats
path: root/src/com/android/gallery3d/filtershow/category
diff options
context:
space:
mode:
Diffstat (limited to 'src/com/android/gallery3d/filtershow/category')
-rw-r--r--src/com/android/gallery3d/filtershow/category/Action.java7
-rw-r--r--src/com/android/gallery3d/filtershow/category/CategoryAdapter.java3
-rw-r--r--src/com/android/gallery3d/filtershow/category/CategoryTrack.java9
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);