Pavel Maltsev | 8cf8691 | 2016-04-01 18:01:51 -0700 | [diff] [blame^] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | package android.car.cluster.loggingrenderer; |
| 17 | |
| 18 | import android.car.cluster.renderer.InstrumentClusterRenderer; |
| 19 | import android.car.cluster.renderer.NavigationRenderer; |
| 20 | import android.car.navigation.CarNavigationInstrumentCluster; |
| 21 | import android.content.Context; |
| 22 | import android.graphics.Bitmap; |
| 23 | import android.util.Log; |
| 24 | |
| 25 | /** |
| 26 | * Dummy implementation of {@code InstrumentClusterRenderer} that just traces all interaction. |
| 27 | */ |
| 28 | public class LoggingInstrumentClusterRenderer extends InstrumentClusterRenderer { |
| 29 | |
| 30 | private final static String TAG = LoggingInstrumentClusterRenderer.class.getSimpleName(); |
| 31 | |
| 32 | @Override |
| 33 | public void onCreate(Context context) { |
| 34 | Log.i(TAG, "onCreate, context: " + context); |
| 35 | } |
| 36 | |
| 37 | @Override |
| 38 | public void onStart() { |
| 39 | Log.i(TAG, "onStart"); |
| 40 | } |
| 41 | |
| 42 | @Override |
| 43 | public void onStop() { |
| 44 | Log.i(TAG, "onStop"); |
| 45 | } |
| 46 | |
| 47 | @Override |
| 48 | protected NavigationRenderer createNavigationRenderer() { |
| 49 | NavigationRenderer navigationRenderer = new NavigationRenderer() { |
| 50 | @Override |
| 51 | public CarNavigationInstrumentCluster getNavigationProperties() { |
| 52 | Log.i(TAG, "getNavigationProperties"); |
| 53 | CarNavigationInstrumentCluster config = |
| 54 | CarNavigationInstrumentCluster.createCluster(1000); |
| 55 | Log.i(TAG, "getNavigationProperties, returns: " + config); |
| 56 | return config; |
| 57 | } |
| 58 | |
| 59 | |
| 60 | @Override |
| 61 | public void onStartNavigation() { |
| 62 | Log.i(TAG, "onStartNavigation"); |
| 63 | } |
| 64 | |
| 65 | @Override |
| 66 | public void onStopNavigation() { |
| 67 | Log.i(TAG, "onStopNavigation"); |
| 68 | } |
| 69 | |
| 70 | @Override |
| 71 | public void onNextTurnChanged(int event, String road, int turnAngle, int turnNumber, |
| 72 | Bitmap image, int turnSide) { |
| 73 | Log.i(TAG, "event: " + event + ", road: " + road + ", turnAngle: " + turnAngle |
| 74 | + ", turnNumber: " + turnNumber + ", image: " + image + ", turnSide: " |
| 75 | + turnSide); |
| 76 | } |
| 77 | |
| 78 | @Override |
| 79 | public void onNextTurnDistanceChanged(int distanceMeters, int timeSeconds) { |
| 80 | Log.i(TAG, "onNextTurnDistanceChanged, distanceMeters: " + distanceMeters |
| 81 | + ", timeSeconds: " + timeSeconds); |
| 82 | } |
| 83 | }; |
| 84 | |
| 85 | Log.i(TAG, "createNavigationRenderer, returns: " + navigationRenderer); |
| 86 | return navigationRenderer; |
| 87 | } |
| 88 | } |