fix new QAD layout issues

fixes #3707
// FREEBIE
This commit is contained in:
Jake McGinty 2015-07-28 12:40:13 -07:00 committed by Moxie Marlinspike
parent e145b8171d
commit 98393ba2e1
3 changed files with 22 additions and 9 deletions

View File

@ -266,7 +266,7 @@ public class ConversationActivity extends PassphraseRequiredActionBarActivity
super.onConfigurationChanged(newConfig); super.onConfigurationChanged(newConfig);
composeText.setTransport(sendButton.getSelectedTransport()); composeText.setTransport(sendButton.getSelectedTransport());
quickAttachmentDrawer.onConfigurationChanged(); quickAttachmentDrawer.onConfigurationChanged();
if (container.getCurrentInput() == emojiDrawer) container.hideAttachedInput(); if (container.getCurrentInput() == emojiDrawer) container.hideAttachedInput(true);
} }
@Override @Override

View File

@ -26,7 +26,7 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
} }
@Override public void onKeyboardShown() { @Override public void onKeyboardShown() {
hideAttachedInput(); hideAttachedInput(true);
} }
public void show(@NonNull final EditText imeTarget, @NonNull final InputView input) { public void show(@NonNull final EditText imeTarget, @NonNull final InputView input) {
@ -52,11 +52,11 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
public void hideCurrentInput(EditText imeTarget) { public void hideCurrentInput(EditText imeTarget) {
if (isKeyboardOpen()) hideSoftkey(imeTarget, null); if (isKeyboardOpen()) hideSoftkey(imeTarget, null);
else hideAttachedInput(); else hideAttachedInput(false);
} }
public void hideAttachedInput() { public void hideAttachedInput(boolean instant) {
if (current != null) current.hide(true); if (current != null) current.hide(instant);
current = null; current = null;
} }
@ -67,7 +67,7 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
public void showSoftkey(final EditText inputTarget) { public void showSoftkey(final EditText inputTarget) {
postOnKeyboardOpen(new Runnable() { postOnKeyboardOpen(new Runnable() {
@Override public void run() { @Override public void run() {
hideAttachedInput(); hideAttachedInput(true);
} }
}); });
inputTarget.post(new Runnable() { inputTarget.post(new Runnable() {

View File

@ -50,6 +50,7 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
private int rotation; private int rotation;
private AttachmentDrawerListener listener; private AttachmentDrawerListener listener;
private int halfExpandedHeight; private int halfExpandedHeight;
private ObjectAnimator animator;
private DrawerState drawerState = DrawerState.COLLAPSED; private DrawerState drawerState = DrawerState.COLLAPSED;
private Rect drawChildrenRect = new Rect(); private Rect drawChildrenRect = new Rect();
@ -108,7 +109,7 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
quickCamera.onPause(); quickCamera.onPause();
} }
updateControlsView(); updateControlsView();
setDrawerStateAndUpdate(drawerState); setDrawerStateAndUpdate(drawerState, true);
} }
} }
@ -152,6 +153,10 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
@Override @Override
protected void onLayout(boolean changed, int l, int t, int r, int b) { protected void onLayout(boolean changed, int l, int t, int r, int b) {
if (changed && drawerState == DrawerState.FULL_EXPANDED) {
setSlideOffset(getMeasuredHeight());
}
final int paddingLeft = getPaddingLeft(); final int paddingLeft = getPaddingLeft();
final int paddingTop = getPaddingTop(); final int paddingTop = getPaddingTop();
@ -281,6 +286,10 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen); fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen);
break; break;
case HALF_EXPANDED: case HALF_EXPANDED:
if (isLandscape()) {
setDrawerState(DrawerState.FULL_EXPANDED);
return;
}
fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen); fullScreenButton.setImageResource(R.drawable.quick_camera_fullscreen);
break; break;
case FULL_EXPANDED: case FULL_EXPANDED:
@ -471,14 +480,18 @@ public class QuickAttachmentDrawer extends ViewGroup implements InputView {
} }
private void slideTo(int slideOffset, boolean forceInstant) { private void slideTo(int slideOffset, boolean forceInstant) {
if (animator != null) {
animator.cancel();
animator = null;
}
if (!forceInstant) { if (!forceInstant) {
ObjectAnimator animator = ObjectAnimator.ofInt(this, "slideOffset", this.slideOffset, slideOffset); animator = ObjectAnimator.ofInt(this, "slideOffset", this.slideOffset, slideOffset);
animator.setInterpolator(new FastOutSlowInInterpolator()); animator.setInterpolator(new FastOutSlowInInterpolator());
animator.setDuration(400); animator.setDuration(400);
animator.start(); animator.start();
ViewCompat.postInvalidateOnAnimation(this); ViewCompat.postInvalidateOnAnimation(this);
} else { } else {
Log.w(TAG, "quick sliding to " + slideOffset);
this.slideOffset = slideOffset; this.slideOffset = slideOffset;
requestLayout(); requestLayout();
invalidate(); invalidate();