Skip to content

Commit

Permalink
Use a bottom margin when a software navigation bar is not in use
Browse files Browse the repository at this point in the history
  • Loading branch information
amirzaidi committed Jan 25, 2018
1 parent 2bfd198 commit 9f3c3d6
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/com/android/launcher3/DeviceProfile.java
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ public interface LauncherLayoutChangeListener {
// Insets
private Rect mInsets = new Rect();

private final int mBottomMarginHw;

// Listeners
private ArrayList<LauncherLayoutChangeListener> mListeners = new ArrayList<>();

Expand Down Expand Up @@ -231,6 +233,12 @@ public DeviceProfile(Context context, InvariantDeviceProfile inv,
: res.getDimensionPixelSize(R.dimen.dynamic_grid_hotseat_size)
+ hotseatBarTopPaddingPx + hotseatBarBottomPaddingPx;

mBottomMarginHw = res.getDimensionPixelSize(R.dimen.qsb_hotseat_bottom_margin_hw);
if (!isVerticalBarLayout()) {
hotseatBarSizePx += mBottomMarginHw;
hotseatBarBottomPaddingPx += mBottomMarginHw;
}

// Determine sizes.
widthPx = width;
heightPx = height;
Expand Down Expand Up @@ -440,6 +448,17 @@ private void updateFolderCellSize(float scale, DisplayMetrics dm, Resources res)
}

public void updateInsets(Rect insets) {
if (!isVerticalBarLayout()) {
if (mInsets.bottom == 0 && insets.bottom != 0) {
//Navbar is now shown, remove padding
hotseatBarSizePx -= mBottomMarginHw;
hotseatBarBottomPaddingPx -= mBottomMarginHw;
} else if (mInsets.bottom != 0 && insets.bottom == 0) {
//Navbar is now hidden, show padding
hotseatBarSizePx += mBottomMarginHw;
hotseatBarBottomPaddingPx += mBottomMarginHw;
}
}
mInsets.set(insets);
}

Expand Down

0 comments on commit 9f3c3d6

Please sign in to comment.