blob: da1eff9741dafe0646cebb5bb4fead73c7990a6d [file] [log] [blame]
Sunny Goyalc4fa8c32017-11-07 12:23:58 -08001/*
2 * Copyright (C) 2017 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 */
16package com.android.launcher3.uioverrides;
17
18import static com.android.launcher3.WorkspaceStateTransitionAnimation.NO_ANIM_PROPERTY_SETTER;
19
20import android.animation.AnimatorSet;
21
22import com.android.launcher3.Launcher;
23import com.android.launcher3.LauncherState;
24import com.android.launcher3.LauncherStateManager.AnimationConfig;
25import com.android.launcher3.LauncherStateManager.StateHandler;
26import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter;
27import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter;
28import com.android.launcher3.anim.AnimationLayerSet;
29
30public class RecentsViewStateController implements StateHandler {
31
32 private final Launcher mLauncher;
33
34 public RecentsViewStateController(Launcher launcher) {
35 mLauncher = launcher;
36 }
37
38 @Override
39 public void setState(LauncherState state) {
40 setState(state, NO_ANIM_PROPERTY_SETTER);
41 }
42
43 @Override
44 public void setStateWithAnimation(LauncherState toState, AnimationLayerSet layerViews,
45 AnimatorSet anim, AnimationConfig config) {
46 setState(toState, new AnimatedPropertySetter(config.duration, layerViews, anim));
47 }
48
49 private void setState(LauncherState state, PropertySetter setter) {
50 setter.setViewAlpha(null, mLauncher.getOverviewPanel(),
51 state == LauncherState.OVERVIEW ? 1 : 0);
52 }
53}