• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 
17 package com.android.systemui.statusbar.notification.row;
18 
19 import android.content.Context;
20 import android.graphics.Rect;
21 import android.util.AttributeSet;
22 import android.view.ViewGroup;
23 
24 import com.android.systemui.statusbar.AlphaOptimizedButton;
25 import com.android.systemui.statusbar.notification.stack.NotificationStackScrollLayout;
26 
27 public class FooterViewButton extends AlphaOptimizedButton {
28 
FooterViewButton(Context context)29     public FooterViewButton(Context context) {
30         this(context, null);
31     }
32 
FooterViewButton(Context context, AttributeSet attrs)33     public FooterViewButton(Context context, AttributeSet attrs) {
34         this(context, attrs, 0);
35     }
36 
FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr)37     public FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr) {
38         this(context, attrs, defStyleAttr, 0);
39     }
40 
FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes)41     public FooterViewButton(Context context, AttributeSet attrs, int defStyleAttr,
42             int defStyleRes) {
43         super(context, attrs, defStyleAttr, defStyleRes);
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
getDrawingRect(Rect outRect)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     }
64 }
65