• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2008 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;
18 
19 import android.content.Context;
20 import android.util.AttributeSet;
21 import android.view.Display;
22 import android.view.KeyEvent;
23 import android.view.WindowManager;
24 import android.widget.LinearLayout;
25 
26 
27 public class TrackingView extends LinearLayout {
28     final Display mDisplay;
29     StatusBarService mService;
30     boolean mTracking;
31     int mStartX, mStartY;
32 
TrackingView(Context context, AttributeSet attrs)33     public TrackingView(Context context, AttributeSet attrs) {
34         super(context, attrs);
35         mDisplay = ((WindowManager)context.getSystemService(
36                 Context.WINDOW_SERVICE)).getDefaultDisplay();
37     }
38 
39     @Override
onLayout(boolean changed, int left, int top, int right, int bottom)40     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
41         super.onLayout(changed, left, top, right, bottom);
42         mService.updateExpandedHeight();
43     }
44 
45     @Override
dispatchKeyEvent(KeyEvent event)46     public boolean dispatchKeyEvent(KeyEvent event) {
47         boolean down = event.getAction() == KeyEvent.ACTION_DOWN;
48         switch (event.getKeyCode()) {
49         case KeyEvent.KEYCODE_BACK:
50             if (down) {
51                 //mService.deactivate();
52             }
53             return true;
54         }
55         return super.dispatchKeyEvent(event);
56     }
57 
58     @Override
onAttachedToWindow()59     protected void onAttachedToWindow() {
60         super.onAttachedToWindow();
61         mService.onTrackingViewAttached();
62     }
63 }
64