Loading assets/quantum/res/drawable/quantum_ic_error_outline_vd_theme_36.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <!-- ~ 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. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="36dp" android:height="36dp" android:viewportWidth="36.0" android:viewportHeight="36.0" android:tint="?attr/colorControlNormal"> <group android:pivotX="12" android:pivotY="12" android:scaleX="1.5" android:scaleY="1.5" android:translateX="6" android:translateY="6"> <path android:fillColor="@android:color/white" android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/> </group> </vector> No newline at end of file java/com/android/incallui/calllocation/impl/LocationFragment.java +23 −5 Original line number Diff line number Diff line /* * 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. Loading Loading @@ -47,10 +47,12 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr private static final String ADDRESS_DELIMITER = ","; // Indexes used to animate fading between views private static final int LOADING_VIEW_INDEX = 0; // Indexes used to animate fading between views, 0 for LOADING_VIEW_INDEX private static final int LOCATION_VIEW_INDEX = 1; private static final long TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private static final int LOCATION_ERROR_INDEX = 2; private static final long FIND_LOCATION_SPINNING_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private static final long LOAD_DATA_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private ViewAnimator viewAnimator; private ImageView locationMap; Loading @@ -75,6 +77,14 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr showLocationNow(); }; private final Runnable spinningTimeoutRunnable = () -> { if (!(isAddressSet || isLocationSet || isMapSet)) { // No data received, show error viewAnimator.setDisplayedChild(LOCATION_ERROR_INDEX); } }; @Override public LocationPresenter createPresenter() { return new LocationPresenter(); Loading @@ -99,10 +109,17 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr return view; } @Override public void onStart() { super.onStart(); handler.postDelayed(spinningTimeoutRunnable, FIND_LOCATION_SPINNING_TIMEOUT_MILLIS); } @Override public void onDestroy() { super.onDestroy(); handler.removeCallbacks(dataTimeoutRunnable); handler.removeCallbacks(spinningTimeoutRunnable); } @Override Loading Loading @@ -167,13 +184,14 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr if (isMapSet && isAddressSet && isLocationSet) { showLocationNow(); } else if (!hasTimeoutStarted) { handler.postDelayed(dataTimeoutRunnable, TIMEOUT_MILLIS); handler.postDelayed(dataTimeoutRunnable, LOAD_DATA_TIMEOUT_MILLIS); hasTimeoutStarted = true; } } private void showLocationNow() { handler.removeCallbacks(dataTimeoutRunnable); handler.removeCallbacks(spinningTimeoutRunnable); if (viewAnimator.getDisplayedChild() != LOCATION_VIEW_INDEX) { viewAnimator.setDisplayedChild(LOCATION_VIEW_INDEX); viewAnimator.setOnClickListener(v -> launchMap()); Loading java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml +30 −0 Original line number Diff line number Diff line Loading @@ -130,4 +130,34 @@ </GridLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/location_error_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:orientation="vertical"> <ImageView android:id="@+id/location_error_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:layout_marginBottom="12dp" android:layout_gravity="center_horizontal" android:src="@drawable/quantum_ic_error_outline_vd_theme_36" android:tint="#C53929"/> <TextView android:id="@+id/location_error_text" style="@style/LocationErrorTextStyle" android:layout_width="match_parent" android:layout_height="24sp" android:layout_marginBottom="20dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:gravity="center" android:text="@string/location_error"/> </LinearLayout> </ViewAnimator> java/com/android/incallui/calllocation/impl/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -29,4 +29,7 @@ <!-- Progress indicator loading text. [CHAR LIMIT=20] --> <string name="location_loading">Finding your location…</string> <!-- Error message shown when we can't get device location. [CHAR LIMIT=NONE] --> <string name="location_error">Error, could not retrieve your location</string> </resources> java/com/android/incallui/calllocation/impl/res/values/styles.xml +21 −2 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2015 Google Inc. All Rights Reserved. --> <!-- ~ 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. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <resources> <style name="LocationAddressTitleTextStyle"> Loading @@ -25,4 +38,10 @@ <item name="android:textColor">#dd000000</item> <item name="android:fontFamily">sans-serif</item> </style> <style name="LocationErrorTextStyle"> <item name="android:textSize">14sp</item> <item name="android:textColor">#dd000000</item> <item name="android:fontFamily">sans-serif</item> </style> </resources> Loading
assets/quantum/res/drawable/quantum_ic_error_outline_vd_theme_36.xml 0 → 100644 +33 −0 Original line number Diff line number Diff line <!-- ~ 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. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <vector xmlns:android="http://schemas.android.com/apk/res/android" android:width="36dp" android:height="36dp" android:viewportWidth="36.0" android:viewportHeight="36.0" android:tint="?attr/colorControlNormal"> <group android:pivotX="12" android:pivotY="12" android:scaleX="1.5" android:scaleY="1.5" android:translateX="6" android:translateY="6"> <path android:fillColor="@android:color/white" android:pathData="M11,15h2v2h-2zM11,7h2v6h-2zM11.99,2C6.47,2 2,6.48 2,12s4.47,10 9.99,10C17.52,22 22,17.52 22,12S17.52,2 11.99,2zM12,20c-4.42,0 -8,-3.58 -8,-8s3.58,-8 8,-8 8,3.58 8,8 -3.58,8 -8,8z"/> </group> </vector> No newline at end of file
java/com/android/incallui/calllocation/impl/LocationFragment.java +23 −5 Original line number Diff line number Diff line /* * 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. Loading Loading @@ -47,10 +47,12 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr private static final String ADDRESS_DELIMITER = ","; // Indexes used to animate fading between views private static final int LOADING_VIEW_INDEX = 0; // Indexes used to animate fading between views, 0 for LOADING_VIEW_INDEX private static final int LOCATION_VIEW_INDEX = 1; private static final long TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private static final int LOCATION_ERROR_INDEX = 2; private static final long FIND_LOCATION_SPINNING_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private static final long LOAD_DATA_TIMEOUT_MILLIS = TimeUnit.SECONDS.toMillis(5); private ViewAnimator viewAnimator; private ImageView locationMap; Loading @@ -75,6 +77,14 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr showLocationNow(); }; private final Runnable spinningTimeoutRunnable = () -> { if (!(isAddressSet || isLocationSet || isMapSet)) { // No data received, show error viewAnimator.setDisplayedChild(LOCATION_ERROR_INDEX); } }; @Override public LocationPresenter createPresenter() { return new LocationPresenter(); Loading @@ -99,10 +109,17 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr return view; } @Override public void onStart() { super.onStart(); handler.postDelayed(spinningTimeoutRunnable, FIND_LOCATION_SPINNING_TIMEOUT_MILLIS); } @Override public void onDestroy() { super.onDestroy(); handler.removeCallbacks(dataTimeoutRunnable); handler.removeCallbacks(spinningTimeoutRunnable); } @Override Loading Loading @@ -167,13 +184,14 @@ public class LocationFragment extends BaseFragment<LocationPresenter, LocationPr if (isMapSet && isAddressSet && isLocationSet) { showLocationNow(); } else if (!hasTimeoutStarted) { handler.postDelayed(dataTimeoutRunnable, TIMEOUT_MILLIS); handler.postDelayed(dataTimeoutRunnable, LOAD_DATA_TIMEOUT_MILLIS); hasTimeoutStarted = true; } } private void showLocationNow() { handler.removeCallbacks(dataTimeoutRunnable); handler.removeCallbacks(spinningTimeoutRunnable); if (viewAnimator.getDisplayedChild() != LOCATION_VIEW_INDEX) { viewAnimator.setDisplayedChild(LOCATION_VIEW_INDEX); viewAnimator.setOnClickListener(v -> launchMap()); Loading
java/com/android/incallui/calllocation/impl/res/layout/location_fragment.xml +30 −0 Original line number Diff line number Diff line Loading @@ -130,4 +130,34 @@ </GridLayout> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:id="@+id/location_error_layout" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_gravity="center_vertical" android:orientation="vertical"> <ImageView android:id="@+id/location_error_icon" android:layout_width="wrap_content" android:layout_height="wrap_content" android:layout_marginTop="32dp" android:layout_marginBottom="12dp" android:layout_gravity="center_horizontal" android:src="@drawable/quantum_ic_error_outline_vd_theme_36" android:tint="#C53929"/> <TextView android:id="@+id/location_error_text" style="@style/LocationErrorTextStyle" android:layout_width="match_parent" android:layout_height="24sp" android:layout_marginBottom="20dp" android:layout_marginStart="16dp" android:layout_marginEnd="16dp" android:gravity="center" android:text="@string/location_error"/> </LinearLayout> </ViewAnimator>
java/com/android/incallui/calllocation/impl/res/values/strings.xml +3 −0 Original line number Diff line number Diff line Loading @@ -29,4 +29,7 @@ <!-- Progress indicator loading text. [CHAR LIMIT=20] --> <string name="location_loading">Finding your location…</string> <!-- Error message shown when we can't get device location. [CHAR LIMIT=NONE] --> <string name="location_error">Error, could not retrieve your location</string> </resources>
java/com/android/incallui/calllocation/impl/res/values/styles.xml +21 −2 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- Copyright 2015 Google Inc. All Rights Reserved. --> <!-- ~ 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. ~ You may obtain a copy of the License at ~ ~ http://www.apache.org/licenses/LICENSE-2.0 ~ ~ Unless required by applicable law or agreed to in writing, software ~ distributed under the License is distributed on an "AS IS" BASIS, ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. ~ See the License for the specific language governing permissions and ~ limitations under the License --> <resources> <style name="LocationAddressTitleTextStyle"> Loading @@ -25,4 +38,10 @@ <item name="android:textColor">#dd000000</item> <item name="android:fontFamily">sans-serif</item> </style> <style name="LocationErrorTextStyle"> <item name="android:textSize">14sp</item> <item name="android:textColor">#dd000000</item> <item name="android:fontFamily">sans-serif</item> </style> </resources>