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.media.Rating; 20 21class RatingCompatApi21 { 22 public static Object newUnratedRating(int ratingStyle) { 23 return Rating.newUnratedRating(ratingStyle); 24 } 25 26 public static Object newHeartRating(boolean hasHeart) { 27 return Rating.newHeartRating(hasHeart); 28 } 29 30 public static Object newThumbRating(boolean thumbIsUp) { 31 return Rating.newThumbRating(thumbIsUp); 32 } 33 34 public static Object newStarRating(int starRatingStyle, float starRating) { 35 return Rating.newStarRating(starRatingStyle, starRating); 36 } 37 38 public static Object newPercentageRating(float percent) { 39 return Rating.newPercentageRating(percent); 40 } 41 42 public static boolean isRated(Object ratingObj) { 43 return ((Rating)ratingObj).isRated(); 44 } 45 46 public static int getRatingStyle(Object ratingObj) { 47 return ((Rating)ratingObj).getRatingStyle(); 48 } 49 50 public static boolean hasHeart(Object ratingObj) { 51 return ((Rating)ratingObj).hasHeart(); 52 } 53 54 public static boolean isThumbUp(Object ratingObj) { 55 return ((Rating)ratingObj).isThumbUp(); 56 } 57 58 public static float getStarRating(Object ratingObj) { 59 return ((Rating)ratingObj).getStarRating(); 60 } 61 62 public static float getPercentRating(Object ratingObj) { 63 return ((Rating)ratingObj).getPercentRating(); 64 } 65} 66