diff options
| author | nicolasroard <nicolasroard@google.com> | 2013-08-14 10:34:08 -0700 |
|---|---|---|
| committer | nicolasroard <nicolasroard@google.com> | 2013-08-14 10:34:20 -0700 |
| commit | 5af55f4f37c3d8fd471144f1175a45e2933ca015 (patch) | |
| tree | 501a9ee2a8fd1bcfd6ea17b61f6d97abb4489a89 /src/com/android/gallery3d | |
| parent | 99c1eeb3929c4faa15e3347a83ce9c4ae6551f0b (diff) | |
| download | android_packages_apps_Gallery2-5af55f4f37c3d8fd471144f1175a45e2933ca015.tar.gz android_packages_apps_Gallery2-5af55f4f37c3d8fd471144f1175a45e2933ca015.tar.bz2 android_packages_apps_Gallery2-5af55f4f37c3d8fd471144f1175a45e2933ca015.zip | |
Fix refresh of looks panel
Change-Id: Ib38b3aefc8ca9891251458b03587ffa5e41bfbe6
Diffstat (limited to 'src/com/android/gallery3d')
3 files changed, 17 insertions, 6 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index f386b1bf7..28fd80930 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -429,11 +429,13 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } public void removeLook(Action action) { - FilterUserPresetRepresentation rep = (FilterUserPresetRepresentation) action.getRepresentation(); + FilterUserPresetRepresentation rep = + (FilterUserPresetRepresentation) action.getRepresentation(); if (rep == null) { return; } mUserPresetsManager.delete(rep.getId()); + updateUserPresetsFromManager(); } private void fillEffects() { @@ -993,6 +995,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL public void loadUserPresets() { mUserPresetsManager.load(); + updateUserPresetsFromManager(); } public void updateUserPresetsFromManager() { @@ -1016,6 +1019,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL if (presets.size() > 0) { mCategoryLooksAdapter.add(new Action(this, Action.ADD_ACTION)); } + mCategoryLooksAdapter.notifyDataSetChanged(); mCategoryLooksAdapter.notifyDataSetInvalidated(); } @@ -1051,6 +1055,14 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL || mUserPresetsManager.getRepresentations().size() == 0) { mCategoryLooksAdapter.add(new Action(this, Action.ADD_ACTION)); } + + Fragment panel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG); + if (panel != null) { + if (panel instanceof MainPanel) { + MainPanel mainPanel = (MainPanel) panel; + mainPanel.loadCategoryLookPanel(true); + } + } } public void setDefaultPreset() { diff --git a/src/com/android/gallery3d/filtershow/category/CategoryPanel.java b/src/com/android/gallery3d/filtershow/category/CategoryPanel.java index 302f021d7..d1b7d1858 100644 --- a/src/com/android/gallery3d/filtershow/category/CategoryPanel.java +++ b/src/com/android/gallery3d/filtershow/category/CategoryPanel.java @@ -49,7 +49,7 @@ public class CategoryPanel extends Fragment implements View.OnClickListener { loadAdapter(mCurrentAdapter); } - private void loadAdapter(int adapter) { + public void loadAdapter(int adapter) { FilterShowActivity activity = (FilterShowActivity) getActivity(); switch (adapter) { case MainPanel.LOOKS: { diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java index 9eccad3ed..81e52c708 100644 --- a/src/com/android/gallery3d/filtershow/category/MainPanel.java +++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java @@ -146,9 +146,8 @@ public class MainPanel extends Fragment { transaction.commit(); } - public void loadCategoryLookPanel() { - if (mCurrentSelected == LOOKS) { - + public void loadCategoryLookPanel(boolean force) { + if (!force && mCurrentSelected == LOOKS) { return; } boolean fromRight = isRightAnimation(LOOKS); @@ -217,7 +216,7 @@ public class MainPanel extends Fragment { public void showPanel(int currentPanel) { switch (currentPanel) { case LOOKS: { - loadCategoryLookPanel(); + loadCategoryLookPanel(false); break; } case BORDERS: { |
