diff options
| author | Chao Zhang <chaoz@codeaurora.org> | 2016-01-28 20:55:00 +0800 |
|---|---|---|
| committer | Gerrit - the friendly Code Review server <code-review@localhost> | 2016-01-30 01:09:28 -0800 |
| commit | 0316f86c60f65ad521ee1e0a12919b82a2d3c03f (patch) | |
| tree | 9356006bb651d4a358f6637c2dffcc08bd4b4aa5 /src | |
| parent | 9140fea09cff9bf7141f12b7464aefa576f5474b (diff) | |
| download | android_packages_apps_Gallery2-0316f86c60f65ad521ee1e0a12919b82a2d3c03f.tar.gz android_packages_apps_Gallery2-0316f86c60f65ad521ee1e0a12919b82a2d3c03f.tar.bz2 android_packages_apps_Gallery2-0316f86c60f65ad521ee1e0a12919b82a2d3c03f.zip | |
Gallery2: fix crop button and action bar overlapped when crop a 16:9 photo.
When crop a 16:9 photo, crop button and action bar overlapped.
Add a topMargin to editor container.
Change-Id: I9ed2356d5575a859bbfba172692fa9a91802b3e8
CRs-Fixed: 967548
Diffstat (limited to 'src')
| -rw-r--r-- | src/com/android/gallery3d/filtershow/FilterShowActivity.java | 21 | ||||
| -rw-r--r-- | src/com/android/gallery3d/filtershow/editors/Editor.java | 4 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/com/android/gallery3d/filtershow/FilterShowActivity.java b/src/com/android/gallery3d/filtershow/FilterShowActivity.java index 1824e7fd0..ab921e689 100644 --- a/src/com/android/gallery3d/filtershow/FilterShowActivity.java +++ b/src/com/android/gallery3d/filtershow/FilterShowActivity.java @@ -739,11 +739,30 @@ public class FilterShowActivity extends FragmentActivity implements OnItemClickL } private void setupEditors() { - mEditorPlaceHolder.setContainer((FrameLayout) findViewById(R.id.editorContainer)); + FrameLayout editorContainer = (FrameLayout) findViewById(R.id.editorContainer); + LayoutParams layoutParams = (LayoutParams) editorContainer.getLayoutParams(); + // if topMargin is not set in xml, set a default value here. + if (layoutParams.topMargin == 0) { + layoutParams.topMargin = getActionBarHeight() + getStatusBarHeight(); + editorContainer.setLayoutParams(layoutParams); + } + + mEditorPlaceHolder.setContainer(editorContainer); EditorManager.addEditors(mEditorPlaceHolder); mEditorPlaceHolder.setOldViews(mImageViews); } + private int getActionBarHeight() { + ActionBar actionBar = getActionBar(); + return actionBar == null ? 0 : actionBar.getHeight(); + } + + private int getStatusBarHeight() { + Rect frame = new Rect(); + getWindow().getDecorView().getWindowVisibleDisplayFrame(frame); + return frame.top; + } + private void setDefaultValues() { Resources res = getResources(); diff --git a/src/com/android/gallery3d/filtershow/editors/Editor.java b/src/com/android/gallery3d/filtershow/editors/Editor.java index 490e5991c..d4d872a4d 100644 --- a/src/com/android/gallery3d/filtershow/editors/Editor.java +++ b/src/com/android/gallery3d/filtershow/editors/Editor.java @@ -145,10 +145,12 @@ public class Editor implements OnSeekBarChangeListener, SwapButton.SwapButtonLis mSeekBar = (SeekBar) lp.findViewById(R.id.primarySeekBar); mSeekBar.setOnSeekBarChangeListener(this); mSeekBar.setVisibility(View.GONE); + editControl.setVisibility(View.GONE); if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) { if (showsSeekBar()) { - mSeekBar.setVisibility(View.VISIBLE); + mSeekBar.setVisibility(View.VISIBLE); + editControl.setVisibility(View.VISIBLE); } } |
