Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 09b442ea authored by Selim Cinek's avatar Selim Cinek
Browse files

Fixed the paddings when replying with inline reply

The paddings weren't applied properly when we were
sending and when heads-upped since the view wasn't
actually focused and we didn't get an update anymore.

Test: inline reply from HUN, normal, observe normal paddings
Change-Id: I0e0422b5f6ca3ed9a53b4b665016791d6ca0f68f
Fixes: 73819283
parent 150bafd2
Loading
Loading
Loading
Loading
+5 −3
Original line number Diff line number Diff line
@@ -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) {
+10 −0
Original line number Diff line number Diff line
@@ -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();
+5 −1
Original line number Diff line number Diff line
@@ -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.