blob: 6d392fc477203206f33d76adae5d295957d63887 [file] [log] [blame]
John Spurlock95a6fdf2013-03-20 15:38:18 -04001/*
2 * Copyright (C) 2013 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
John Spurlock52452482013-03-21 08:27:58 -040017package com.android.keyguard;
John Spurlock95a6fdf2013-03-20 15:38:18 -040018
19import android.content.Context;
20import android.util.AttributeSet;
21import android.view.MotionEvent;
22import android.view.View;
23import android.widget.LinearLayout;
24
John Spurlock52452482013-03-21 08:27:58 -040025import com.android.keyguard.R;
John Spurlock95a6fdf2013-03-20 15:38:18 -040026
27public class EmergencyCarrierArea extends LinearLayout {
28
29 private CarrierText mCarrierText;
30 private EmergencyButton mEmergencyButton;
31
32 public EmergencyCarrierArea(Context context) {
33 super(context);
34 }
35
36 public EmergencyCarrierArea(Context context, AttributeSet attrs) {
37 super(context, attrs);
38 }
39
40 @Override
41 protected void onFinishInflate() {
42 super.onFinishInflate();
43 mCarrierText = (CarrierText) findViewById(R.id.carrier_text);
44 mEmergencyButton = (EmergencyButton) findViewById(R.id.emergency_call_button);
45
46 // The emergency button overlaps the carrier text, only noticeable when highlighted.
47 // So temporarily hide the carrier text while the emergency button is pressed.
48 mEmergencyButton.setOnTouchListener(new OnTouchListener(){
49 @Override
50 public boolean onTouch(View v, MotionEvent event) {
51 switch(event.getAction()) {
52 case MotionEvent.ACTION_DOWN:
53 mCarrierText.animate().alpha(0);
54 break;
55 case MotionEvent.ACTION_UP:
56 mCarrierText.animate().alpha(1);
57 break;
58 }
59 return false;
60 }});
61 }
62}