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

Commit 639b0717 authored by android-build-team Robot's avatar android-build-team Robot Committed by Android (Google) Code Review
Browse files

Merge "Using surface rotation instead of insets to determine seascape...

Merge "Using surface rotation instead of insets to determine seascape configuration" into ub-launcher3-edmonton
parents e3a96809 59d086c3
Loading
Loading
Loading
Loading
+1.71 KiB (125 KiB)

File changed.

No diff preview for this file type.

+48 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2018 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.android.launcher3.uioverrides;

import android.content.Context;
import android.os.Handler;

import com.android.systemui.shared.system.RotationWatcher;

/**
 * Utility class for listening for rotation changes
 */
public class DisplayRotationListener extends RotationWatcher {

    private final Runnable mCallback;
    private Handler mHandler;

    public DisplayRotationListener(Context context, Runnable callback) {
        super(context);
        mCallback = callback;
    }

    @Override
    public void enable() {
        if (mHandler == null) {
            mHandler = new Handler();
        }
        super.enable();
    }

    @Override
    protected void onRotationChanged(int i) {
        mHandler.post(mCallback);
    }
}
+6 −0
Original line number Diff line number Diff line
@@ -121,6 +121,11 @@ public class RecentsActivity extends BaseDraggingActivity {
        dispatchDeviceProfileChanged();

        mRecentsRootView.setup();
        reapplyUi();
    }

    @Override
    protected void reapplyUi() {
        mRecentsRootView.dispatchInsets();
    }

@@ -140,6 +145,7 @@ public class RecentsActivity extends BaseDraggingActivity {
                    ? new InvariantDeviceProfile(this).getDeviceProfile(this)
                    : appState.getInvariantDeviceProfile().getDeviceProfile(this).copy(this);
        }
        onDeviceProfileInitiated();
    }

    @Override
+2 −0
Original line number Diff line number Diff line
@@ -43,6 +43,7 @@ import android.support.annotation.WorkerThread;
import android.util.Log;
import android.view.View;
import android.view.ViewTreeObserver.OnDrawListener;
import android.view.WindowManager;
import android.view.animation.Interpolator;

import com.android.launcher3.AbstractFloatingView;
@@ -541,6 +542,7 @@ public class WindowTransformSwipeHandler<T extends BaseDraggingActivity> {
            dp = dp.copy(mContext);
            dp.updateInsets(insets);
        }
        dp.updateIsSeascape(mContext.getSystemService(WindowManager.class));

        if (runningTaskTarget != null) {
            mClipAnimationHelper.updateSource(overviewStackBounds, runningTaskTarget);
+0 −13
Original line number Diff line number Diff line
@@ -213,19 +213,6 @@ public abstract class BaseActivity extends Activity {
        return mForceInvisible != 0;
    }

    /**
     * Sets the device profile, adjusting it accordingly in case of multi-window
     */
    protected void setDeviceProfile(DeviceProfile dp) {
        mDeviceProfile = dp;
        if (isInMultiWindowModeCompat()) {
            Display display = getWindowManager().getDefaultDisplay();
            Point mwSize = new Point();
            display.getSize(mwSize);
            mDeviceProfile = mDeviceProfile.getMultiWindowProfile(this, mwSize);
        }
    }

    public interface MultiWindowModeChangedListener {
        void onMultiWindowModeChanged(boolean isInMultiWindowMode);
    }
Loading