Justin Klaassen | 4d01eea | 2018-04-03 23:21:57 -0400 | [diff] [blame] | 1 | /* |
| 2 | * Copyright 2018 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.slice; |
| 18 | |
| 19 | import static androidx.slice.widget.SliceLiveData.SUPPORTED_SPECS; |
| 20 | |
| 21 | import android.content.Context; |
| 22 | import android.content.Intent; |
| 23 | import android.net.Uri; |
| 24 | |
| 25 | import androidx.annotation.NonNull; |
| 26 | import androidx.annotation.Nullable; |
| 27 | import androidx.annotation.RestrictTo; |
| 28 | import androidx.slice.compat.SliceProviderCompat; |
| 29 | import androidx.slice.widget.SliceLiveData; |
| 30 | |
Justin Klaassen | b8042fc | 2018-04-15 00:41:15 -0400 | [diff] [blame] | 31 | import java.util.Collection; |
Justin Klaassen | 4d01eea | 2018-04-03 23:21:57 -0400 | [diff] [blame] | 32 | import java.util.Set; |
| 33 | |
| 34 | |
| 35 | /** |
| 36 | * @hide |
| 37 | */ |
| 38 | @RestrictTo(RestrictTo.Scope.LIBRARY) |
| 39 | class SliceManagerCompat extends SliceManagerBase { |
| 40 | |
| 41 | SliceManagerCompat(Context context) { |
| 42 | super(context); |
| 43 | } |
| 44 | |
| 45 | @Override |
| 46 | public void pinSlice(@NonNull Uri uri) { |
| 47 | SliceProviderCompat.pinSlice(mContext, uri, SliceLiveData.SUPPORTED_SPECS); |
| 48 | } |
| 49 | |
| 50 | @Override |
| 51 | public void unpinSlice(@NonNull Uri uri) { |
| 52 | SliceProviderCompat.unpinSlice(mContext, uri, SliceLiveData.SUPPORTED_SPECS); |
| 53 | } |
| 54 | |
| 55 | @Override |
| 56 | public @NonNull Set<SliceSpec> getPinnedSpecs(@NonNull Uri uri) { |
| 57 | return SliceProviderCompat.getPinnedSpecs(mContext, uri); |
| 58 | } |
| 59 | |
| 60 | @Nullable |
| 61 | @Override |
| 62 | public Slice bindSlice(@NonNull Uri uri) { |
| 63 | return SliceProviderCompat.bindSlice(mContext, uri, SUPPORTED_SPECS); |
| 64 | } |
| 65 | |
| 66 | @Nullable |
| 67 | @Override |
| 68 | public Slice bindSlice(@NonNull Intent intent) { |
| 69 | return SliceProviderCompat.bindSlice(mContext, intent, SUPPORTED_SPECS); |
| 70 | } |
| 71 | |
| 72 | @Nullable |
| 73 | @Override |
| 74 | public Uri mapIntentToUri(@NonNull Intent intent) { |
| 75 | return SliceProviderCompat.mapIntentToUri(mContext, intent); |
| 76 | } |
Justin Klaassen | b8042fc | 2018-04-15 00:41:15 -0400 | [diff] [blame] | 77 | |
| 78 | @Override |
| 79 | public Collection<Uri> getSliceDescendants(Uri uri) { |
| 80 | return SliceProviderCompat.getSliceDescendants(mContext, uri); |
| 81 | } |
Justin Klaassen | 4d01eea | 2018-04-03 23:21:57 -0400 | [diff] [blame] | 82 | } |