1d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev/* 2d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Copyright (C) 2016 The Android Open Source Project 3d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 4d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Licensed under the Apache License, Version 2.0 (the "License"); 5d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * you may not use this file except in compliance with the License. 6d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * You may obtain a copy of the License at 7d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 8d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * http://www.apache.org/licenses/LICENSE-2.0 9d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 10d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Unless required by applicable law or agreed to in writing, software 11d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * distributed under the License is distributed on an "AS IS" BASIS, 12d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * See the License for the specific language governing permissions and 14d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * limitations under the License. 15d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 161ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevpackage android.car.cluster.renderer; 17d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 181ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevimport android.annotation.Nullable; 19d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevimport android.annotation.SystemApi; 201ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevimport android.annotation.UiThread; 21d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevimport android.car.navigation.CarNavigationInstrumentCluster; 22d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevimport android.content.Context; 231ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsevimport android.view.View; 24d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 25d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev/** 26d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Interface for instrument cluster rendering. 27d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 28d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * TODO: implement instrument cluster feature list and extend API. 29d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * 30d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * @hide 31d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 32d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev@SystemApi 33d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsevpublic abstract class InstrumentClusterRenderer { 34d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 351ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @Nullable private NavigationRenderer mNavigationRenderer; 36d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 37d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev /** 38d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Calls once when instrument cluster should be created. 39d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 401ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev abstract public void onCreate(Context context); 41d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 421ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @UiThread 431ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev abstract public View onCreateView(DisplayConfiguration displayConfiguration); 441ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev 451ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @UiThread 46d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract public void onStart(); 47d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 481ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @UiThread 49d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract public void onStop(); 50d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 51d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev /** 52d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev * Returns properties of instrument cluster for navigation. 53d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev */ 54d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract public CarNavigationInstrumentCluster getNavigationProperties(); 55d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 561ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @UiThread 57d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev abstract protected NavigationRenderer createNavigationRenderer(); 58d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev 591ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev /** The method is thread-safe, callers should cache returned object. */ 601ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @Nullable 611ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev public synchronized NavigationRenderer getNavigationRenderer() { 62d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev return mNavigationRenderer; 63d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev } 641ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev 651ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev /** 661ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev * This method is called by car service after onCreateView to initialize private members. The 671ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev * method should not be overridden by subclasses. 681ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev */ 691ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev @UiThread 701ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev public synchronized final void initialize() { 711ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev mNavigationRenderer = createNavigationRenderer(); 721ecdd6ca75fdf8ff62105630664de5125e29676bPavel Maltsev } 73d644c8715c839ccdcbd76fcf9cc27705b5399f7aPavel Maltsev} 74