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

Commit 92a9e6a0 authored by Mady Mellor's avatar Mady Mellor Committed by Android (Google) Code Review
Browse files

Merge "Use the orientation from the config object not resources"

parents 87b22d6d 4a79d7cb
Loading
Loading
Loading
Loading
+6 −8
Original line number Diff line number Diff line
@@ -102,7 +102,7 @@ public class DragLayout extends LinearLayout {
                MATCH_PARENT));
        ((LayoutParams) mDropZoneView1.getLayoutParams()).weight = 1;
        ((LayoutParams) mDropZoneView2.getLayoutParams()).weight = 1;
        updateContainerMargins();
        updateContainerMargins(getResources().getConfiguration().orientation);
    }

    @Override
@@ -127,20 +127,18 @@ public class DragLayout extends LinearLayout {
    }

    public void onConfigChanged(Configuration newConfig) {
        final int orientation = getResources().getConfiguration().orientation;
        if (orientation == Configuration.ORIENTATION_LANDSCAPE
        if (newConfig.orientation == Configuration.ORIENTATION_LANDSCAPE
                && getOrientation() != HORIZONTAL) {
            setOrientation(LinearLayout.HORIZONTAL);
            updateContainerMargins();
        } else if (orientation == Configuration.ORIENTATION_PORTRAIT
            updateContainerMargins(newConfig.orientation);
        } else if (newConfig.orientation == Configuration.ORIENTATION_PORTRAIT
                && getOrientation() != VERTICAL) {
            setOrientation(LinearLayout.VERTICAL);
            updateContainerMargins();
            updateContainerMargins(newConfig.orientation);
        }
    }

    private void updateContainerMargins() {
        final int orientation = getResources().getConfiguration().orientation;
    private void updateContainerMargins(int orientation) {
        final float halfMargin = mDisplayMargin / 2f;
        if (orientation == Configuration.ORIENTATION_LANDSCAPE) {
            mDropZoneView1.setContainerMargin(