1 /* 2 * Copyright (C) 2016 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 com.android.tv.dvr.ui; 18 19 import android.support.annotation.NonNull; 20 import com.android.tv.common.SoftPreconditions; 21 import java.util.HashMap; 22 import java.util.Map; 23 24 /** Stores the object to pass through activities/fragments. */ 25 public class BigArguments { 26 private static final String TAG = "BigArguments"; 27 private static Map<String, Object> sBigArgumentMap = new HashMap<>(); 28 29 /** Sets the argument. */ setArgument(String name, @NonNull Object value)30 public static void setArgument(String name, @NonNull Object value) { 31 SoftPreconditions.checkState(value != null, TAG, "Set argument, but value is null"); 32 sBigArgumentMap.put(name, value); 33 } 34 35 /** Returns the argument which is associated to the name. */ getArgument(String name)36 public static Object getArgument(String name) { 37 return sBigArgumentMap.get(name); 38 } 39 40 /** Resets the arguments. */ reset()41 public static void reset() { 42 sBigArgumentMap.clear(); 43 } 44 } 45