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

Commit e66b38c0 authored by Raj Yengisetty's avatar Raj Yengisetty
Browse files

SystemUI: Re-add clear all recents button hooks

Change-Id: I3eebdd146127f0c0189c7669718355e1df77659d
parent 034d65d6
Loading
Loading
Loading
Loading
+35 −0
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.recents.views;

import android.app.ActivityOptions;
import android.app.TaskStackBuilder;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.graphics.Bitmap;
@@ -332,6 +333,40 @@ public class RecentsView extends FrameLayout implements TaskStackView.TaskStackV
        setMeasuredDimension(width, height);
    }

    public void noUserInteraction() {
        if (mClearRecents != null) {
            mClearRecents.setVisibility(View.VISIBLE);
        }
    }

    @Override
    protected void onAttachedToWindow () {
        super.onAttachedToWindow();
        if (getResources().getBoolean(R.bool.config_showRecentsTopButtons)) {
            mClearRecents = ((View)getParent()).findViewById(R.id.recents_clear);
            View taskManagerView = ((View)getParent()).findViewById(R.id.task_manager);
            if (taskManagerView != null) {
                taskManagerView.setOnClickListener(new OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        Intent intent = new Intent();
                        intent.setComponent(new ComponentName(
                                "com.android.systemui",
                                "com.android.systemui.recents.TaskManagerActivity"));
                        getContext().startActivity(intent);
                    }
                });
            }
        } else {
            mClearRecents = ((View)getParent()).findViewById(R.id.clear_recents);
        }
        mClearRecents.setOnClickListener(new View.OnClickListener() {
            public void onClick(View v) {
                dismissAllTasksAnimated();
            }
        });
    }

    /**
     * This is called with the full size of the window since we are handling our own insets.
     */