blob: e73b1736f33a18176c48e36238a21226aec69c37 [file] [log] [blame]
Rakesh Iyer1186faa2015-12-07 16:48:46 -08001/*
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
17package com.android.systemui.statusbar.car;
18
Brad Stenning078235b2017-12-18 08:25:10 -080019import android.app.UiModeManager;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080020import android.content.Context;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080021import android.util.AttributeSet;
Brad Stenning078235b2017-12-18 08:25:10 -080022import android.util.Log;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080023import android.view.View;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080024import android.widget.LinearLayout;
Brad Stenning38b46f82018-03-27 13:57:29 -070025import android.widget.TextView;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080026
Brad Stenning078235b2017-12-18 08:25:10 -080027import com.android.keyguard.AlphaOptimizedImageButton;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080028import com.android.systemui.R;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080029
Rakesh Iyer1186faa2015-12-07 16:48:46 -080030/**
31 * A custom navigation bar for the automotive use case.
32 * <p>
Victor Chan1c6d0582016-01-09 16:26:37 -080033 * The navigation bar in the automotive use case is more like a list of shortcuts, rendered
34 * in a linear layout.
Rakesh Iyer1186faa2015-12-07 16:48:46 -080035 */
Brad Stenning078235b2017-12-18 08:25:10 -080036class CarNavigationBarView extends LinearLayout {
Victor Chan1c6d0582016-01-09 16:26:37 -080037 private LinearLayout mNavButtons;
Brad Stenning078235b2017-12-18 08:25:10 -080038 private AlphaOptimizedImageButton mNotificationsButton;
39 private CarStatusBar mCarStatusBar;
Brad Stenning38b46f82018-03-27 13:57:29 -070040 private Context mContext;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080041
42 public CarNavigationBarView(Context context, AttributeSet attrs) {
43 super(context, attrs);
Brad Stenning38b46f82018-03-27 13:57:29 -070044 mContext = context;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080045 }
46
47 @Override
48 public void onFinishInflate() {
Alan Viverette51efddb2017-04-05 10:00:01 -040049 mNavButtons = findViewById(R.id.nav_buttons);
Brad Stenning078235b2017-12-18 08:25:10 -080050
51 mNotificationsButton = findViewById(R.id.notifications);
Brad Stenning38b46f82018-03-27 13:57:29 -070052 if (mNotificationsButton != null) {
53 mNotificationsButton.setOnClickListener(this::onNotificationsClick);
54 }
Rakesh Iyer1186faa2015-12-07 16:48:46 -080055 }
56
Brad Stenning078235b2017-12-18 08:25:10 -080057 void setStatusBar(CarStatusBar carStatusBar) {
58 mCarStatusBar = carStatusBar;
Rakesh Iyer1186faa2015-12-07 16:48:46 -080059 }
60
Brad Stenning078235b2017-12-18 08:25:10 -080061 protected void onNotificationsClick(View v) {
62 mCarStatusBar.togglePanel();
Brad Stenninge8a75682018-01-17 10:02:21 -080063 }
Rakesh Iyer1186faa2015-12-07 16:48:46 -080064}