blob: 76cfc84e8a7450276c80e945293870bed2480a12 [file] [log] [blame]
Michael Jurka2763be32011-02-24 11:19:57 -08001/*
2 * Copyright (C) 2011 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
17package com.android.launcher2;
18
Michael Jurkaabded662011-03-04 12:06:57 -080019import android.animation.Animator;
Michael Jurka2763be32011-02-24 11:19:57 -080020import android.content.Context;
21import android.util.AttributeSet;
22import android.widget.TabHost;
23
Michael Jurkaabded662011-03-04 12:06:57 -080024public class CustomizeTrayTabHost extends TabHost implements LauncherTransitionable {
25 private boolean mFirstLayout = true;
26
Michael Jurka2763be32011-02-24 11:19:57 -080027 public CustomizeTrayTabHost(Context context) {
28 super(context);
29 }
30
31 public CustomizeTrayTabHost(Context context, AttributeSet attrs) {
32 super(context, attrs);
33 }
34
35 @Override
Michael Jurkaabded662011-03-04 12:06:57 -080036 public void onLauncherTransitionStart(Animator animation) {
37 if (animation != null) {
38 setLayerType(LAYER_TYPE_HARDWARE, null);
39 // just a sanity check that we don't build a layer before a call to onLayout
40 if (!mFirstLayout) {
41 // force building the layer at the beginning of the animation, so you don't get a
42 // blip early in the animation
43 buildLayer();
44 }
45 }
Michael Jurka2763be32011-02-24 11:19:57 -080046 }
47
48 @Override
Michael Jurkaabded662011-03-04 12:06:57 -080049 public void onLauncherTransitionEnd(Animator animation) {
50 if (animation != null) {
51 setLayerType(LAYER_TYPE_NONE, null);
52 }
53 }
54
55 @Override
56 protected void onLayout(boolean changed, int l, int t, int r, int b) {
57 mFirstLayout = false;
58 super.onLayout(changed, l, t, r, b);
Michael Jurka2763be32011-02-24 11:19:57 -080059 }
60}