summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorLinux Build Service Account <lnxbuild@localhost>2016-05-02 22:45:08 -0700
committerGerrit - the friendly Code Review server <code-review@localhost>2016-05-02 22:45:08 -0700
commitb04211110dce21e7c898352313f0416f6e2ac9d9 (patch)
tree5ae9892dad266bd0894ac5d1e82ecbe04d929929 /src/com
parentb687aaed3facd2bb67376f7eb30979a10da77d64 (diff)
parent80516cafe6b434a61ad0b115e84fe8e536148701 (diff)
downloadandroid_packages_apps_Gallery2-b04211110dce21e7c898352313f0416f6e2ac9d9.tar.gz
android_packages_apps_Gallery2-b04211110dce21e7c898352313f0416f6e2ac9d9.tar.bz2
android_packages_apps_Gallery2-b04211110dce21e7c898352313f0416f6e2ac9d9.zip
Merge "Gallery2: Show seekbar under category panel according to UI design." into android_ui.lnx.1.2-dev
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/gallery3d/filtershow/FilterShowActivity.java55
-rw-r--r--src/com/android/gallery3d/filtershow/category/BottomPanel.java60
-rw-r--r--src/com/android/gallery3d/filtershow/category/CategoryAdapter.java3
-rw-r--r--src/com/android/gallery3d/filtershow/category/EditorCropPanel.java4
-rw-r--r--src/com/android/gallery3d/filtershow/category/MainPanel.java79
-rw-r--r--src/com/android/gallery3d/filtershow/category/StraightenPanel.java4
-rw-r--r--src/com/android/gallery3d/filtershow/controller/BasicSlider.java6
-rw-r--r--src/com/android/gallery3d/filtershow/editors/Editor.java6
-rw-r--r--src/com/android/gallery3d/filtershow/editors/EditorPanel.java7
9 files changed, 182 insertions, 42 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
index 102aaaa6d..592c756a4 100644
--- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java
+++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java
@@ -83,13 +83,13 @@ import com.android.gallery3d.data.LocalAlbum;
import com.android.gallery3d.filtershow.cache.ImageLoader;
import com.android.gallery3d.filtershow.category.Action;
import com.android.gallery3d.filtershow.category.CategoryAdapter;
-import com.android.gallery3d.filtershow.category.CategorySelected;
import com.android.gallery3d.filtershow.category.CategoryView;
import com.android.gallery3d.filtershow.category.EditorCropPanel;
import com.android.gallery3d.filtershow.category.MainPanel;
import com.android.gallery3d.filtershow.category.StraightenPanel;
import com.android.gallery3d.filtershow.category.SwipableView;
import com.android.gallery3d.filtershow.data.UserPresetsManager;
+import com.android.gallery3d.filtershow.editors.BasicEditor;
import com.android.gallery3d.filtershow.editors.Editor;
import com.android.gallery3d.filtershow.editors.EditorCrop;
import com.android.gallery3d.filtershow.editors.EditorDualCamFusion;
@@ -144,7 +144,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
private ImageShow mImageShow = null;
private View mSaveButton = null;
- private View mExitButton = null, mCancelButton = null;
private EditorPlaceHolder mEditorPlaceHolder = new EditorPlaceHolder(this);
private Editor mCurrentEditor = null;
@@ -209,7 +208,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
private ImageButton imgComparison;
private String mPopUpText, mCancel;
RelativeLayout rlImageContainer;
- boolean isOrientationChanged;
private boolean isComingFromEditorScreen;
private AlertDialog.Builder mBackAlertDialogBuilder;
@@ -377,10 +375,11 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
EditorPanel panel = new EditorPanel();
panel.setEditor(currentId);
setActionBarForEffects(currentEditor);
- FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
- transaction.remove(getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG));
- transaction.replace(R.id.main_panel_container, panel, MainPanel.FRAGMENT_TAG);
- transaction.commit();
+ Fragment main =
+ getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
+ if (main instanceof MainPanel) {
+ ((MainPanel) main).setEditorPanelFragment(panel);
+ }
}
};
Fragment main = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
@@ -403,6 +402,21 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
}
+ public void leaveSeekBarPanel() {
+ removeSeekBarPanel();
+ showDefaultImageView();
+ setActionBar();
+ showActionBar(true);
+ }
+
+ private void removeSeekBarPanel() {
+ Fragment currentPanel =
+ getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
+ if (currentPanel instanceof MainPanel) {
+ ((MainPanel) currentPanel).removeEditorPanelFragment();
+ }
+ }
+
public void toggleInformationPanel() {
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.setCustomAnimations(R.anim.slide_in_right, R.anim.slide_out_left);
@@ -477,10 +491,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
public void setActionBar() {
- setActionBar(false);
- }
-
- public void setActionBar(boolean isEffectClicked) {
ActionBar actionBar = getActionBar();
actionBar.setShowHideAnimationEnabled(false);
actionBar.setDisplayOptions(ActionBar.DISPLAY_SHOW_CUSTOM);
@@ -502,8 +512,8 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
showSaveButtonIfNeed();
- mExitButton = actionBar.getCustomView().findViewById(R.id.filtershow_exit);
- mExitButton.setOnClickListener(new OnClickListener() {
+ View exitButton = actionBar.getCustomView().findViewById(R.id.filtershow_exit);
+ exitButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
if (mImageShow.hasModifications()) {
@@ -967,6 +977,18 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
return;
}
+ Fragment currentPanel =
+ getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
+ if (currentPanel instanceof MainPanel && ((MainPanel) currentPanel).hasEditorPanel()) {
+ if (representation.equals(MasterImage.getImage().getCurrentFilterRepresentation())) {
+ return;
+ }
+ // cancel previous filter.
+ cancelCurrentFilter();
+ showDefaultImageView();
+ removeSeekBarPanel();
+ }
+
if (representation.getFilterType() == FilterRepresentation.TYPE_DUALCAM &&
MasterImage.getImage().getDepthMapLoadingStatus() == DdmStatus.DDM_FAILED) {
Toast.makeText(this, getString(R.string.dualcam_filter_not_supported), Toast.LENGTH_SHORT).show();
@@ -989,7 +1011,9 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
FilterRepresentation filterRepresentation = representation.copy();
MasterImage.getImage().setPreset(copy, filterRepresentation, true);
MasterImage.getImage().setCurrentFilterRepresentation(null);
- showSaveButtonIfNeed();
+
+ setActionBar();
+ showActionBar(true);
return;
}
}
@@ -1027,6 +1051,8 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
ImagePreset preset = mMasterImage.getPreset();
mCategoryLooksAdapter.reflectImagePreset(preset);
mCategoryBordersAdapter.reflectImagePreset(preset);
+ mCategoryFiltersAdapter.reflectImagePreset(preset);
+ mCategoryMakeupAdapter.reflectImagePreset(preset);
mCategoryDualCamAdapter.reflectImagePreset(preset);
}
@@ -1718,6 +1744,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL
}
public void backToMain() {
+ removeSeekBarPanel();
showActionBar(true);
Fragment currentPanel = getSupportFragmentManager().findFragmentByTag(MainPanel.FRAGMENT_TAG);
if (currentPanel instanceof MainPanel) {
diff --git a/src/com/android/gallery3d/filtershow/category/BottomPanel.java b/src/com/android/gallery3d/filtershow/category/BottomPanel.java
new file mode 100644
index 000000000..cd4f65775
--- /dev/null
+++ b/src/com/android/gallery3d/filtershow/category/BottomPanel.java
@@ -0,0 +1,60 @@
+/*
+ * Copyright (c) 2016, The Linux Foundation. All rights reserved.
+
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions are
+ * met:
+ * * Redistributions of source code must retain the above copyright
+ * notice, this list of conditions and the following disclaimer.
+ * * Redistributions in binary form must reproduce the above
+ * copyright notice, this list of conditions and the following
+ * disclaimer in the documentation and/or other materials provided
+ * with the distribution.
+ * * Neither the name of The Linux Foundation nor the names of its
+ * contributors may be used to endorse or promote products derived
+ * from this software without specific prior written permission.
+
+ * THIS SOFTWARE IS PROVIDED "AS IS" AND ANY EXPRESS OR IMPLIED
+ * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+ * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT
+ * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS
+ * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
+ * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
+ * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+ * BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+ * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE
+ * OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
+ * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ */
+
+package com.android.gallery3d.filtershow.category;
+
+import android.os.Bundle;
+import android.support.v4.app.Fragment;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+
+public class BottomPanel extends Fragment {
+ public static final String FRAGMENT_TAG = "BottomPanel";
+
+ private BottomPanelDelegate mPanelDelegate;
+ private View mBottomView;
+
+ interface BottomPanelDelegate {
+ View getBottomPanelView(LayoutInflater inflater);
+ }
+
+ @Override
+ public View onCreateView(LayoutInflater inflater, ViewGroup container,
+ Bundle savedInstanceState) {
+ if (mBottomView == null && mPanelDelegate != null) {
+ mBottomView = mPanelDelegate.getBottomPanelView(inflater);
+ }
+ return mBottomView;
+ }
+
+ public void setBottomPanelDelegate(BottomPanelDelegate panelDelegate) {
+ mPanelDelegate = panelDelegate;
+ }
+}
diff --git a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
index d5fafee14..7ef3c0bb2 100644
--- a/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
+++ b/src/com/android/gallery3d/filtershow/category/CategoryAdapter.java
@@ -31,6 +31,7 @@ import com.android.gallery3d.filtershow.pipeline.ImagePreset;
public class CategoryAdapter extends ArrayAdapter<Action> {
private static final String LOGTAG = "CategoryAdapter";
+ private static final int UNKNOWN_INDEX = -1;
private int mItemHeight;
private View mContainer;
private int mItemWidth = ListView.LayoutParams.MATCH_PARENT;
@@ -234,6 +235,8 @@ public class CategoryAdapter extends ArrayAdapter<Action> {
if (pos != -1) {
rep = preset.getFilterRepresentation(pos);
}
+ } else if (mCategory == MainPanel.FILTERS || mCategory == MainPanel.MAKEUP) {
+ selected = UNKNOWN_INDEX;
}
if (rep != null) {
for (int i = 0; i < getCount(); i++) {
diff --git a/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java b/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java
index d98f79d03..55d52fff3 100644
--- a/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/EditorCropPanel.java
@@ -100,7 +100,7 @@ public class EditorCropPanel extends BasicGeometryPanel {
public void onClick(View v) {
mEditorCrop.finalApplyCalled();
activity.backToMain();
- activity.setActionBar(false);
+ activity.setActionBar();
}
});
mExitButton.setOnClickListener(new View.OnClickListener() {
@@ -108,7 +108,7 @@ public class EditorCropPanel extends BasicGeometryPanel {
public void onClick(View v) {
activity.cancelCurrentFilter();
activity.backToMain();
- activity.setActionBar(false);
+ activity.setActionBar();
}
});
}
diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java
index c68f83cbd..f2c3b099b 100644
--- a/src/com/android/gallery3d/filtershow/category/MainPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java
@@ -27,6 +27,7 @@ import android.widget.LinearLayout;
import com.android.gallery3d.R;
import com.android.gallery3d.filtershow.FilterShowActivity;
+import com.android.gallery3d.filtershow.editors.EditorPanel;
import com.android.gallery3d.filtershow.filters.HazeBusterActs;
import com.android.gallery3d.filtershow.filters.SeeStraightActs;
import com.android.gallery3d.filtershow.filters.SimpleMakeupImageFilter;
@@ -35,11 +36,12 @@ import com.android.gallery3d.filtershow.imageshow.MasterImage;
import com.android.gallery3d.filtershow.state.StatePanel;
import com.android.gallery3d.filtershow.tools.DualCameraNativeEngine.DdmStatus;
-public class MainPanel extends Fragment {
+public class MainPanel extends Fragment implements BottomPanel.BottomPanelDelegate {
private static final String LOGTAG = "MainPanel";
private LinearLayout mMainView;
+ private View mBottomPanelView;
private ImageButton looksButton;
private ImageButton bordersButton;
private ImageButton geometryButton;
@@ -124,17 +126,40 @@ public class MainPanel extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
-
mMainView = (LinearLayout) inflater.inflate(
R.layout.filtershow_main_panel, null, false);
- looksButton = (ImageButton) mMainView.findViewById(R.id.fxButton);
- bordersButton = (ImageButton) mMainView.findViewById(R.id.borderButton);
- geometryButton = (ImageButton) mMainView.findViewById(R.id.geometryButton);
- filtersButton = (ImageButton) mMainView.findViewById(R.id.colorsButton);
- dualCamButton = (ImageButton) mMainView.findViewById(R.id.dualCamButton);
+ getBottomPanelView(inflater);
+ initBottomPanel();
+
+ updateDualCameraButton();
+ FilterShowActivity activity = (FilterShowActivity) getActivity();
+ showPanel(activity.getCurrentPanel());
+ return mMainView;
+ }
+
+ private void initBottomPanel() {
+ BottomPanel panel = new BottomPanel();
+ panel.setBottomPanelDelegate(this);
+ setActionFragment(panel, BottomPanel.FRAGMENT_TAG);
+ }
+
+ @Override
+ public View getBottomPanelView(LayoutInflater inflater) {
+ if (mBottomPanelView != null) {
+ return mBottomPanelView;
+ }
+
+ LinearLayout bottomPanel = (LinearLayout) inflater.inflate(
+ R.layout.filtershow_bottom_panel, null, false);
+
+ looksButton = (ImageButton) bottomPanel.findViewById(R.id.fxButton);
+ bordersButton = (ImageButton) bottomPanel.findViewById(R.id.borderButton);
+ geometryButton = (ImageButton) bottomPanel.findViewById(R.id.geometryButton);
+ filtersButton = (ImageButton) bottomPanel.findViewById(R.id.colorsButton);
+ dualCamButton = (ImageButton) bottomPanel.findViewById(R.id.dualCamButton);
if (SimpleMakeupImageFilter.HAS_TS_MAKEUP) {
- makeupButton = (ImageButton) mMainView.findViewById(R.id.makeupButton);
+ makeupButton = (ImageButton) bottomPanel.findViewById(R.id.makeupButton);
makeupButton.setVisibility(View.VISIBLE);
}
@@ -146,18 +171,18 @@ public class MainPanel extends Fragment {
}
});
}
- trueScannerButton = (ImageButton) mMainView.findViewById(R.id.trueScannerButton);
+ trueScannerButton = (ImageButton) bottomPanel.findViewById(R.id.trueScannerButton);
if (!TrueScannerActs.isTrueScannerEnabled()) {
trueScannerButton.setVisibility(View.GONE);
}
- hazeBusterButton = (ImageButton) mMainView.findViewById(R.id.hazeBusterButton);
- if(!HazeBusterActs.isHazeBusterEnabled()) {
+ hazeBusterButton = (ImageButton) bottomPanel.findViewById(R.id.hazeBusterButton);
+ if (!HazeBusterActs.isHazeBusterEnabled()) {
hazeBusterButton.setVisibility(View.GONE);
}
- seeStraightButton = (ImageButton) mMainView.findViewById(R.id.seeStraightButton);
- if(!SeeStraightActs.isSeeStraightEnabled()) {
+ seeStraightButton = (ImageButton) bottomPanel.findViewById(R.id.seeStraightButton);
+ if (!SeeStraightActs.isSeeStraightEnabled()) {
seeStraightButton.setVisibility(View.GONE);
}
@@ -192,8 +217,6 @@ public class MainPanel extends Fragment {
}
});
- updateDualCameraButton();
-
trueScannerButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
@@ -215,10 +238,8 @@ public class MainPanel extends Fragment {
}
});
- FilterShowActivity activity = (FilterShowActivity) getActivity();
-// showImageStatePanel(activity.isShowingImageStatePanel());
- showPanel(activity.getCurrentPanel());
- return mMainView;
+ mBottomPanelView = bottomPanel;
+ return bottomPanel;
}
private boolean isRightAnimation(int newPos) {
@@ -228,6 +249,26 @@ public class MainPanel extends Fragment {
return true;
}
+ private void setActionFragment(Fragment actionFragment, String tag) {
+ FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
+ transaction.replace(R.id.bottom_panel_container, actionFragment, tag);
+ transaction.commitAllowingStateLoss();
+ }
+
+ public boolean hasEditorPanel() {
+ Fragment fragment = getChildFragmentManager().findFragmentByTag(EditorPanel.FRAGMENT_TAG);
+ return (fragment != null);
+ }
+
+ public void setEditorPanelFragment(Fragment editorFragment) {
+ setActionFragment(editorFragment, EditorPanel.FRAGMENT_TAG);
+ }
+
+ public void removeEditorPanelFragment() {
+ // use bottom panel replace editor panel.
+ initBottomPanel();
+ }
+
private void setCategoryFragment(Fragment category, boolean fromRight) {
FragmentTransaction transaction = getChildFragmentManager().beginTransaction();
FilterShowActivity activity = (FilterShowActivity) getActivity();
diff --git a/src/com/android/gallery3d/filtershow/category/StraightenPanel.java b/src/com/android/gallery3d/filtershow/category/StraightenPanel.java
index c3be2c956..c16bbe394 100644
--- a/src/com/android/gallery3d/filtershow/category/StraightenPanel.java
+++ b/src/com/android/gallery3d/filtershow/category/StraightenPanel.java
@@ -61,7 +61,7 @@ public class StraightenPanel extends BasicGeometryPanel {
public void onClick(View v) {
activity.cancelCurrentFilter();
activity.backToMain();
- activity.setActionBar(false);
+ activity.setActionBar();
}
});
mApplyButton.setOnClickListener(new View.OnClickListener() {
@@ -69,7 +69,7 @@ public class StraightenPanel extends BasicGeometryPanel {
public void onClick(View v) {
mEditorStraighten.finalApplyCalled();
activity.backToMain();
- activity.setActionBar(false);
+ activity.setActionBar();
}
});
}
diff --git a/src/com/android/gallery3d/filtershow/controller/BasicSlider.java b/src/com/android/gallery3d/filtershow/controller/BasicSlider.java
index 10ac65985..53be81ba4 100644
--- a/src/com/android/gallery3d/filtershow/controller/BasicSlider.java
+++ b/src/com/android/gallery3d/filtershow/controller/BasicSlider.java
@@ -52,8 +52,7 @@ public class BasicSlider implements Control {
public void onClick(View v) {
FilterShowActivity activity = (FilterShowActivity) context;
mEditor.finalApplyCalled();
- activity.backToMain();
- activity.setActionBar();
+ activity.leaveSeekBarPanel();
}
});
}
@@ -64,8 +63,7 @@ public class BasicSlider implements Control {
public void onClick(View v) {
FilterShowActivity activity = (FilterShowActivity) context;
activity.cancelCurrentFilter();
- activity.backToMain();
- activity.setActionBar();
+ activity.leaveSeekBarPanel();
}
});
}
diff --git a/src/com/android/gallery3d/filtershow/editors/Editor.java b/src/com/android/gallery3d/filtershow/editors/Editor.java
index 6161f1911..80c6cf712 100644
--- a/src/com/android/gallery3d/filtershow/editors/Editor.java
+++ b/src/com/android/gallery3d/filtershow/editors/Editor.java
@@ -369,6 +369,12 @@ public class Editor implements OnSeekBarChangeListener, SwapButton.SwapButtonLis
}
+ public void attach() {
+ if (mImageShow != null) {
+ mImageShow.attach();
+ }
+ }
+
public void detach() {
if (mImageShow != null) {
mImageShow.detach();
diff --git a/src/com/android/gallery3d/filtershow/editors/EditorPanel.java b/src/com/android/gallery3d/filtershow/editors/EditorPanel.java
index a127ddf2e..ac9e16a59 100644
--- a/src/com/android/gallery3d/filtershow/editors/EditorPanel.java
+++ b/src/com/android/gallery3d/filtershow/editors/EditorPanel.java
@@ -39,6 +39,7 @@ import com.android.gallery3d.filtershow.state.StatePanel;
public class EditorPanel extends Fragment {
private static final String LOGTAG = "EditorPanel";
+ public static final String FRAGMENT_TAG = "EditorPanel";
private LinearLayout mMainView;
private Editor mEditor;
@@ -53,7 +54,11 @@ public class EditorPanel extends Fragment {
super.onAttach(activity);
FilterShowActivity filterShowActivity = (FilterShowActivity) activity;
mEditor = filterShowActivity.getEditor(mEditorID);
- Log.d(LOGTAG, "EditorPanle.onAttach(): mEditorID is " + mEditorID + ", mEditor is " + mEditor);
+ if (mEditor != null) {
+ mEditor.attach();
+ }
+ Log.d(LOGTAG, "EditorPanel.onAttach(): mEditorID is " + mEditorID +
+ ", mEditor is " + mEditor);
}
public void cancelCurrentFilter() {