1 /* 2 * Copyright (C) 2007 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.keyguard; 18 19 import android.content.Context; 20 import android.graphics.Canvas; 21 import android.util.AttributeSet; 22 import android.widget.FrameLayout; 23 24 /** 25 * Base class for keyguard view. {@link #reset} is where you should 26 * reset the state of your view. Use the {@link KeyguardViewCallback} via 27 * {@link #getCallback()} to send information back (such as poking the wake lock, 28 * or finishing the keyguard). 29 * 30 * Handles intercepting of media keys that still work when the keyguard is 31 * showing. 32 */ 33 public class KeyguardHostView extends FrameLayout { 34 35 protected ViewMediatorCallback mViewMediatorCallback; 36 37 KeyguardHostView(Context context)38 public KeyguardHostView(Context context) { 39 this(context, null); 40 } 41 KeyguardHostView(Context context, AttributeSet attrs)42 public KeyguardHostView(Context context, AttributeSet attrs) { 43 super(context, attrs); 44 } 45 46 @Override dispatchDraw(Canvas canvas)47 protected void dispatchDraw(Canvas canvas) { 48 super.dispatchDraw(canvas); 49 if (mViewMediatorCallback != null) { 50 mViewMediatorCallback.keyguardDoneDrawing(); 51 } 52 } 53 setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback)54 public void setViewMediatorCallback(ViewMediatorCallback viewMediatorCallback) { 55 mViewMediatorCallback = viewMediatorCallback; 56 } 57 } 58