Sunny Goyal | c4fa8c3 | 2017-11-07 12:23:58 -0800 | [diff] [blame^] | 1 | /* |
| 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 | */ |
| 16 | package com.android.launcher3.uioverrides; |
| 17 | |
| 18 | import static com.android.launcher3.WorkspaceStateTransitionAnimation.NO_ANIM_PROPERTY_SETTER; |
| 19 | |
| 20 | import android.animation.AnimatorSet; |
| 21 | |
| 22 | import com.android.launcher3.Launcher; |
| 23 | import com.android.launcher3.LauncherState; |
| 24 | import com.android.launcher3.LauncherStateManager.AnimationConfig; |
| 25 | import com.android.launcher3.LauncherStateManager.StateHandler; |
| 26 | import com.android.launcher3.WorkspaceStateTransitionAnimation.AnimatedPropertySetter; |
| 27 | import com.android.launcher3.WorkspaceStateTransitionAnimation.PropertySetter; |
| 28 | import com.android.launcher3.anim.AnimationLayerSet; |
| 29 | |
| 30 | public 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 | } |