am da0b2bda: am e8378476: Merge "Allow content rect to overshoot the bottom view bounds by 20dp." into mnc-dev

* commit 'da0b2bda80d16e9cf3c7705377f7fba6284cb765':
  Allow content rect to overshoot the bottom view bounds by 20dp.
This commit is contained in:
Abodunrinwa Toki
2015-06-18 01:29:04 +00:00
committed by Android Git Automerger
3 changed files with 9 additions and 1 deletions

View File

@@ -25,6 +25,7 @@ import android.view.MenuItem;
import android.view.View;
import android.view.ViewConfiguration;
import com.android.internal.R;
import com.android.internal.util.Preconditions;
import com.android.internal.view.menu.MenuBuilder;
import com.android.internal.widget.FloatingToolbar;
@@ -44,6 +45,7 @@ public class FloatingActionMode extends ActionMode {
private final Rect mViewRect;
private final Rect mScreenRect;
private final View mOriginatingView;
private final int mBottomAllowance;
private final Runnable mMovingOff = new Runnable() {
public void run() {
@@ -77,6 +79,10 @@ public class FloatingActionMode extends ActionMode {
mScreenRect = new Rect();
mOriginatingView = Preconditions.checkNotNull(originatingView);
mOriginatingView.getLocationInWindow(mViewPosition);
// Allow the content rect to overshoot a little bit beyond the
// bottom view bound if necessary.
mBottomAllowance = context.getResources()
.getDimensionPixelSize(R.dimen.content_rect_bottom_clip_allowance);
}
public void setFloatingToolbar(FloatingToolbar floatingToolbar) {
@@ -141,7 +147,7 @@ public class FloatingActionMode extends ActionMode {
Math.max(mContentRectOnWindow.left, mViewRect.left),
Math.max(mContentRectOnWindow.top, mViewRect.top),
Math.min(mContentRectOnWindow.right, mViewRect.right),
Math.min(mContentRectOnWindow.bottom, mViewRect.bottom));
Math.min(mContentRectOnWindow.bottom, mViewRect.bottom + mBottomAllowance));
if (!mContentRectOnWindow.equals(mPreviousContentRectOnWindow)) {
// Content rect is moving.

View File

@@ -399,6 +399,7 @@
<dimen name="floating_toolbar_maximum_overflow_height">192dp</dimen>
<dimen name="floating_toolbar_horizontal_margin">16dp</dimen>
<dimen name="floating_toolbar_vertical_margin">8dp</dimen>
<dimen name="content_rect_bottom_clip_allowance">20dp</dimen>
<dimen name="chooser_grid_padding">0dp</dimen>
</resources>

View File

@@ -2274,6 +2274,7 @@
<java-symbol type="dimen" name="floating_toolbar_maximum_overflow_height" />
<java-symbol type="dimen" name="floating_toolbar_horizontal_margin" />
<java-symbol type="dimen" name="floating_toolbar_vertical_margin" />
<java-symbol type="dimen" name="content_rect_bottom_clip_allowance" />
<java-symbol type="string" name="date_picker_prev_month_button" />
<java-symbol type="string" name="date_picker_next_month_button" />