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);
composeText.setTransport(sendButton.getSelectedTransport());
quickAttachmentDrawer.onConfigurationChanged();
if (container.getCurrentInput() == emojiDrawer) container.hideAttachedInput();
if (container.getCurrentInput() == emojiDrawer) container.hideAttachedInput(true);
}
@Override

View File

@ -26,7 +26,7 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
}
@Override public void onKeyboardShown() {
hideAttachedInput();
hideAttachedInput(true);
}
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) {
if (isKeyboardOpen()) hideSoftkey(imeTarget, null);
else hideAttachedInput();
else hideAttachedInput(false);
}
public void hideAttachedInput() {
if (current != null) current.hide(true);
public void hideAttachedInput(boolean instant) {
if (current != null) current.hide(instant);
current = null;
}
@ -67,7 +67,7 @@ public class InputAwareLayout extends KeyboardAwareLinearLayout implements OnKey
public void showSoftkey(final EditText inputTarget) {
postOnKeyboardOpen(new Runnable() {
@Override public void run() {
hideAttachedInput();
hideAttachedInput(true);
}
});
inputTarget.post(new Runnable() {

View File

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