1/*
2 * Copyright (C) 2014 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
17package android.support.v4.media;
18
19import android.graphics.Bitmap;
20import android.media.MediaMetadata;
21import android.media.Rating;
22import android.os.Parcel;
23import android.support.annotation.RequiresApi;
24
25import java.util.Set;
26
27@RequiresApi(21)
28class MediaMetadataCompatApi21 {
29    public static Set<String> keySet(Object metadataObj) {
30        return ((MediaMetadata)metadataObj).keySet();
31    }
32
33    public static Bitmap getBitmap(Object metadataObj, String key) {
34        return ((MediaMetadata)metadataObj).getBitmap(key);
35    }
36
37    public static long getLong(Object metadataObj, String key) {
38        return ((MediaMetadata)metadataObj).getLong(key);
39    }
40
41    public static Object getRating(Object metadataObj, String key) {
42        return ((MediaMetadata)metadataObj).getRating(key);
43    }
44
45    public static CharSequence getText(Object metadataObj, String key) {
46        return ((MediaMetadata) metadataObj).getText(key);
47    }
48
49    public static void writeToParcel(Object metadataObj, Parcel dest, int flags) {
50        ((MediaMetadata) metadataObj).writeToParcel(dest, flags);
51    }
52
53    public static Object createFromParcel(Parcel in) {
54        return MediaMetadata.CREATOR.createFromParcel(in);
55    }
56
57    public static class Builder {
58        public static Object newInstance() {
59            return new MediaMetadata.Builder();
60        }
61
62        public static void putBitmap(Object builderObj, String key, Bitmap value) {
63            ((MediaMetadata.Builder)builderObj).putBitmap(key, value);
64        }
65
66        public static void putLong(Object builderObj, String key, long value) {
67            ((MediaMetadata.Builder)builderObj).putLong(key, value);
68        }
69
70        public static void putRating(Object builderObj, String key, Object ratingObj) {
71            ((MediaMetadata.Builder)builderObj).putRating(key, (Rating)ratingObj);
72        }
73
74        public static void putText(Object builderObj, String key, CharSequence value) {
75            ((MediaMetadata.Builder) builderObj).putText(key, value);
76        }
77
78        public static void putString(Object builderObj, String key, String value) {
79            ((MediaMetadata.Builder) builderObj).putString(key, value);
80        }
81
82        public static Object build(Object builderObj) {
83            return ((MediaMetadata.Builder)builderObj).build();
84        }
85    }
86}
87