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

Commit 7ed9df29 authored by Winson Chung's avatar Winson Chung Committed by Android (Google) Code Review
Browse files

Merge "Initial changes to drag and drop to docked task."

parents cb347a35 be7607af
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -26,6 +26,7 @@ import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.pm.ActivityInfo;
import android.net.Uri;
import android.os.Bundle;
import android.os.SystemClock;
@@ -41,6 +42,8 @@ import com.android.systemui.recents.events.activity.AppWidgetProviderChangedEven
import com.android.systemui.recents.events.ui.DismissTaskEvent;
import com.android.systemui.recents.events.ui.ResizeTaskEvent;
import com.android.systemui.recents.events.ui.ShowApplicationInfoEvent;
import com.android.systemui.recents.events.ui.dragndrop.DragEndEvent;
import com.android.systemui.recents.events.ui.dragndrop.DragStartEvent;
import com.android.systemui.recents.misc.Console;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.misc.SystemServicesProxy;
@@ -612,6 +615,18 @@ public class RecentsActivity extends Activity implements RecentsView.RecentsView
        getResizeTaskDebugDialog().showResizeTaskDialog(event.task, mRecentsView);
    }

    public final void onBusEvent(DragStartEvent event) {
        // Lock the orientation while dragging
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);

        // TODO: docking requires custom accessibility actions
    }

    public final void onBusEvent(DragEndEvent event) {
        // Unlock the orientation when dragging completes
        setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_BEHIND);
    }

    private void refreshSearchWidgetView() {
        if (mSearchWidgetInfo != null) {
            SystemServicesProxy ssp = RecentsTaskLoader.getInstance().getSystemServicesProxy();
+3 −0
Original line number Diff line number Diff line
@@ -22,6 +22,7 @@ import android.graphics.Rect;
import android.provider.Settings;
import com.android.systemui.R;
import com.android.systemui.recents.misc.SystemServicesProxy;
import com.android.systemui.recents.model.RecentsTaskLoader;

/**
 * Application resources that can be retrieved from the application context and are not specifically
@@ -70,6 +71,7 @@ public class RecentsConfiguration {
    public final int smallestWidth;

    /** Misc **/
    public boolean hasDockedTasks;
    public boolean useHardwareLayers;
    public boolean fakeShadows;
    public int svelteLevel;
@@ -114,6 +116,7 @@ public class RecentsConfiguration {
        lockToAppEnabled = ssp.getSystemSetting(context,
                Settings.System.LOCK_TO_APP_ENABLED) != 0;
        multiWindowEnabled = "true".equals(ssp.getSystemProperty("persist.sys.debug.multi_window"));
        hasDockedTasks = ssp.hasDockedTask();

        // Recompute some values based on the given state, since we can not rely on the resource
        // system to get certain values.
+35 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.systemui.recents.events.ui.dragndrop;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;

/**
 * This event is sent when a user drag enters or exits a dock region.
 */
public class DragDockStateChangedEvent extends EventBus.Event {

    public final Task task;
    public final TaskStack.DockState dockState;

    public DragDockStateChangedEvent(Task task, TaskStack.DockState dockState) {
        this.task = task;
        this.dockState = dockState;
    }
}
+45 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.systemui.recents.events.ui.dragndrop;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.misc.ReferenceCountedTrigger;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.model.TaskStack;
import com.android.systemui.recents.views.DragView;
import com.android.systemui.recents.views.TaskView;

/**
 * This event is sent whenever a drag ends.
 */
public class DragEndEvent extends EventBus.Event {

    public final Task task;
    public final TaskView taskView;
    public final DragView dragView;
    public final TaskStack.DockState dockState;
    public final ReferenceCountedTrigger postAnimationTrigger;

    public DragEndEvent(Task task, TaskView taskView, DragView dragView,
            TaskStack.DockState dockState, ReferenceCountedTrigger postAnimationTrigger) {
        this.task = task;
        this.taskView = taskView;
        this.dragView = dragView;
        this.dockState = dockState;
        this.postAnimationTrigger = postAnimationTrigger;
    }
}
+38 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 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.systemui.recents.events.ui.dragndrop;

import com.android.systemui.recents.events.EventBus;
import com.android.systemui.recents.model.Task;
import com.android.systemui.recents.views.DragView;
import com.android.systemui.recents.views.TaskView;

/**
 * This event is sent whenever a drag starts.
 */
public class DragStartEvent extends EventBus.Event {

    public final Task task;
    public final TaskView taskView;
    public final DragView dragView;

    public DragStartEvent(Task task, TaskView taskView, DragView dragView) {
        this.task = task;
        this.taskView = taskView;
        this.dragView = dragView;
    }
}
Loading