1/*
2 * Copyright (C) 2014 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;
18
19import android.content.Context;
20import android.util.AttributeSet;
21import android.view.View;
22import android.widget.TextView;
23
24import com.android.systemui.R;
25import com.android.systemui.ViewInvertHelper;
26import com.android.systemui.statusbar.phone.NotificationPanelView;
27
28/**
29 * Container view for overflowing notification icons on Keyguard.
30 */
31public class NotificationOverflowContainer extends ActivatableNotificationView {
32
33    private NotificationOverflowIconsView mIconsView;
34    private ViewInvertHelper mViewInvertHelper;
35    private boolean mDark;
36    private View mContent;
37
38    public NotificationOverflowContainer(Context context, AttributeSet attrs) {
39        super(context, attrs);
40    }
41
42    @Override
43    protected void onFinishInflate() {
44        super.onFinishInflate();
45        mIconsView = (NotificationOverflowIconsView) findViewById(R.id.overflow_icons_view);
46        mIconsView.setMoreText((TextView) findViewById(R.id.more_text));
47        mIconsView.setOverflowIndicator(findViewById(R.id.more_icon_overflow));
48        mContent = findViewById(R.id.content);
49        mViewInvertHelper = new ViewInvertHelper(mContent,
50                NotificationPanelView.DOZE_ANIMATION_DURATION);
51    }
52
53    @Override
54    public void setDark(boolean dark, boolean fade, long delay) {
55        super.setDark(dark, fade, delay);
56        if (mDark == dark) return;
57        mDark = dark;
58        if (fade) {
59            mViewInvertHelper.fade(dark, delay);
60        } else {
61            mViewInvertHelper.update(dark);
62        }
63    }
64
65    @Override
66    protected View getContentView() {
67        return mContent;
68    }
69
70    public NotificationOverflowIconsView getIconsView() {
71        return mIconsView;
72    }
73
74    protected int getContentHeightFromActualHeight(int actualHeight) {
75        int realActualHeight = actualHeight;
76        if (hasBottomDecor()) {
77            realActualHeight -= getBottomDecorHeight();
78        }
79        realActualHeight = Math.max(getMinHeight(), realActualHeight);
80        return realActualHeight;
81    }
82}
83