Skip to content

Commit

Permalink
Better reverse landscape support.
Browse files Browse the repository at this point in the history
  • Loading branch information
nickbutcher committed Jul 22, 2016
1 parent 50b9568 commit f594315
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 3 deletions.
4 changes: 3 additions & 1 deletion app/src/main/java/io/plaidapp/ui/HomeActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,13 @@ public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
ViewGroup.MarginLayoutParams lpToolbar = (ViewGroup.MarginLayoutParams) toolbar
.getLayoutParams();
lpToolbar.topMargin += insets.getSystemWindowInsetTop();
lpToolbar.leftMargin += insets.getSystemWindowInsetLeft();
lpToolbar.rightMargin += insets.getSystemWindowInsetRight();
toolbar.setLayoutParams(lpToolbar);

// inset the grid top by statusbar+toolbar & the bottom by the navbar (don't clip)
grid.setPadding(grid.getPaddingLeft(),
grid.setPadding(
grid.getPaddingLeft() + insets.getSystemWindowInsetLeft(), // landscape
insets.getSystemWindowInsetTop() + ViewUtils.getActionBarSize
(HomeActivity.this),
grid.getPaddingRight() + insets.getSystemWindowInsetRight(), // landscape
Expand Down
6 changes: 4 additions & 2 deletions app/src/main/java/io/plaidapp/ui/PlayerActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -127,8 +127,10 @@ protected void onCreate(Bundle savedInstanceState) {
draggableFrame.setOnApplyWindowInsetsListener(new View.OnApplyWindowInsetsListener() {
@Override
public WindowInsets onApplyWindowInsets(View v, WindowInsets insets) {
((ViewGroup.MarginLayoutParams) draggableFrame.getLayoutParams()).rightMargin
+= insets.getSystemWindowInsetRight(); // landscape
final ViewGroup.MarginLayoutParams lpFrame = (ViewGroup.MarginLayoutParams)
draggableFrame.getLayoutParams();
lpFrame.leftMargin += insets.getSystemWindowInsetLeft(); // landscape
lpFrame.rightMargin += insets.getSystemWindowInsetRight(); // landscape
((ViewGroup.MarginLayoutParams) avatar.getLayoutParams()).topMargin
+= insets.getSystemWindowInsetTop();
ViewUtils.setPaddingTop(playerDescription, insets.getSystemWindowInsetTop());
Expand Down

0 comments on commit f594315

Please sign in to comment.