blob: 9ecb2e43146dcb8af9c455e15887f8aecebe19fb [file] [log] [blame]
Joe Onorato7c270fa2010-12-08 17:31:42 -08001/*
2 * Copyright (C) 2010 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.systemui.statusbar.tablet;
18
19import android.animation.Animator;
20import android.animation.ObjectAnimator;
21import android.animation.ValueAnimator;
22import android.content.Context;
23import android.content.res.Resources;
24import android.content.res.TypedArray;
25import android.graphics.Canvas;
26import android.graphics.Rect;
27import android.graphics.drawable.Drawable;
28import android.util.AttributeSet;
29import android.util.Slog;
30import android.view.LayoutInflater;
31import android.view.View;
32import android.view.ViewGroup;
33import android.view.animation.AccelerateInterpolator;
34import android.widget.FrameLayout;
35import android.widget.ImageView;
36import android.widget.LinearLayout;
37import android.widget.TextView;
38
39import com.android.systemui.R;
40
41public class NotificationLinearLayout extends LinearLayout {
42 private static final String TAG = "NotificationLinearLayout";
43
44 Drawable mItemGlow;
45 int mInsetLeft;
46 Rect mTmp = new Rect();
47
48 public NotificationLinearLayout(Context context, AttributeSet attrs) {
49 this(context, attrs, 0);
50 }
51
52 public NotificationLinearLayout(Context context, AttributeSet attrs, int defStyle) {
53 super(context, attrs, defStyle);
54
55 final Resources res = context.getResources();
56
57 mItemGlow = res.getDrawable(R.drawable.notify_item_glow_bottom);
58
59 TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.NotificationLinearLayout,
60 defStyle, 0);
61 mInsetLeft = a.getDimensionPixelSize(R.styleable.NotificationLinearLayout_insetLeft, 0);
62 a.recycle();
63 }
64
65 @Override
66 public void onFinishInflate() {
67 super.onFinishInflate();
68 setWillNotDraw(false);
69 }
70
71 @Override
72 public void onDraw(Canvas canvas) {
73 super.onDraw(canvas);
74
75 final Rect padding = mTmp;
76 final Drawable glow = mItemGlow;
77 glow.getPadding(padding);
78 final int glowHeight = glow.getIntrinsicHeight();
79 final int insetLeft = mInsetLeft;
80
81 final int N = getChildCount();
82 for (int i=0; i<N; i++) {
83 final View child = getChildAt(i);
84
85 final int childBottom = child.getBottom();
86
87 glow.setBounds(child.getLeft() - padding.left + insetLeft, childBottom,
88 child.getRight() - padding.right, childBottom + glowHeight);
89 glow.draw(canvas);
90 }
91 }
92}