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

Commit 67c79578 authored by Winson's avatar Winson
Browse files

Fixing various layout issues when docking

- Fixing regression where we were scrolling to front immediately on 
  dragging-to-dock a task, we should only scroll to the front on 
  configuration change.
- Accounting for the inset when calculating the final stack bounds
  (similar to b/27921362)
- Fixing issue with task views being clipped as user drags a view due 
  to the bounds of the view changing.  We manually now set the frame on
  the view to the current stack task bounds.
- Simplifying calls to animate the task view bounds
- Removing old instance state code

Change-Id: I17d3e33e159ff250c11a504ef87558051926a974
parent 670ea71f
Loading
Loading
Loading
Loading
+33 −37
Original line number Diff line number Diff line
@@ -18,10 +18,6 @@
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:focusable="true">
    <FrameLayout
        android:id="@+id/task_view_content"
        android:layout_width="match_parent"
        android:layout_height="match_parent">
    <com.android.systemui.recents.views.TaskViewThumbnail
        android:id="@+id/task_view_thumbnail"
        android:layout_width="match_parent"
@@ -29,6 +25,7 @@

    <include layout="@layout/recents_task_view_header" />

    <!-- TODO: Move this into a view stub -->
    <com.android.systemui.statusbar.AlphaOptimizedFrameLayout
        android:id="@+id/lock_to_app_fab"
        android:layout_width="@dimen/recents_lock_to_app_size"
@@ -58,7 +55,6 @@
                android:layout_marginTop="48dp"
                android:layout_marginLeft="16dp"
                android:layout_marginRight="16dp" />
    </FrameLayout>
</com.android.systemui.recents.views.TaskView>

+8 −8
Original line number Diff line number Diff line
@@ -98,7 +98,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD

    private RecentsPackageMonitor mPackageMonitor;
    private long mLastTabKeyEventTime;
    private int mLastOrientation = Configuration.ORIENTATION_UNDEFINED;
    private int mLastDeviceOrientation = Configuration.ORIENTATION_UNDEFINED;
    private boolean mFinishedOnStartup;
    private boolean mIgnoreAltTabRelease;
    private boolean mIsVisible;
@@ -276,7 +276,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        getWindow().getAttributes().privateFlags |=
                WindowManager.LayoutParams.PRIVATE_FLAG_FORCE_DECOR_VIEW_VISIBILITY;

        mLastOrientation = getResources().getConfiguration().orientation;
        mLastDeviceOrientation = Utilities.getAppConfiguration(this).orientation;
        mFocusTimerDuration = getResources().getInteger(R.integer.recents_auto_advance_duration);
        mIterateTrigger = new DozeTrigger(mFocusTimerDuration, new Runnable() {
            @Override
@@ -426,13 +426,12 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    public void onConfigurationChanged(Configuration newConfig) {
        super.onConfigurationChanged(newConfig);


        // Notify of the config change
        int newOrientation = getResources().getConfiguration().orientation;
        int newDeviceOrientation = Utilities.getAppConfiguration(this).orientation;
        int numStackTasks = mRecentsView.getStack().getStackTaskCount();
        EventBus.getDefault().send(new ConfigurationChangedEvent(false /* fromMultiWindow */,
                (mLastOrientation != newOrientation), numStackTasks > 0));
        mLastOrientation = newOrientation;
                (mLastDeviceOrientation != newDeviceOrientation), numStackTasks > 0));
        mLastDeviceOrientation = newDeviceOrientation;
    }

    @Override
@@ -455,7 +454,7 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        int numStackTasks = stack.getStackTaskCount();

        EventBus.getDefault().send(new ConfigurationChangedEvent(true /* fromMultiWindow */,
                false /* fromOrientationChange */, numStackTasks > 0));
                false /* fromDeviceOrientationChange */, numStackTasks > 0));

        if (mRecentsView != null) {
            mRecentsView.updateStack(stack);
@@ -777,6 +776,8 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
    @Override
    public void dump(String prefix, FileDescriptor fd, PrintWriter writer, String[] args) {
        super.dump(prefix, fd, writer, args);
        EventBus.getDefault().dump(prefix, writer);

        String id = Integer.toHexString(System.identityHashCode(this));

        writer.print(prefix); writer.print(TAG);
@@ -787,6 +788,5 @@ public class RecentsActivity extends Activity implements ViewTreeObserver.OnPreD
        if (mRecentsView != null) {
            mRecentsView.dump(prefix, writer);
        }
        EventBus.getDefault().dump(prefix, writer);
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -689,7 +689,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener
            TaskStackViewScroller stackScroller = stackView.getScroller();

            stackView.updateLayoutAlgorithm(true /* boundScroll */);
            stackView.updateToInitialState(true /* scrollToInitialState */);
            stackView.updateToInitialState();

            for (int i = tasks.size() - 1; i >= 0; i--) {
                Task task = tasks.get(i);
@@ -742,7 +742,7 @@ public class RecentsImpl implements ActivityOptions.OnAnimationFinishedListener

        // Get the transform for the running task
        stackView.updateLayoutAlgorithm(true /* boundScroll */);
        stackView.updateToInitialState(true /* scrollToInitialState */);
        stackView.updateToInitialState();
        stackView.getStackAlgorithm().getStackTransformScreenCoordinates(launchTask,
                stackView.getScroller().getStackScroll(), mTmpTransform, null);
        return mTmpTransform;
+3 −3
Original line number Diff line number Diff line
@@ -24,13 +24,13 @@ import com.android.systemui.recents.events.EventBus;
public class ConfigurationChangedEvent extends EventBus.AnimatedEvent {

    public final boolean fromMultiWindow;
    public final boolean fromOrientationChange;
    public final boolean fromDeviceOrientationChange;
    public final boolean hasStackTasks;

    public ConfigurationChangedEvent(boolean fromMultiWindow, boolean fromOrientationChange,
    public ConfigurationChangedEvent(boolean fromMultiWindow, boolean fromDeviceOrientationChange,
            boolean hasStackTasks) {
        this.fromMultiWindow = fromMultiWindow;
        this.fromOrientationChange = fromOrientationChange;
        this.fromDeviceOrientationChange = fromDeviceOrientationChange;
        this.hasStackTasks = hasStackTasks;
    }
}
+12 −1
Original line number Diff line number Diff line
@@ -18,8 +18,11 @@ package com.android.systemui.recents.misc;

import android.animation.Animator;
import android.animation.AnimatorSet;
import android.animation.RectEvaluator;
import android.annotation.FloatRange;
import android.app.Activity;
import android.content.Context;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.graphics.Color;
import android.graphics.Rect;
@@ -71,7 +74,7 @@ public class Utilities {
            };

    public static final RectFEvaluator RECTF_EVALUATOR = new RectFEvaluator();

    public static final RectEvaluator RECT_EVALUATOR = new RectEvaluator(new Rect());
    public static final Rect EMPTY_RECT = new Rect();

    /**
@@ -269,6 +272,14 @@ public class Utilities {
        Trace.traceEnd(Trace.TRACE_TAG_VIEW);
    }

    /**
     * Returns the application configuration, which is independent of the activity's current
     * configuration in multiwindow.
     */
    public static Configuration getAppConfiguration(Context context) {
        return context.getApplicationContext().getResources().getConfiguration();
    }

    /**
     * Returns a lightweight dump of a rect.
     */
Loading