From 7642b8011e00bf353504440754ffa3f3a7cd8f8c Mon Sep 17 00:00:00 2001 From: yueg Date: Wed, 21 Mar 2018 12:14:04 -0700 Subject: Show error when finding location time out. If we get no location data for emergency call, we used to show spinner forever. This change shows error after 5s with no data, but still tries to get location. Test: LocationFragmentTest PiperOrigin-RevId: 189946803 Change-Id: Iaa0b429eec806337b9ab9cae3ca95e737fc667bf --- .../quantum_ic_error_outline_vd_theme_36.xml | 33 ++++++++++++++++++++++ .../calllocation/impl/LocationFragment.java | 28 ++++++++++++++---- .../impl/res/layout/location_fragment.xml | 30 ++++++++++++++++++++ .../calllocation/impl/res/values/strings.xml | 3 ++ .../calllocation/impl/res/values/styles.xml | 23 +++++++++++++-- 5 files changed, 110 insertions(+), 7 deletions(-) create mode 100644 assets/quantum/res/drawable/quantum_ic_error_outline_vd_theme_36.xml diff --git a/assets/quantum/res/drawable/quantum_ic_error_outline_vd_theme_36.xml b/assets/quantum/res/drawable/quantum_ic_error_outline_vd_theme_36.xml new file mode 100644 index 000000000..df4dc3299 --- /dev/null +++ b/assets/quantum/res/drawable/quantum_ic_error_outline_vd_theme_36.xml @@ -0,0 +1,33 @@ + + + + + + \ No newline at end of file diff --git a/java/com/android/incallui/calllocation/impl/LocationFragment.java b/java/com/android/incallui/calllocation/impl/LocationFragment.java index 77e4f7f7d..6b2c876b0 100644 --- a/java/com/android/incallui/calllocation/impl/LocationFragment.java +++ b/java/com/android/incallui/calllocation/impl/LocationFragment.java @@ -1,5 +1,5 @@ /* - * Copyright (C) 2017 The Android Open Source Project + * Copyright (C) 2018 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -47,10 +47,12 @@ public class LocationFragment extends BaseFragment { + if (!(isAddressSet || isLocationSet || isMapSet)) { + // No data received, show error + viewAnimator.setDisplayedChild(LOCATION_ERROR_INDEX); + } + }; + @Override public LocationPresenter createPresenter() { return new LocationPresenter(); @@ -99,10 +109,17 @@ public class LocationFragment extends BaseFragment launchMap()); diff --git a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml b/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml index b1601f9fd..d20e32b3f 100644 --- a/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml +++ b/java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml @@ -130,4 +130,34 @@ + + + + + + + + diff --git a/java/com/android/incallui/calllocation/impl/res/values/strings.xml b/java/com/android/incallui/calllocation/impl/res/values/strings.xml index 573f33cda..732b4efbd 100644 --- a/java/com/android/incallui/calllocation/impl/res/values/strings.xml +++ b/java/com/android/incallui/calllocation/impl/res/values/strings.xml @@ -29,4 +29,7 @@ Finding your location… + + Error, could not retrieve your location + diff --git a/java/com/android/incallui/calllocation/impl/res/values/styles.xml b/java/com/android/incallui/calllocation/impl/res/values/styles.xml index 866a4edb6..45e9c98d4 100644 --- a/java/com/android/incallui/calllocation/impl/res/values/styles.xml +++ b/java/com/android/incallui/calllocation/impl/res/values/styles.xml @@ -1,5 +1,18 @@ - - + + + -- cgit v1.2.3