Skip to content

Commit

Permalink
Clip reactions mask if the view falls below the input panel.
Browse files Browse the repository at this point in the history
  • Loading branch information
alex-signal authored and greyson-signal committed Feb 6, 2020
1 parent 5e59f77 commit 21cf390
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,9 @@ protected void onDraw(@NonNull Canvas canvas) {
target.getDrawingRect(drawingRect);
activityContentView.offsetDescendantRectToMyCoords(target, drawingRect);

Bitmap mask = Bitmap.createBitmap(target.getWidth(), target.getHeight(), Bitmap.Config.ARGB_8888);
drawingRect.bottom = Math.min(drawingRect.bottom, getBottom() - getPaddingBottom());

Bitmap mask = Bitmap.createBitmap(target.getWidth(), drawingRect.height(), Bitmap.Config.ARGB_8888);
Canvas maskCanvas = new Canvas(mask);

target.draw(maskCanvas);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -516,6 +516,10 @@ public void onConfigurationChanged(Configuration newConfig) {
if (emojiDrawerStub.resolved() && container.getCurrentInput() == emojiDrawerStub.get()) {
container.hideAttachedInput(true);
}

if (reactionOverlay != null && reactionOverlay.isShowing()) {
reactionOverlay.hide();
}
}

@Override
Expand Down Expand Up @@ -2797,7 +2801,7 @@ public void handleReaction(@NonNull View maskTarget,
{
reactionOverlay.setOnToolbarItemClickedListener(toolbarListener);
reactionOverlay.setOnHideListener(onHideListener);
reactionOverlay.show(this, maskTarget, messageRecord);
reactionOverlay.show(this, maskTarget, messageRecord, inputPanel.getMeasuredHeight());
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@ protected void onFinishInflate() {
initAnimators();
}

public void show(@NonNull Activity activity, @NonNull View maskTarget, @NonNull MessageRecord messageRecord) {
public void show(@NonNull Activity activity, @NonNull View maskTarget, @NonNull MessageRecord messageRecord, int maskPaddingBottom) {

if (overlayState != OverlayState.HIDDEN) {
return;
Expand Down Expand Up @@ -168,6 +168,7 @@ public void show(@NonNull Activity activity, @NonNull View maskTarget, @NonNull
verticalScrubBoundary.update(lastSeenDownPoint.y - distanceFromTouchDownPointToTopOfScrubberDeadZone,
lastSeenDownPoint.y + distanceFromTouchDownPointToBottomOfScrubberDeadZone);

maskView.setPadding(0, 0, 0, maskPaddingBottom);
maskView.setTarget(maskTarget);

hideAnimatorSet.end();
Expand All @@ -177,7 +178,7 @@ public void show(@NonNull Activity activity, @NonNull View maskTarget, @NonNull
if (Build.VERSION.SDK_INT >= 21) {
this.activity = activity;
originalStatusBarColor = activity.getWindow().getStatusBarColor();
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, R.color.core_grey_45));
activity.getWindow().setStatusBarColor(ContextCompat.getColor(activity, R.color.action_mode_status_bar));
}
}

Expand Down

0 comments on commit 21cf390

Please sign in to comment.