blob: e1c4a0c92ff0ed97fc621bac1ddabf692e2433a8 [file] [log] [blame]
Selim Cinek7d5f3742014-11-07 18:07:49 +01001/*
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
Rohan Shah20790b82018-07-02 17:21:04 -070017package com.android.systemui.statusbar.notification.row;
Selim Cinek7d5f3742014-11-07 18:07:49 +010018
19import android.content.Context;
Selim Cinek7d5f3742014-11-07 18:07:49 +010020import android.graphics.Rect;
Selim Cinek7d5f3742014-11-07 18:07:49 +010021import android.util.AttributeSet;
Selim Cinek7d5f3742014-11-07 18:07:49 +010022import android.view.ViewGroup;
Winsonc0d70582016-01-29 10:24:39 -080023
Rohan Shah20790b82018-07-02 17:21:04 -070024import com.android.systemui.statusbar.AlphaOptimizedButton;
25import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
Selim Cinek7d5f3742014-11-07 18:07:49 +010026
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040027public class FooterViewButton extends AlphaOptimizedButton {
Selim Cinek7d5f3742014-11-07 18:07:49 +010028
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040029 public FooterViewButton(Context context) {
Selim Cinek7d5f3742014-11-07 18:07:49 +010030 this(context, null);
31 }
32
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040033 public FooterViewButton(Context context, AttributeSet attrs) {
Selim Cinek7d5f3742014-11-07 18:07:49 +010034 this(context, attrs, 0);
35 }
36
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040037 public FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr) {
Selim Cinek7d5f3742014-11-07 18:07:49 +010038 this(context, attrs, defStyleAttr, 0);
39 }
40
Julia Reynoldsed1c9af2018-03-21 15:21:09 -040041 public FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr,
Selim Cinek7d5f3742014-11-07 18:07:49 +010042 int defStyleRes) {
43 super(context, attrs, defStyleAttr, defStyleRes);
Selim Cinek7d5f3742014-11-07 18:07:49 +010044 }
45
46 /**
47 * This method returns the drawing rect for the view which is different from the regular
48 * drawing rect, since we layout all children in the {@link NotificationStackScrollLayout} at
49 * position 0 and usually the translation is neglected. The standard implementation doesn't
50 * account for translation.
51 *
52 * @param outRect The (scrolled) drawing bounds of the view.
53 */
54 @Override
55 public void getDrawingRect(Rect outRect) {
56 super.getDrawingRect(outRect);
57 float translationX = ((ViewGroup) mParent).getTranslationX();
58 float translationY = ((ViewGroup) mParent).getTranslationY();
59 outRect.left += translationX;
60 outRect.right += translationX;
61 outRect.top += translationY;
62 outRect.bottom += translationY;
63 }
Selim Cinek7d5f3742014-11-07 18:07:49 +010064}