Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 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 | |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 17 | package com.android.systemui.statusbar.notification.row; |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 18 | |
| 19 | import android.content.Context; |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 20 | import android.graphics.Rect; |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 21 | import android.util.AttributeSet; |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 22 | import android.view.ViewGroup; |
Winson | c0d7058 | 2016-01-29 10:24:39 -0800 | [diff] [blame] | 23 | |
Rohan Shah | 20790b8 | 2018-07-02 17:21:04 -0700 | [diff] [blame] | 24 | import com.android.systemui.statusbar.AlphaOptimizedButton; |
| 25 | import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout; |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 26 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 27 | public class FooterViewButton extends AlphaOptimizedButton { |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 28 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 29 | public FooterViewButton(Context context) { |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 30 | this(context, null); |
| 31 | } |
| 32 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 33 | public FooterViewButton(Context context, AttributeSet attrs) { |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 34 | this(context, attrs, 0); |
| 35 | } |
| 36 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 37 | public FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr) { |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 38 | this(context, attrs, defStyleAttr, 0); |
| 39 | } |
| 40 | |
Julia Reynolds | ed1c9af | 2018-03-21 15:21:09 -0400 | [diff] [blame] | 41 | public FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr, |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 42 | int defStyleRes) { |
| 43 | super(context, attrs, defStyleAttr, defStyleRes); |
Selim Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 44 | } |
| 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 Cinek | 7d5f374 | 2014-11-07 18:07:49 +0100 | [diff] [blame] | 64 | } |