Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015 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.car; |
| 18 | |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 19 | import android.app.UiModeManager; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 20 | import android.content.Context; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 21 | import android.util.AttributeSet; |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 22 | import android.util.Log; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 23 | import android.view.View; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 24 | import android.widget.LinearLayout; |
Brad Stenning | 38b46f8 | 2018-03-27 13:57:29 -0700 | [diff] [blame^] | 25 | import android.widget.TextView; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 26 | |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 27 | import com.android.keyguard.AlphaOptimizedImageButton; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 28 | import com.android.systemui.R; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 29 | |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 30 | /** |
| 31 | * A custom navigation bar for the automotive use case. |
| 32 | * <p> |
Victor Chan | 1c6d058 | 2016-01-09 16:26:37 -0800 | [diff] [blame] | 33 | * The navigation bar in the automotive use case is more like a list of shortcuts, rendered |
| 34 | * in a linear layout. |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 35 | */ |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 36 | class CarNavigationBarView extends LinearLayout { |
Victor Chan | 1c6d058 | 2016-01-09 16:26:37 -0800 | [diff] [blame] | 37 | private LinearLayout mNavButtons; |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 38 | private AlphaOptimizedImageButton mNotificationsButton; |
| 39 | private CarStatusBar mCarStatusBar; |
Brad Stenning | 38b46f8 | 2018-03-27 13:57:29 -0700 | [diff] [blame^] | 40 | private Context mContext; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 41 | |
| 42 | public CarNavigationBarView(Context context, AttributeSet attrs) { |
| 43 | super(context, attrs); |
Brad Stenning | 38b46f8 | 2018-03-27 13:57:29 -0700 | [diff] [blame^] | 44 | mContext = context; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 45 | } |
| 46 | |
| 47 | @Override |
| 48 | public void onFinishInflate() { |
Alan Viverette | 51efddb | 2017-04-05 10:00:01 -0400 | [diff] [blame] | 49 | mNavButtons = findViewById(R.id.nav_buttons); |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 50 | |
| 51 | mNotificationsButton = findViewById(R.id.notifications); |
Brad Stenning | 38b46f8 | 2018-03-27 13:57:29 -0700 | [diff] [blame^] | 52 | if (mNotificationsButton != null) { |
| 53 | mNotificationsButton.setOnClickListener(this::onNotificationsClick); |
| 54 | } |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 55 | } |
| 56 | |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 57 | void setStatusBar(CarStatusBar carStatusBar) { |
| 58 | mCarStatusBar = carStatusBar; |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 59 | } |
| 60 | |
Brad Stenning | 078235b | 2017-12-18 08:25:10 -0800 | [diff] [blame] | 61 | protected void onNotificationsClick(View v) { |
| 62 | mCarStatusBar.togglePanel(); |
Brad Stenning | e8a7568 | 2018-01-17 10:02:21 -0800 | [diff] [blame] | 63 | } |
Rakesh Iyer | 1186faa | 2015-12-07 16:48:46 -0800 | [diff] [blame] | 64 | } |