Soonil Nagarkar | 574c2bf | 2021-05-19 17:15:23 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 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 androidx.core.location; |
| 18 | |
Alan Viverette | 553710d | 2022-01-14 14:09:34 -0500 | [diff] [blame] | 19 | import android.location.Location; |
Soonil Nagarkar | 574c2bf | 2021-05-19 17:15:23 -0700 | [diff] [blame] | 20 | import android.location.LocationListener; |
| 21 | import android.os.Bundle; |
| 22 | |
| 23 | import androidx.annotation.NonNull; |
| 24 | import androidx.annotation.Nullable; |
| 25 | |
Alan Viverette | 553710d | 2022-01-14 14:09:34 -0500 | [diff] [blame] | 26 | import java.util.List; |
| 27 | |
Soonil Nagarkar | 574c2bf | 2021-05-19 17:15:23 -0700 | [diff] [blame] | 28 | /** |
| 29 | * A version of {@link LocationListener} suitable for use on all API levels. |
| 30 | */ |
| 31 | public interface LocationListenerCompat extends LocationListener { |
| 32 | |
| 33 | @Override |
| 34 | default void onStatusChanged(@NonNull String provider, int status, @Nullable Bundle extras) {} |
| 35 | |
| 36 | @Override |
| 37 | default void onProviderEnabled(@NonNull String provider) {} |
| 38 | |
| 39 | @Override |
| 40 | default void onProviderDisabled(@NonNull String provider) {} |
Alan Viverette | 553710d | 2022-01-14 14:09:34 -0500 | [diff] [blame] | 41 | |
| 42 | @Override |
| 43 | default void onLocationChanged(@NonNull List<Location> locations) { |
| 44 | final int size = locations.size(); |
| 45 | for (int i = 0; i < size; i++) { |
| 46 | onLocationChanged(locations.get(i)); |
| 47 | } |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | default void onFlushComplete(int requestCode) {} |
Soonil Nagarkar | 574c2bf | 2021-05-19 17:15:23 -0700 | [diff] [blame] | 52 | } |