Merge "Fixed the paddings when replying with inline reply" into pi-dev

This commit is contained in:
Selim Cinek
2018-05-05 01:18:28 +00:00
committed by Android (Google) Code Review
3 changed files with 20 additions and 4 deletions

View File

@@ -315,8 +315,7 @@ public class NotificationContentView extends FrameLayout {
* @return The extra height needed.
*/
private int getExtraRemoteInputHeight(RemoteInputView remoteInput) {
if (remoteInput != null && remoteInput.getVisibility() == VISIBLE
&& remoteInput.isActive()) {
if (remoteInput != null && (remoteInput.isActive() || remoteInput.isSending())) {
return getResources().getDimensionPixelSize(
com.android.internal.R.dimen.notification_content_margin);
}
@@ -1705,7 +1704,10 @@ public class NotificationContentView extends FrameLayout {
if (mHeadsUpChild == null) {
viewType = VISIBLE_TYPE_CONTRACTED;
}
return getViewHeight(viewType) + getExtraRemoteInputHeight(mHeadsUpRemoteInput);
// The headsUp remote input quickly switches to the expanded one, so lets also include that
// one
return getViewHeight(viewType) + getExtraRemoteInputHeight(mHeadsUpRemoteInput)
+ getExtraRemoteInputHeight(mExpandedRemoteInput);
}
public void setRemoteInputVisible(boolean remoteInputVisible) {

View File

@@ -165,6 +165,16 @@ public class RemoteInputController {
return mSpinning.containsKey(key);
}
/**
* Same as {@link #isSpinning}, but also verifies that the token is the same
* @param key the key that is spinning
* @param token the token that needs to be the same
* @return if this key with a given token is spinning
*/
public boolean isSpinning(String key, Object token) {
return mSpinning.get(key) == token;
}
private void apply(NotificationData.Entry entry) {
mDelegate.setRemoteInputActive(entry, isRemoteInputActive(entry));
boolean remoteInputActive = isRemoteInputActive();

View File

@@ -285,12 +285,12 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
if (mWrapper != null) {
mWrapper.setRemoteInputVisible(true);
}
mController.addRemoteInput(mEntry, mToken);
mEditText.setInnerFocusable(true);
mEditText.mShowImeOnInputConnection = true;
mEditText.setText(mEntry.remoteInputText);
mEditText.setSelection(mEditText.getText().length());
mEditText.requestFocus();
mController.addRemoteInput(mEntry, mToken);
updateSendButton();
}
@@ -466,6 +466,10 @@ public class RemoteInputView extends LinearLayout implements View.OnClickListene
}
}
public boolean isSending() {
return getVisibility() == VISIBLE && mController.isSpinning(mEntry.key, mToken);
}
/**
* An EditText that changes appearance based on whether it's focusable and becomes
* un-focusable whenever the user navigates away from it or it becomes invisible.