fix direct capture control view placement

Closes #3608
// FREEBIE
This commit is contained in:
Jake McGinty 2015-07-10 16:54:15 -07:00 committed by Moxie Marlinspike
parent 9b2aabfdc8
commit 226646d5b8

View file

@ -115,7 +115,7 @@ public class QuickAttachmentDrawer extends ViewGroup {
private void updateControlsView() { private void updateControlsView() {
int controlsIndex = indexOfChild(controls); int controlsIndex = indexOfChild(controls);
removeView(controls); if (controlsIndex > -1) removeView(controls);
controls = LayoutInflater.from(getContext()).inflate(isLandscape() ? R.layout.quick_camera_controls_land controls = LayoutInflater.from(getContext()).inflate(isLandscape() ? R.layout.quick_camera_controls_land
: R.layout.quick_camera_controls, : R.layout.quick_camera_controls,
this, false); this, false);
@ -128,7 +128,7 @@ public class QuickAttachmentDrawer extends ViewGroup {
} }
shutterButton.setOnClickListener(new ShutterClickListener()); shutterButton.setOnClickListener(new ShutterClickListener());
fullScreenButton.setOnClickListener(new FullscreenClickListener()); fullScreenButton.setOnClickListener(new FullscreenClickListener());
addView(controls, controlsIndex); addView(controls, controlsIndex > -1 ? controlsIndex : indexOfChild(quickCamera) + 1);
} }
private boolean isLandscape() { private boolean isLandscape() {
@ -250,21 +250,21 @@ public class QuickAttachmentDrawer extends ViewGroup {
if (h != oldh) updateHalfExpandedAnchorPoint(); if (h != oldh) updateHalfExpandedAnchorPoint();
} }
// @Override @Override
// protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) { protected boolean drawChild(@NonNull Canvas canvas, @NonNull View child, long drawingTime) {
// boolean result; boolean result;
// final int save = canvas.save(Canvas.CLIP_SAVE_FLAG); final int save = canvas.save(Canvas.CLIP_SAVE_FLAG);
//
// canvas.getClipBounds(drawChildrenRect); canvas.getClipBounds(drawChildrenRect);
// if (child == coverView) if (child == coverView)
// drawChildrenRect.bottom = Math.min(drawChildrenRect.bottom, child.getBottom()); drawChildrenRect.bottom = Math.min(drawChildrenRect.bottom, child.getBottom());
// else if (coverView != null) else if (coverView != null)
// drawChildrenRect.top = Math.max(drawChildrenRect.top, coverView.getBottom()); drawChildrenRect.top = Math.max(drawChildrenRect.top, coverView.getBottom());
// canvas.clipRect(drawChildrenRect); canvas.clipRect(drawChildrenRect);
// result = super.drawChild(canvas, child, drawingTime); result = super.drawChild(canvas, child, drawingTime);
// canvas.restoreToCount(save); canvas.restoreToCount(save);
// return result; return result;
// } }
@Override @Override
public void computeScroll() { public void computeScroll() {