• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright (C) 2021 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.car.cluster.home;
18 
19 import android.app.Activity;
20 import android.car.Car;
21 import android.car.cluster.ClusterActivityState;
22 import android.content.Intent;
23 import android.os.Bundle;
24 import android.util.Log;
25 import android.view.View;
26 
27 /**
28  * Skeleton Activity for Home UI in Cluster display.
29  */
30 public class ClusterHomeActivity extends Activity implements ClusterHomeActivityInterface {
31 
32     private static final String TAG = ClusterHomeActivity.class.getSimpleName();
33 
34     @Override
onCreate(Bundle savedInstanceState)35     public void onCreate(Bundle savedInstanceState) {
36         super.onCreate(savedInstanceState);
37 
38         View view = getLayoutInflater().inflate(R.layout.cluster_home_activity, /* root= */ null);
39         setContentView(view);
40         logIntent(getIntent());
41     }
42 
43     /**
44      * {@inheritDoc}
45      *
46      * <p>This activity is used for FULL mode only, thus always return {@code false}.
47      *    Use {@link ClusterHomeActivityLightMode} for the LIGHT mode.
48      */
49     @Override
isClusterInLightMode()50     public boolean isClusterInLightMode() {
51         return false;
52     }
53 
54     @Override
onNewIntent(Intent intent)55     protected void onNewIntent(Intent intent) {
56         super.onNewIntent(intent);
57         logIntent(intent);
58     }
59 
logIntent(Intent intent)60     private static void logIntent(Intent intent) {
61         Log.d(TAG, "Got Intent=" + intent);
62         if (intent.hasExtra(Car.CAR_EXTRA_CLUSTER_ACTIVITY_STATE)) {
63             Bundle extra = intent.getBundleExtra(Car.CAR_EXTRA_CLUSTER_ACTIVITY_STATE);
64             ClusterActivityState activityState = ClusterActivityState.fromBundle(extra);
65             Log.d(TAG, ">> ClusterActivityState=" + activityState);
66         }
67     }
68 }