diff options
| author | Chao Zhang <chaoz@codeaurora.org> | 2016-03-14 11:10:20 +0800 |
|---|---|---|
| committer | Chao Zhang <chaoz@codeaurora.org> | 2016-03-24 19:37:35 +0800 |
| commit | 7deb94a29d29ac7ab4536d35f2aeb00cf33ab207 (patch) | |
| tree | c0c58958a360c77bc62648f4b22bc11bf52d0252 /src | |
| parent | afbd6845a03f8982a8503eba5aa41bc973537a2c (diff) | |
| download | android_packages_apps_Gallery2-7deb94a29d29ac7ab4536d35f2aeb00cf33ab207.tar.gz android_packages_apps_Gallery2-7deb94a29d29ac7ab4536d35f2aeb00cf33ab207.tar.bz2 android_packages_apps_Gallery2-7deb94a29d29ac7ab4536d35f2aeb00cf33ab207.zip | |
Gallery2: revert filtershow panel layout to M style;
revert filtershow panel layout to M style according to UX specification
document.
delete filtershow_main_panel.xml in layout-land.
Change-Id: I33a031063d8392fecf4de071f62bf46b2aaa57e2
CRs-Fixed: 988029 987904
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 128 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/category/MainPanel.java | 82 |
2 files changed, 52 insertions, 158 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 54b637e4e..32981f175 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -206,9 +206,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL private DialogInterface mCurrentDialog = null; private PopupMenu mCurrentMenu = null; private boolean mReleaseDualCamOnDestory = true; - private FrameLayout mCategoryFragment; - private View mEffectsContainer; - private View mEffectsTextContainer; private ImageButton imgComparison; private String mPopUpText, mExit; RelativeLayout rlImageContainer; @@ -317,8 +314,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL if (findViewById(R.id.main_panel_container) == null) { return; } - Fragment main = getSupportFragmentManager().findFragmentByTag( - MainPanel.FRAGMENT_TAG); MainPanel panel = new MainPanel(); Bundle bundle = new Bundle(); bundle.putBoolean(MainPanel.EDITOR_TAG, isComingFromEditorScreen); @@ -453,9 +448,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL if (mMenu != null) { mMenu.clear(); } - final Fragment main = getSupportFragmentManager().findFragmentByTag( - MainPanel.FRAGMENT_TAG); - actionBar.setCustomView(R.layout.filtershow_actionbar_new); mCancelButton = actionBar.getCustomView().findViewById( R.id.imgCancel); @@ -463,8 +455,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL mCancelButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { - MainPanel mainPanel = (MainPanel) main; - mainPanel.toggleEffectsTrayVisibility(true); setActionBar(false); HistoryManager adapter = mMasterImage.getHistory(); int position = adapter.undoCurrentFilter(); @@ -478,15 +468,12 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL @Override public void onClick(View view) { // saveImage(); - MainPanel mainPanel = (MainPanel) main; - mainPanel.toggleEffectsTrayVisibility(true); setActionBar(false); HistoryManager adapter = mMasterImage .getHistory(); adapter.resetActiveFilter(); } }); - isEffectClicked = false; } } @@ -545,18 +532,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL invalidateViews(); } - private void toggleEffectsTrayVisibility(boolean isEffectTrayEnabled) { - if (isEffectTrayEnabled) { - mCategoryFragment.setVisibility(View.VISIBLE); - mEffectsContainer.setVisibility(View.GONE); - mEffectsTextContainer.setVisibility(View.GONE); - } else { - mCategoryFragment.setVisibility(View.GONE); - mEffectsContainer.setVisibility(View.VISIBLE); - mEffectsTextContainer.setVisibility(View.VISIBLE); - } - } - public void adjustCompareButton(boolean scaled) { Resources r = getResources(); int marginTop, marginRight; @@ -1178,7 +1153,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL public LoadBitmapTask() { mBitmapSize = getScreenImageSize(); - Log.d(LOGTAG, "FilterShowActivity.LoadBtimapTask(): mBitmapSize is " + mBitmapSize); + Log.d(LOGTAG, "FilterShowActivity.LoadBitmapTask(): mBitmapSize is " + mBitmapSize); } @Override @@ -1222,8 +1197,8 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL return; } - if (null == CachingPipeline.getRenderScriptContext()){ - Log.v(LOGTAG,"RenderScript context destroyed during load"); + if (null == CachingPipeline.getRenderScriptContext()) { + Log.v(LOGTAG, "RenderScript context destroyed during load"); return; } final View imageShow = findViewById(R.id.imageShow); @@ -1264,7 +1239,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL MasterImage.getImage().resetGeometryImages(true); - if (mAction == TINY_PLANET_ACTION) { + if (mAction.equals(TINY_PLANET_ACTION)) { showRepresentation(mCategoryFiltersAdapter.getTinyPlanet()); } mHiResBitmapTask = new LoadHighresBitmapTask(); @@ -1433,7 +1408,7 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL if (mShareActionProvider != null) { mShareActionProvider.setOnShareTargetSelectedListener(this); } - if(SimpleMakeupImageFilter.HAS_TS_MAKEUP) { + if (SimpleMakeupImageFilter.HAS_TS_MAKEUP) { MakeupEngine.getMakeupObj(); } @@ -1745,69 +1720,38 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL MainPanel.FRAGMENT_TAG); if (currentPanel instanceof MainPanel) { - MainPanel mainPanel = (MainPanel) currentPanel; - if (mainPanel.isCategoryPanelVisible()) { - if (mImageShow.hasModifications()) { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage(R.string.unsaved).setTitle( - R.string.save_before_exit); - builder.setPositiveButton(mPopUpText, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, - int id) { - done(); - } - }); - builder.setNegativeButton(mExit, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, - int id) { - HistoryManager adapter = mMasterImage - .getHistory(); - int position = adapter.undoCurrentFilter(); - mMasterImage.onHistoryItemClick(position); - adapter.resetActiveFilter(); - backToMain(); - invalidateViews(); - } - }); - builder.show(); - } - setActionBar(false); - mainPanel.toggleEffectsTrayVisibility(true); - invalidateOptionsMenu(); - if (MasterImage.getImage().getScaleFactor() < 1) - setScaleImage(false); - adjustCompareButton(false); - + if (mImageShow.hasModifications()) { + AlertDialog.Builder builder = new AlertDialog.Builder(this); + builder.setMessage(R.string.unsaved).setTitle( + R.string.save_before_exit); + builder.setPositiveButton(mPopUpText, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + done(); + } + }); + builder.setNegativeButton(mExit, + new DialogInterface.OnClickListener() { + @Override + public void onClick(DialogInterface dialog, int id) { + HistoryManager adapter = mMasterImage.getHistory(); + int position = adapter.undoCurrentFilter(); + mMasterImage.onHistoryItemClick(position); + adapter.resetActiveFilter(); + backToMain(); + invalidateViews(); + } + }); + builder.show(); } else { - if (!mImageShow.hasModifications()) { - done(); - } else { - AlertDialog.Builder builder = new AlertDialog.Builder(this); - builder.setMessage(R.string.unsaved).setTitle( - R.string.save_before_exit); - builder.setPositiveButton(R.string.save_and_exit, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, - int id) { - saveImage(); - } - }); - builder.setNegativeButton(R.string.exit, - new DialogInterface.OnClickListener() { - @Override - public void onClick(DialogInterface dialog, - int id) { - done(); - } - }); - builder.show(); - } + done(); } + setActionBar(false); + invalidateOptionsMenu(); + if (MasterImage.getImage().getScaleFactor() < 1) + setScaleImage(false); + adjustCompareButton(false); } else { isComingFromEditorScreen = true; backToMain(); @@ -1985,6 +1929,6 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } public void setScaleImage(boolean isScaled) { - mImageShow.scaleImage(isScaled,getBaseContext()); + mImageShow.scaleImage(isScaled, getBaseContext()); } } diff --git a/src/com/android/gallery3d/filtershow/category/MainPanel.java b/src/com/android/gallery3d/filtershow/category/MainPanel.java index c5f9c6e87..0f6b66116 100644 --- a/src/com/android/gallery3d/filtershow/category/MainPanel.java +++ b/src/com/android/gallery3d/filtershow/category/MainPanel.java @@ -22,11 +22,8 @@ import android.support.v4.app.FragmentTransaction; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.LinearLayout; -import android.widget.TextView; -import android.util.Log; import com.android.gallery3d.R; import com.android.gallery3d.filtershow.FilterShowActivity; @@ -36,7 +33,6 @@ import com.android.gallery3d.filtershow.filters.SimpleMakeupImageFilter; import com.android.gallery3d.filtershow.filters.TrueScannerActs; import com.android.gallery3d.filtershow.imageshow.MasterImage; import com.android.gallery3d.filtershow.state.StatePanel; -import com.android.gallery3d.filtershow.tools.DualCameraNativeEngine; import com.android.gallery3d.filtershow.tools.DualCameraNativeEngine.DdmStatus; public class MainPanel extends Fragment { @@ -50,10 +46,6 @@ public class MainPanel extends Fragment { private ImageButton filtersButton; private ImageButton dualCamButton; private ImageButton makeupButton; - private View mEffectsContainer; - private View mEffectsTextContainer; - private FrameLayout mCategoryFragment; - private View mBottomView; private ImageButton trueScannerButton; private ImageButton hazeBusterButton; private ImageButton seeStraightButton; @@ -142,21 +134,9 @@ public class MainPanel extends Fragment { geometryButton = (ImageButton) mMainView.findViewById(R.id.geometryButton); filtersButton = (ImageButton) mMainView.findViewById(R.id.colorsButton); dualCamButton = (ImageButton) mMainView.findViewById(R.id.dualCamButton); - mCategoryFragment = (FrameLayout) mMainView - .findViewById(R.id.category_panel_container); - mBottomView = mMainView.findViewById(R.id.bottom_panel); - mEffectsContainer = mMainView.findViewById(R.id.effectsContainer); - mEffectsTextContainer = mMainView.findViewById(R.id.effectsText); if (SimpleMakeupImageFilter.HAS_TS_MAKEUP) { makeupButton = (ImageButton) mMainView.findViewById(R.id.makeupButton); makeupButton.setVisibility(View.VISIBLE); - TextView beautify = (TextView) mEffectsTextContainer - .findViewById(R.id.tvBeautify); - beautify.setVisibility(View.VISIBLE); - } - boolean showPanel = false; - if (getArguments() != null) { - showPanel = getArguments().getBoolean(EDITOR_TAG); } if (makeupButton != null) { @@ -167,25 +147,19 @@ public class MainPanel extends Fragment { } }); } - TextView trueScannerTv = (TextView) mMainView.findViewById(R.id.tvTrueScanner); trueScannerButton = (ImageButton) mMainView.findViewById(R.id.trueScannerButton); if (!TrueScannerActs.isTrueScannerEnabled()) { - trueScannerTv.setVisibility(View.GONE); trueScannerButton.setVisibility(View.GONE); } hazeBusterButton = (ImageButton) mMainView.findViewById(R.id.hazeBusterButton); - TextView hazeBusterTv = (TextView) mMainView.findViewById(R.id.tvHazeBuster); if(!HazeBusterActs.isHazeBusterEnabled()) { - hazeBusterTv.setVisibility(View.GONE); hazeBusterButton.setVisibility(View.GONE); } seeStraightButton = (ImageButton) mMainView.findViewById(R.id.seeStraightButton); - TextView seeStraightTv = (TextView) mMainView.findViewById(R.id.tvSeeStraight); if(!SeeStraightActs.isSeeStraightEnabled()) { seeStraightButton.setVisibility(View.GONE); - seeStraightTv.setVisibility(View.GONE); } looksButton.setOnClickListener(new View.OnClickListener() { @@ -243,10 +217,8 @@ public class MainPanel extends Fragment { }); FilterShowActivity activity = (FilterShowActivity) getActivity(); - //showImageStatePanel(activity.isShowingImageStatePanel()); - if (showPanel) { - showPanel(activity.getCurrentPanel()); - } + showImageStatePanel(activity.isShowingImageStatePanel()); + showPanel(activity.getCurrentPanel()); return mMainView; } @@ -257,22 +229,6 @@ public class MainPanel extends Fragment { return true; } - public boolean isCategoryPanelVisible() { - return (View.VISIBLE == mCategoryFragment.getVisibility()); - } - - public void toggleEffectsTrayVisibility(boolean isCategoryTrayVisible) { - if (isCategoryTrayVisible) { - mCategoryFragment.setVisibility(View.GONE); - mEffectsContainer.setVisibility(View.VISIBLE); - mEffectsTextContainer.setVisibility(View.VISIBLE); - } else { - mCategoryFragment.setVisibility(View.VISIBLE); - mEffectsContainer.setVisibility(View.GONE); - mEffectsTextContainer.setVisibility(View.GONE); - } - } - private void setCategoryFragment(CategoryPanel category, boolean fromRight) { FragmentTransaction transaction = getChildFragmentManager().beginTransaction(); FilterShowActivity activity = (FilterShowActivity) getActivity(); @@ -282,13 +238,10 @@ public class MainPanel extends Fragment { transaction.setCustomAnimations(R.anim.slide_in_left, R.anim.slide_out_left); } if (isEffectClicked) { - toggleEffectsTrayVisibility(false); - activity.setActionBar(isEffectClicked); + activity.setActionBar(true); isEffectClicked = false; } else { - toggleEffectsTrayVisibility(true); - activity.setActionBar(isEffectClicked); - + activity.setActionBar(false); } transaction.replace(R.id.category_panel_container, category, CategoryPanel.FRAGMENT_TAG); transaction.commitAllowingStateLoss(); @@ -308,9 +261,9 @@ public class MainPanel extends Fragment { } public void loadCategoryBorderPanel() { - /*if (mCurrentSelected == BORDERS) { + if (mCurrentSelected == BORDERS) { return; - }*/ + } boolean fromRight = isRightAnimation(BORDERS); selection(mCurrentSelected, false); CategoryPanel categoryPanel = new CategoryPanel(); @@ -334,9 +287,9 @@ public class MainPanel extends Fragment { } public void loadCategoryGeometryPanel() { - /*if (mCurrentSelected == GEOMETRY) { + if (mCurrentSelected == GEOMETRY) { return; - }*/ + } if (MasterImage.getImage().hasTinyPlanet()) { return; } @@ -380,9 +333,9 @@ public class MainPanel extends Fragment { } public void loadCategoryFiltersPanel() { - /*if (mCurrentSelected == FILTERS) { + if (mCurrentSelected == FILTERS) { return; - }*/ + } boolean fromRight = isRightAnimation(FILTERS); selection(mCurrentSelected, false); CategoryPanel categoryPanel = new CategoryPanel(); @@ -393,9 +346,9 @@ public class MainPanel extends Fragment { } public void loadCategoryVersionsPanel() { - /*if (mCurrentSelected == VERSIONS) { + if (mCurrentSelected == VERSIONS) { return; - }*/ + } FilterShowActivity activity = (FilterShowActivity) getActivity(); activity.updateVersions(); boolean fromRight = isRightAnimation(VERSIONS); @@ -408,9 +361,9 @@ public class MainPanel extends Fragment { } public void loadCategoryDualCamPanel() { - /*if (mCurrentSelected == DUALCAM) { + if (mCurrentSelected == DUALCAM) { return; - }*/ + } boolean fromRight = isRightAnimation(DUALCAM); selection(mCurrentSelected, false); CategoryPanel categoryPanel = new CategoryPanel(); @@ -431,7 +384,7 @@ public class MainPanel extends Fragment { FilterShowActivity activity = (FilterShowActivity) getActivity(); switch (currentPanel) { case LOOKS: { - loadCategoryLookPanel(true); + loadCategoryLookPanel(false); break; } case BORDERS: { @@ -471,7 +424,7 @@ public class MainPanel extends Fragment { break; } } - if (currentPanel > 0) { + if (currentPanel > 0) { activity.setScaleImage(true); activity.adjustCompareButton(true); } else { @@ -540,9 +493,6 @@ public class MainPanel extends Fragment { boolean enable = (status == DdmStatus.DDM_LOADING || status == DdmStatus.DDM_LOADED); dualCamButton.setVisibility(enable?View.VISIBLE:View.GONE); - TextView tvDualCam = (TextView) mEffectsTextContainer - .findViewById(R.id.tvDualCam); - tvDualCam.setVisibility(enable?View.VISIBLE:View.GONE); } } } |
