Home | History | Annotate | Download | only in playback
      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 package com.android.onemedia.playback;
     17 
     18 import android.os.Bundle;
     19 
     20 import java.util.HashMap;
     21 import java.util.Map;
     22 
     23 /**
     24  * TODO: Insert description here. (generated by epastern)
     25  */
     26 public class RequestUtils {
     27     public static final String ACTION_SET_CONTENT = "set_content";
     28     public static final String ACTION_SET_NEXT_CONTENT = "set_next_content";
     29     public static final String ACTION_PAUSE = "com.android.onemedia.pause";
     30     public static final String ACTION_PLAY = "com.android.onemedia.play";
     31     public static final String ACTION_REW = "com.android.onemedia.rew";
     32     public static final String ACTION_FFWD = "com.android.onemedia.ffwd";
     33     public static final String ACTION_PREV = "com.android.onemedia.prev";
     34     public static final String ACTION_NEXT = "com.android.onemedia.next";
     35 
     36     public static final String EXTRA_KEY_SOURCE = "source";
     37     public static final String EXTRA_KEY_METADATA = "metadata";
     38     public static final String EXTRA_KEY_HEADERS = "headers";
     39 
     40     private RequestUtils() {
     41     }
     42 
     43     public static class ContentBuilder {
     44         private Bundle mBundle;
     45 
     46         public ContentBuilder() {
     47             mBundle = new Bundle();
     48         }
     49 
     50         public ContentBuilder setSource(String source) {
     51             mBundle.putString(EXTRA_KEY_SOURCE, source);
     52             return this;
     53         }
     54 
     55         /**
     56          * @see MediaItemMetadata
     57          * @param metadata The metadata for this item
     58          */
     59         public ContentBuilder setMetadata(Bundle metadata) {
     60             mBundle.putBundle(EXTRA_KEY_METADATA, metadata);
     61             return this;
     62         }
     63 
     64         public ContentBuilder setHeaders(HashMap<String, String> headers) {
     65             mBundle.putSerializable(EXTRA_KEY_HEADERS, headers);
     66             return this;
     67         }
     68 
     69         public Bundle build() {
     70             return mBundle;
     71         }
     72     }
     73 }
     74