1package com.android.server.status;
2
3import android.content.Context;
4import android.util.AttributeSet;
5import android.view.Display;
6import android.view.KeyEvent;
7import android.view.MotionEvent;
8import android.view.WindowManager;
9import android.widget.LinearLayout;
10import android.util.Log;
11
12
13public class ExpandedView extends LinearLayout {
14    final Display mDisplay;
15    StatusBarService mService;
16    boolean mTracking;
17    int mStartX, mStartY;
18    int mMaxHeight = 0;
19    int mPrevHeight = -1;
20
21    public ExpandedView(Context context, AttributeSet attrs) {
22        super(context, attrs);
23        mDisplay = ((WindowManager)context.getSystemService(
24                Context.WINDOW_SERVICE)).getDefaultDisplay();
25    }
26
27    @Override
28    protected void onFinishInflate() {
29        super.onFinishInflate();
30    }
31
32    /** We want to shrink down to 0, and ignore the background. */
33    @Override
34    public int getSuggestedMinimumHeight() {
35        return 0;
36    }
37
38    @Override
39    protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) {
40        super.onMeasure(widthMeasureSpec,
41                MeasureSpec.makeMeasureSpec(mMaxHeight, MeasureSpec.AT_MOST));
42    }
43
44    @Override
45     protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
46         super.onLayout(changed, left, top, right, bottom);
47         int height = bottom - top;
48         if (height != mPrevHeight) {
49             //Log.d(StatusBarService.TAG, "height changed old=" + mPrevHeight + " new=" + height);
50             mPrevHeight = height;
51             mService.updateExpandedViewPos(StatusBarService.EXPANDED_LEAVE_ALONE);
52         }
53     }
54
55    void setMaxHeight(int h) {
56        if (h != mMaxHeight) {
57            mMaxHeight = h;
58            requestLayout();
59        }
60    }
61}
62