Home | History | Annotate | Download | only in fallback
      1 /*
      2  * Copyright (C) 2018 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 package com.android.quickstep.fallback;
     17 
     18 import android.content.Context;
     19 import android.graphics.Canvas;
     20 import android.graphics.Rect;
     21 import android.util.AttributeSet;
     22 import android.view.View;
     23 
     24 import com.android.launcher3.DeviceProfile;
     25 import com.android.quickstep.RecentsActivity;
     26 import com.android.quickstep.util.LayoutUtils;
     27 import com.android.quickstep.views.RecentsView;
     28 
     29 public class FallbackRecentsView extends RecentsView<RecentsActivity> {
     30 
     31     public FallbackRecentsView(Context context, AttributeSet attrs) {
     32         this(context, attrs, 0);
     33     }
     34 
     35     public FallbackRecentsView(Context context, AttributeSet attrs, int defStyleAttr) {
     36         super(context, attrs, defStyleAttr);
     37         setOverviewStateEnabled(true);
     38         getQuickScrubController().onFinishedTransitionToQuickScrub();
     39     }
     40 
     41     @Override
     42     protected void onAllTasksRemoved() {
     43         mActivity.startHome();
     44     }
     45 
     46     @Override
     47     public void onViewAdded(View child) {
     48         super.onViewAdded(child);
     49         updateEmptyMessage();
     50     }
     51 
     52     @Override
     53     public void onViewRemoved(View child) {
     54         super.onViewRemoved(child);
     55         updateEmptyMessage();
     56     }
     57 
     58     @Override
     59     public void draw(Canvas canvas) {
     60         maybeDrawEmptyMessage(canvas);
     61         super.draw(canvas);
     62     }
     63 
     64     @Override
     65     protected void getTaskSize(DeviceProfile dp, Rect outRect) {
     66         LayoutUtils.calculateFallbackTaskSize(getContext(), dp, outRect);
     67     }
     68 
     69     @Override
     70     public boolean shouldUseMultiWindowTaskSizeStrategy() {
     71         // Just use the activity task size for multi-window as well.
     72         return false;
     73     }
     74 }
     75