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; 22 23import java.util.Set; 24 25class MediaMetadataCompatApi21 { 26 public static Set<String> keySet(Object metadataObj) { 27 return ((MediaMetadata)metadataObj).keySet(); 28 } 29 30 public static Bitmap getBitmap(Object metadataObj, String key) { 31 return ((MediaMetadata)metadataObj).getBitmap(key); 32 } 33 34 public static long getLong(Object metadataObj, String key) { 35 return ((MediaMetadata)metadataObj).getLong(key); 36 } 37 38 public static Object getRating(Object metadataObj, String key) { 39 return ((MediaMetadata)metadataObj).getRating(key); 40 } 41 42 public static CharSequence getText(Object metadataObj, String key) { 43 return ((MediaMetadata) metadataObj).getText(key); 44 } 45 46 public static class Builder { 47 public static Object newInstance() { 48 return new MediaMetadata.Builder(); 49 } 50 51 public static void putBitmap(Object builderObj, String key, Bitmap value) { 52 ((MediaMetadata.Builder)builderObj).putBitmap(key, value); 53 } 54 55 public static void putLong(Object builderObj, String key, long value) { 56 ((MediaMetadata.Builder)builderObj).putLong(key, value); 57 } 58 59 public static void putRating(Object builderObj, String key, Object ratingObj) { 60 ((MediaMetadata.Builder)builderObj).putRating(key, (Rating)ratingObj); 61 } 62 63 public static void putText(Object builderObj, String key, CharSequence value) { 64 ((MediaMetadata.Builder) builderObj).putText(key, value); 65 } 66 67 public static void putString(Object builderObj, String key, String value) { 68 ((MediaMetadata.Builder) builderObj).putString(key, value); 69 } 70 71 public static Object build(Object builderObj) { 72 return ((MediaMetadata.Builder)builderObj).build(); 73 } 74 } 75} 76